Jump to content
Sign in to follow this  
TAW_Yonose

Random spawn point

Recommended Posts

Hey, I'm making a Sniper mission where the sniper have to find a intel, but I want the intel to spawn into a random cargo.

Like i have set out 5 cargos at different locations, but I just want the item to spawn randomly in one of those cargos.

How should I do this?

- Yonose

Share this post


Link to post
Share on other sites

Group the intel with markers. It'll spawn where placed or at one of the markers automatically.

Share this post


Link to post
Share on other sites
Group the intel with markers. It'll spawn where placed or at one of the markers automatically.

Will it spawn into a Supply Box then?

Share this post


Link to post
Share on other sites

Oh, sorry misread it. So you have 5 preplaced ammo boxes and you want ONE of them to have the item inside? Super easy. :)

In your init.sqf:

if (isServer) then {
_crates = [ammo1, ammo2, ammo3, ammo4, ammo5];
_crate = _crates call BIS_fnc_selectRandom;

_intel = _crate addWeaponCargoGlobal ["WhateverItem", 1];
};

Share this post


Link to post
Share on other sites

Thank you so much.. now i still got this problem since im new to scripting... Do i have to call the Supply boxes

ammo1, ammo2, ammo3, ammo4, ammo5 ?

or BIS_fnc_selectRandom?

Do i need to change something else then "WhatEverItem" ?

and shouldnt it be _intel = _crate addItemCargoGlobal ["optic_NVS", 1];

and not _intel = _crate addWeaponCargoGlobal ["WhateverItem", 1];

Edited by TAW_Yonose

Share this post


Link to post
Share on other sites

Yeah, exactly, the intel line would be: _intel = _crate addItemCargoGlobal ["optic_NVS", 1];

I didn't know what item you were using, so:

if (isServer) then {      
    _crates = [ammo1, ammo2, ammo3, ammo4, ammo5];      
    _crate = _crates call BIS_fnc_selectRandom;        
    _intel = _crate addItemCargoGlobal ["optic_NVS", 1];  
}; 

Share this post


Link to post
Share on other sites

well.. this is weird, this isent working with me, i cant see the item spawning inside the supply box..:(

Share this post


Link to post
Share on other sites

Make sure you're naming the ammo boxes correctly:

A5aXQyz.jpg

Also is your init.sqf listed as an SQF file or a Text Document in your mission folder? If it says it's a Text then it's actually named init.sqf.txt and isn't running. Remove the .txt extension.

Share this post


Link to post
Share on other sites

ahhh... hehe okey i'll try that, good i learned on the school today how i did it :P

Edited by TAW_Yonose

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×