OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: smoke52 on 14 Aug 2007, 11:46:43
-
i have two questions (read the bottom for question 2)...anyway for my mission i am making the port area in Corazol a hostage and bomb situation. the hostages are supposed to spawn in one of 3 warehouse buildings in the port.
im using a script that spawns two guys in a random location. the script works fine but I am having trouble with the hostages spawning on the outside of the building when they get created.
i think its because the game is trying to spawn them on the roof but the game doesnt allow that and spawns them outside around it...
what do i need to add to get them to spawn inside somewhere?
heres the script
_hostages = createGroup west;
_locations = ["hostage1", "hostage2", "hostage3"]
_rndloc = (random (count _locations)) - 0.5
_spot = _locations select _rndloc
_hos1 = _hostages createUnit ["SoldierWB", (getmarkerpos _spot), [] ,0 ,"corporal"];
removeallweapons _hos1
_hos1 setcaptive true
_hos1 setDir random 360;
_hos1 allowfleeing 0;
_hos1 setBehaviour "AWARE";
_hostages selectLeader _hos1;
_hos1 switchmove "testsurrender";
_hos1 DisableAI "ANIM";
~1
_hos2 = _hostages createUnit ["SoldierWB", (getmarkerpos _spot), [] ,0 ,"private"];
removeallweapons _hos2
_hos2 setcaptive true
_hos2 setDir random 360;
_hos2 allowfleeing 0;
_hos2 setBehaviour "AWARE";
_hos2 switchmove "testsurrender";
_hos2 DisableAI "ANIM";
also how do i get a trigger to spawn in the same area that the hostages are in?
-
just setpos em after dey r spawned (use setpos command :P)
nd samething w/ triger... use da spawning trigs copmmands (check comref...) nd spawn it on top of em (nd add setpos comand 2 make sure :P ;)
more extensive answer after im back from work... if no1 answers b4 me :D
LCD OUT
-
To spawn units inside buildings use buildingPos (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=a#buildingPos) command. And yes, roof of the buildings are at height 0, like ground level. Note that to use buildingPos command, the desired building must have defined indexed positions. If this is not the case, you may still spawn them outside, near the door and just a bit above the ground (for example, 10 cm), and push them inside with setVelocity. Another option may be to spawn them with a negative height, than may make them to spawn below the roof of the building.
About the trigger, may you explain a bit more what's its purpose?
-
this works for me!
_hos1 setPos ((nearestbuilding _hos1) buildingPos 1)
the trigger is to detect the player and tell the hostages to enable their ANIM and join the player.
i been trying the setpos command and create trigger commands but its not working, if i keep going at it i might figure it out, but im going to bed.
also for the trigger activation i want to exec a new script called hosrescue.sqs which will have the commands to re-enable their animations and join the player, but i ran into a snag...
how do i give the two hostages names so the hosrescue script can tell them the new commands? will this command work?
_hos1 = name hos1
then in the hosrescue.sqs script i can put
hos1 EnableAI "ANIM";
hos2 EnableAI "ANIM";
hos1 joinsilent player;
hos2 joinsilent player;
?
thanks!
-
Are you creating them with CreateUnit?
nameofunit = Createunit...
Cant remember syntax but put that at the start.
-
create the trigger from the editor like a normal one, group it with the player (select vehicle there) and give a name to the trigger, trg_hostages, for example.
In the script where you place the hostages put trg_hostages setPos (getmarkerpos _spot) and, in the condition field put this && ({alive _x} count [hos1, hos2] > 0) so the player is close to the hostages and at least one of them is still alive.
-
edit: thanks guys! all my questions have been answered :good:
i will probably have a couple more soon.