Jump to content
  • 0

Filling ammo box with array


chi

Question

I was wondering if there was a simpler way to add a certain number of items to this array by actually using a number, and not having to repeat the item so many times.

 

  Reveal hidden contents

Thanks to whoever can help me out here.

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

here thers an example:

  Reveal hidden contents

 

Link to comment
Share on other sites

  • 0

Thats awesome. Thanks for the reply.

I was hoping for something like

[M9sd,1]

[[Cinderwall,4],[mortarbucket,1]] etc.

Excuse my coding ignorance, lol. Just trying to learn a little something.

Thanks again for the reply juandayz.

Link to comment
Share on other sites

  • 0
_loot_build = ["MortarBucket","MortarBucket","ItemCorrugated","ItemCorrugated","ItemCorrugatedLg","CinderBlocks","jerrycan_epoch","VehicleRepairLg","VehicleRepair","CircuitParts","ItemScraps","ItemScraps","KitShelf","KitWoodFloor","KitWoodStairs"];
_this addMagazineCargoGlobal [(_loot_build call BIS_fnc_selectRandom),(10 + floor(random 2))];

try it.

Link to comment
Share on other sites

  • 0

So...

I've learned a lot about spawning items just from this thread, but just to get on your nerves a little more.....

  Reveal hidden contents

 

This is something like i want, but of course this doesn't work. It only spawns the weapon, and then only 1 of whichever magazine it picks.

 

Of course I would want more than one array for it to pick from also. Maybe like this??

  Reveal hidden contents

 

Can you help me to get this to work? Or is it possible.

 

I want it this way so that the boxes will spawn "packages". Like maybe building stuff one time, and rare weapons and ammo the next.

 

Thanks in advance.

Link to comment
Share on other sites

  • 0

 

example crate

  Reveal hidden contents

if u need delete the crate after x time add at bottom after END OF CRATE

sleep 180; //tiime in seconds 180/60 = 3 minutes  this gonna  sleep 3 minutes and then run the code bellow

deleteVehicle _crate1; 

Also you can delete it by player vs distance of this box

//define another vriable

_distance = 50; //mts

waitUntil {(player distance _crate1) > _distance};
deleteVehicle _crate1;

Or using server time:

waituntil {(round(time)) > 300};

if (time > 300) then {

deleteVehicle _crate1;

   [nil,nil,rTitleText,"_crate1 was removed", "PLAIN",10] call RE; //text format for all players

   //titleText [" _crate1 was removed ", "PLAIN DOWN"];titleFadeOut 5;// Text format only for player who spawn the box

//[format["<t align='center' size='0.75' color='#ff5200'>%1 _crate1 was removed.</t>",(name player)],0,0,2,2]spawn

BIS_fnc_dynamicText; //text format only for who spawn the box but more beauty :D with colors and sizes

};

 

 

 

Link to comment
Share on other sites

  • 0
  On 7/30/2016 at 7:15 PM, juandayz said:

 

example crate

  Reveal hidden contents

if u need delete the crate after x time add at bottom after END OF CRATE

sleep 180; //tiime in seconds 180/60 = 3 minutes  this gonna  sleep 3 minutes and then run the code bellow

deleteVehicle _crate1; 

Also you can delete it by player vs distance of this box

//define another vriable

_distance = 50; //mts

waitUntil {(player distance _crate1) > _distance};
deleteVehicle _crate1;

Or using server time:

waituntil {(round(time)) > 300};

if (time > 300) then {

deleteVehicle _crate1;

   [nil,nil,rTitleText,"_crate1 was removed", "PLAIN",10] call RE; //text format for all players

   //titleText [" _crate1 was removed ", "PLAIN DOWN"];titleFadeOut 5;// Text format only for player who spawn the box

//[format["<t align='center' size='0.75' color='#ff5200'>%1 _crate1 was removed.</t>",(name player)],0,0,2,2]spawn

BIS_fnc_dynamicText; //text format only for who spawn the box but more beauty :D with colors and sizes

};

 

 

 

Expand  

WOW! Now thats detail! Thanks @juandayz! You are the best!!

Link to comment
Share on other sites

  • 0

also u can make a lil function with this and leave server alone to spawn crates each X time. see:

 

example_crate.sqf   (paste into MPMISSIONS/Your instance)

  Reveal hidden contents

now go to your init.sqf--  into if is server  section paste:

if (isServer) then {
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";
    _nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";

    _serverMonitor =     [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";


    _example_crate = [] execVM "example_crates.sqf";
    
};

Link to comment
Share on other sites

  • 0

:D here u have another example, i use it in my server, its a little adapt of rubble town event.

this spawn a crate like an event, do you remember heli crash? well

call it chi_crate.sqf  paste into ....\@DayZ_Epoch_Server\addons\dayz_server\modules\

chi_crate.sqf 

  Reveal hidden contents

 

open your init.sqf paste lines in red

  Reveal hidden contents

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...