Basic Day Z Food Box (First Script)

Posts 16–26 of 26 · Page 2 of 2
Quote Originally Posted by Jim Morrison View Post
Well this code is pretty simple, it just spawns a box near the player with food and a coyote backpack so this is a simple script:
_className = "USBasicItemsBox";
_mypos = getposATL player;
_dir = getdir player;
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
_magicbox = createVehicle [_className, _mypos, [], 0, "CAN_COLLIDE"];
_magicbox setDir _dir;
_magicbox setposATL _mypos;

_items = [
"FoodSteakCooked",
"FoodCanBakedBeans",
"FoodCanSardines",
"FoodCanPasta",
"ItemSodaCoke",
"ItemSodaPepsi",
"ItemWaterbottle",
];

_backpack = [
"DZ_Backpack_EP1"
];

clearitemsCargoGlobal _magicbox;
clearBackpackCargoGlobal _magicbox;

{_magicbox additemsCargoGlobal [_x, 50];} forEach _items;
{_magicbox addBackpackCargoGlobal [_x, 1];} forEach _backpack;

sleep 90;
deleteVehicle _magicbox;
if (true) exitWith {};
It may look pretty straightforward, I guess you don't wanna explain the different functions in there? (makes it easier to understand)
Quote Originally Posted by Gray View Post
It may look pretty straightforward, I guess you don't wanna explain the different functions in there? (makes it easier to understand)
All right i'll do my best, so the first part tells the script that I want to spawn a box and where I want it to spawn. The 2nd part are the items I want to spawn in and the 3rd are the backpacks. The 4th and 5th tell the game how many of each item I want to spawn in hence the x50 and x1. Then the last part deletes the box after 90 seconds.
Quote Originally Posted by Jim Morrison View Post
All right i'll do my best, so the first part tells the script that I want to spawn a box and where I want it to spawn. The 2nd part are the items I want to spawn in and the 3rd are the backpacks. The 4th and 5th tell the game how many of each item I want to spawn in hence the x50 and x1. Then the last part deletes the box after 90 seconds.
So by that logic, I could probably spawn in a pitched tent with items in it now can't I?
If you have time at some point maybe you could explain it better in skype or something?

If you do feel like taking that step, I'll PM you my details.
Quote Originally Posted by Jim Morrison View Post
Maybe over the summer, I got school work currently.
Same :P I'm trying to learn but it's hard to balance reading and sleep xD
Here it is, full explanation:
Code:
_className = "USBasicItemsBox"; //_className = Model you want to spawn
_mypos = getposATL player; //_mypos = Get position of player (vehicle player)/you
_dir = getdir player; //_dir = Gets direction you are looking at
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)]; //Gets your position and modifies it so it spawns in front of you
_magicbox = createVehicle [_className, _mypos, [], 0, "CAN_COLLIDE"]; //_magicbox = Created vehicle; [_className, _mypos, [], 0, "CAN_COLLIDE"] is its spawn line, then, _className = "USBasicItemsBox"; _mypos = Your position +statements that slightly modifies its position
_magicbox setDir _dir; // Set _magicbox direction to player direction (_magicbox _dir = _dir)
_magicbox setposATL _mypos; //Sets _magicbox modified player _mypos

//_items = "ClassNames"
_items = [
"FoodSteakCooked",
"FoodCanBakedBeans",
"FoodCanSardines",
"FoodCanPasta",
"ItemSodaCoke",
"ItemSodaPepsi",
"ItemWaterbottle",
];

//_backpack = "ClassNames"
_backpack = [
"DZ_Backpack_EP1"
];

clearitemsCargoGlobal _magicbox; //Clears the box content (items) globaly
clearBackpackCargoGlobal _magicbox; //Clears the box content (backpacks) globaly

{_magicbox additemsCargoGlobal [_x, 50];} forEach _items; //Add 50 of _items in _magicbox
{_magicbox addBackpackCargoGlobal [_x, 1];} forEach _backpack; //Add 1 of _backpack in _magicbox

sleep 90; //Script is not over, wait 90 seconds until next action
deleteVehicle _magicbox; //Deletes _magicbox (which is a vehicle)
if (true) exitWith {};
Quote Originally Posted by guirc View Post
snipped-
So, what program is this coded with?
Because it seems like it probably could be done with notepad++ or something.

Please enlighten me more.
Quote Originally Posted by Gray View Post
So, what program is this coded with?
Because it seems like it probably could be done with notepad++ or something.

Please enlighten me more.
Jup notepad++ is fine for this. Also, the code Is probably just copy'd and only the items are changed. Not coding if you ask me :P
but whatever.
Quote Originally Posted by petermeh View Post
Jup notepad++ is fine for this. Also, the code Is probably just copy'd and only the items are changed. Not coding if you ask me :P
but whatever.
Even if it is, there is no point altering something that's not broken.
Quote Originally Posted by Gray View Post
Even if it is, there is no point altering something that's not broken.
Actually it is "broken". Battleye is getting it detected...
Quote Originally Posted by guirc View Post
Actually it is "broken". Battleye is getting it detected...
Alrighty, klol.
couldnt you take this script and replace something like "FoodSteakCooked", with a class name for a weapon?
Posts 16–26 of 26 · Page 2 of 2

Post a Reply

Similar Threads

Talk with us