Jump to content
Sign in to follow this  

Recommended Posts

I'm making a mission where I wish to create a wrecked helicopter at one of five random locations. I've achieved this successfully with the following code in the init.sqf. and the use of game logics

call compile format ["heli setPos [(getPos pos%1 select 0),(getPos pos%1 select 1),0]",ceil(random 5)];

However I would like to place two dead pilots at the random location of the helicopter wreck and I also want to create a trigger at the same location.

Is this possible?

Share this post


Link to post
Share on other sites

you could just use man1 setpos getpos heli;man2 setpos getpos heli; trigname attachto [heli,[0,0,0]]; after the call compile.

not pretty but it would work

Share this post


Link to post
Share on other sites

Could have just placed markers and group them to the heli. Anyway...

I'd do it with these two small functions:

SHK_pos.sqf

SHK_createTrigger.sqf

SHK_createTrigger = compile preprocessfile "SHK_createTrigger.sqf";
SHK_pos = compile preprocessfile "SHK_pos.sqf";

[getpos heli,[100,100,0,true],["WEST","PRESENT",true],["this","",""],"NONE"] call SHK_createTrigger;

man1 setpos ([getpos heli,random 360,[5,20]] call SHK_pos);
man2 setpos ([getpos heli,random 360,[5,20]] call SHK_pos);

Trigger function takes the usual trigger settings (position,size,activation and condition/onact]).

Man positions are picked between 5 and 20 meters from the heli, at random direction from it.

Share this post


Link to post
Share on other sites

Thanks for your help with this I appreciate it. :)

I'm new to creating triggers with code (sorry), how would it be written to have the trigger actiavte when blufor are within 20 metres of the heli?

Share this post


Link to post
Share on other sites

[getpos heli,[10,10,0,false],["WEST","PRESENT",true],["this","Here is the onAct field",""],"NONE"] call SHK_createTrigger;

Replace the red text with whatever the trigger is supposed to do. It's exactly same as the onAct field in a trigger in editor.

Share this post


Link to post
Share on other sites

SHK_createTrigger = compile preprocessfile "SHK_createTrigger.sqf";
SHK_pos = compile preprocessfile "SHK_pos.sqf";

[getpos heli,[100,100,0,true],["WEST","PRESENT",true],["this","",""],"NONE"] call SHK_createTrigger;

man1 setpos ([getpos heli,random 360,[5,20]] call SHK_pos);
man2 setpos ([getpos heli,random 360,[5,20]] call SHK_pos);

I can't get this to work, I get the heli but not the pilots or trigger. Where does the above code go?

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  

×