Home   Help Search Login Register  

Author Topic: Mission Editor Question  (Read 1390 times)

0 Members and 2 Guests are viewing this topic.

elemental123

  • Guest
Mission Editor Question
« on: 16 Aug 2005, 15:02:21 »
OK this may be a total noob question but, does anyone know how i can place AI units in guard towers?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Mission Editor Question
« Reply #1 on: 16 Aug 2005, 15:05:20 »
Welcome to the forum!

Place the unit on the map, on top of the tower.   Write this in the init field of the unit:-

this setpos [getpos this select 0, getpos this select 1, (getpos this select 2) + 6]; this setUnitPos "up"; doStop this; this disableAI "target"; this disableAI "move"

You may have to play with it a little to get exactly what you want:  for example you may not want all the disable commands.    Depending which tower it is, you may need to change the 6.
« Last Edit: 16 Aug 2005, 15:07:45 by macguba »
Plenty of reviewed ArmA missions for you to play

DoDgY

  • Guest
Re:Mission Editor Question
« Reply #2 on: 16 Aug 2005, 16:03:25 »
Sorry to threadjack but I have found a problem with what you have said Macguba, when you put
this setunitpos "up"
He looks like he's constantly aiming, so is there a way he will be "safe" then when he detects an enemy, he goes setunitpos "up". I guess it needs a "detected by side" trigger :(.

Offline 456820

  • Contributing Member
  • **
Re:Mission Editor Question
« Reply #3 on: 16 Aug 2005, 16:03:43 »
with some guard towers you can actually create a waypoint on top of it and when you edit the waypoint a new field saying pos : and it has a list of possible places that unt can move to within the tower
also you dont always need to set pos the unit into it it withs already placed you can just move the unit over the top of the tower and he should be in it

also with what Macguba said if you dont want your ai unit to fire use his but if you want the guy to fire at people remove
Code: [Select]
this disableAI "target"; from his code

hope that helps

Offline Pilot

  • Contributing Member
  • **
Re:Mission Editor Question
« Reply #4 on: 16 Aug 2005, 16:04:47 »
Actually, if the tower is part of the map and not an object that has been added via the mission editor, you shouldn't have to change the unit's height.  Just move him around the area of the tower until he is in it.  OFP will automatically move the unit to the highest roadway lod if that lod is part of a permament object.

-Student Pilot

dan ick

  • Guest
Re:Mission Editor Question
« Reply #5 on: 16 Aug 2005, 18:37:59 »
Sorry to threadjack but I have found a problem with what you have said Macguba, when you put
this setunitpos "up"
He looks like he's constantly aiming, so is there a way he will be "safe" then when he detects an enemy, he goes setunitpos "up". I guess it needs a "detected by side" trigger :(.
Quote

Yes dodgy,

Just set him safe or whatever,set up the trigger and then in the triggers On activ field put:- unitname setunitpos "up";unitname setbehaviour "combat";(if needed)this setcombatmode "red".

unitname=name your soldier and replace unitname with your soldiers name

Dont know how familiar you are with ofp codes,so excuse me if iam insulting you by telling you stuff you already know.

Dan :P
« Last Edit: 16 Aug 2005, 18:39:31 by dan ick »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Mission Editor Question
« Reply #6 on: 16 Aug 2005, 18:55:02 »
Quote
also with what Macguba said if you dont want your ai unit to fire use his but if you want the guy to fire at people remove
Code:this disableAI "target";  

from his code

With disableAI target he will still fire.    

What he will not do, is try to move to a new position from which to fire.

General Barron's Comment on the online comref:-

Quote
The "TARGET" section of the AI is likely different than what you would think. Normally, when an AI group is standing still and sees an enemy, the group will break formation and start moving towards the enemy. If you disable the "TARGET" AI, then the AI units will stay where they are at.

Even if you disable the "MOVE" AI, the units will still move out to attack the enemy, unless you disable the "TARGET" AI.

Disabling both these AI sections is useful when placing units in defensive positions. This way, you can have them stay behind their cover, and not run out into the open.
« Last Edit: 16 Aug 2005, 18:56:29 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline 456820

  • Contributing Member
  • **
Re:Mission Editor Question
« Reply #7 on: 16 Aug 2005, 19:13:03 »
Quote
With disableAI target he will still fire.    

What he will not do, is try to move to a new position from which to fire.

sorry there i thought it stopped him aiming at things my mistake

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Mission Editor Question
« Reply #8 on: 16 Aug 2005, 19:46:59 »
I think you might find that this is an easier way to put a solider in a guard tower:

Find the ID of the tower then put the following in the init field for the unit:

this setpos  ( (object ID) buildingPos 1)  

eg:
this setpos  ( (object 16744) buildingPos 1)
for the guard tower at Ge75 on Malden

You then don't need to get the positioning just so for the unit on the map

You need the disable AI stuff then to make sure he doesn't walk out of the tower.


 
« Last Edit: 16 Aug 2005, 19:53:35 by THobson »

Offline Pilot

  • Contributing Member
  • **
Re:Mission Editor Question
« Reply #9 on: 16 Aug 2005, 21:35:32 »
@Dan
There are two suggestions I can make.  The first one is easier, but I don't know if it will work.  The second is more complicated, but I think it might work.
1: Check the behaviour of the unit, if not SAFE, then setunitpos UP, ex:

#Loop
?behaviour UNIT != "SAFE": UNIT Setunitpos "UP"; exit
~.5
goto "Loop"

2:
Make a trigger area that covers the whole map and make it EnemyToUNIT present.  ie, if UNIT is west, make the trigger east present, if UNIT is east then west present

then, in the trigger's condition field type:
{UNIT knowsabout _x >=.15} foreach thislist

On Activation:
UNIT SetUnitPos "UP"

UNIT is the name of the soldier in question.

Syntax not guarenteed.

-Student Pilot

pazuzu

  • Guest
Re:Mission Editor Question
« Reply #10 on: 16 Aug 2005, 22:46:46 »
There is a good script in the editors depot to put units in towers and if they fall out they get back in. This is for standard BIS islands.

Units in Towers by AK-Chester

http://www.ofpec.com/editors/index.php