OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: KevBaz on 18 Jul 2009, 01:36:03

Title: trigger to createvehicle and more
Post by: KevBaz on 18 Jul 2009, 01:36:03
hi folks, im trying to create a trigger that detects the altitue of a player and if over a certain height it spawns a sam site, mans it, targets the player and fires at the player.

so far i have this in a trigger but no joy

 

cond

Code: [Select]
(getPos ap select 2) > 100

act

Code: [Select]
sam = createVehicle ["stinger_pod", getpos player]; "RUS_Soldier2" createUnit [position sam, group red,"this moveingunner sam; sam dotarget ap; sam dofire ap"];

any ideas?
Title: Re: trigger to createvehicle and more
Post by: Planck on 18 Jul 2009, 12:26:57
Try:

sam = "stinger_pod" createVehicle getpos player; "RUS_Soldier2" createUnit [(getpos sam), groupred,"this moveingunner sam; sam dotarget ap; sam dofire ap"];

One thing though, the groupName must exist or the crew unit won't be created.


Planck
Title: Re: trigger to createvehicle and more
Post by: KevBaz on 18 Jul 2009, 14:00:09
thanks for the reply, but its still not working

i have a unit on the map with this in his init

red = group this

thats enough to create the group isnt it?

should the trigger be sync'd with the player? or is there a better way to do it?

i dont get any errors just nothing gets created


over at bis ive had some help from F2k Sel

http://forums.bistudio.com/showthread.php?t=80453

Code: [Select]
// nul=[target] execVM"spawn.sqs"

_target = _this select 0;

_unit = "RUS_Soldier2";
mygroup = creategroup side player;
_sam = createVehicle ["stinger_pod", getpos player,[],0,"fly"];
_unit createUnit [(getpos player), mygroup,"man=this;"];
_unit = man;
_unit moveingunner _sam;
_sam reveal _target;
_sam dotarget _target;
_sam dofire _target;

Code: [Select]
nul=[ap] execVM"spawn.sqs"
this now spawns the stinger (YAY!) , but its in midair, is there a way to make it spawn on the players location but on the ground within a set diameter?