OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MPKING on 13 Jul 2003, 13:34:56
-
I have a squad with a waypoint and when they reach the waypoint they are ordered to take positions where i have put little dot-markers in bushes and around trees. In the activation field of the waypoint i have tried to use the command a1 DoMove getMarkerPos markername and a1 commandMove getMarkerPos markername but it doesn't work ??? The little bastards just finds a spot themselves. >:(
But if i use triggers instead of markers and use the command a1 DoMove or commandMove triggername it works just fine. But i would rather use markers because i've heard that use of many triggers can cause lag.
Secondly if i do manage to get them to theyr'e markers or triggers how da hell do i get them to stay when they see an enemy without disabling ai sections ??? Is that possible?
Can i make some kind of script that loops the command doStop unitname?
-
getMarkerPos requires quotation marks:
unit commandMove getMarkerPos "markername"
-
;D works like a charm :D. Thanks man!
-
Does anybody have a solution to my second problem? ::) ???
I use the command unitname stop true and then made a trigger with unitname stop false in the activation field and that works fine.
Except when that command is activated the unit runs of where he pleases.
I just wanna know if there's a way to hold the units on there positions while the fighting goes on, instead of running out in the open chasing a bullet?
Or does that require advanced scripting?
Any help is greatly appriciated, i'll i even buy you beers if you ever come to denmark! ;)
-
Does anybody have a solution to my second problem? ::) ???
I use the command unitname stop true and then made a trigger with unitname stop false in the activation field and that works fine.
Except when that command is activated the unit runs of where he pleases.
I just wanna know if there's a way to hold the units on there positions while the fighting goes on, instead of running out in the open chasing a bullet?
Or does that require advanced scripting?
Any help is greatly appriciated, i'll i even buy you beers if you ever come to denmark! ;)
Use "dostop this". Place a small trigger over your marker and group it with the soldier which is going to camp near the marker. At the trigger's init field wright:
dostop soldiername
-
Thank's for trying to help Stalker. :) But i've already tried that and the unit's still run away as soon they have identified a target. I guess the only solution is to disable AI "MOVE", but i can't re-enable the ai then or can i?
-
Hey MPKING!
If you disable AIMove then you will NOT be able to undo this action without using the "domove" command.
Have you tried using a "Hold" WP then using a switch trigger to get the troops moving again? See this thread (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=3526;start=0 (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=3526;start=0)) on a couple of possible solutions for you!
If I can make it to Denmark in 2004, I will take you up on you offer, if it works of course! :cheers:
Wadmann
-
Hey Wadmann
Nope.. that damn :gunman: AI! will not for the love of god stay down! :help: I'm gonna write a complaint to BIS for not teaching the AI about modern warfare. ;)
But you tried to help :thumbsup: so the beers are still on me :cheers:
-
how about you do it the old fashioned way and use waypoints from the editor.
Place 1st waypoint directly on top of the AI leader so that it becomes 'attached' to him. Type 'gogo' to the condition line. Then make a second waypoint for the AI leader, place it to the front of the house or whereever you wanted them to move.
Now buddy'o all you've gotta do is make that 'gogo' condition true in some trigger or where ever by using 'gogo=true' in some activation line or whatever ;D
-
how about you do it the old fashioned way and use waypoints from the editor.
Place 1st waypoint directly on top of the AI leader so that it becomes 'attached' to him. Type 'gogo' to the condition line. Then make a second waypoint for the AI leader, place it to the front of the house or whereever you wanted them to move.
Now buddy'o all you've gotta do is make that 'gogo' condition true in some trigger or where ever by using 'gogo=true' in some activation line or whatever ;D
;D I think you misunderstood my question. The problem isn't getting them to move.
I want the ai to prepare for an ambush on a forest edge near a road and when they reach a waypoint they "doMove" to markers i have put in edges of bushes and trees.
And when they reach the markers i have put little triggers on top with the command "doStop unitname" and that works fine.. no problem.
But when the shooting starts the AI units leave theyr'e cover and runs out in the open (sometimes) to engage the enemy.. big problem.. very unrealistic.
Is there a way to solve this without disableAI "Move"?
Cheers.
-
you can try
_unit doMove getmarkerpos "markername"
@unitReady _unit
_unit setBehaviour "STEALTH" (to use cover)
_unit setUnitPos "DOWN" (to get prone)
_unit stop true (to stop them)
_unit allowfleeing 0 (donÂ't let them flee)
maybe you have to "ungroup" them (that the commander donÂ't tell them what to do ...) 8)
-
This is a standard problem in AI behaviour. They are prety much hard coded to advance towards the enemy. When you think about it, this is more or less essential to make the game fun to play. BIS are good enough of course to make it much more complex than that, but that's basically what happens.
Making AI do what you want them to do here is difficult, though it has come up before and a really good effort with the forum search function might bring up something useful.
Try setting them to behaviour "combat" when the shooting starts, which will encourage them to stay prone. You could also run a looping script, something like this:-
#loop
"_x doMove getPos _x" forEach units loonGroup
~2
goto "loop"
syntax definitely not guaranteed, you'll probably have to play with it a bit but hopefully you can see what I mean. You could use the marker positions rather than the loon's own position, not sure which will look more realistic - you'll have to experiment.
-
Damn I seem to have answerred the right question, but in the wrong thread. how embarresing :-[ ;D
Was reading through the threads, didn't answer but then decited to come back and give it a quick solution.. only now I realise I opened up a thread similar, but no where similar to the one I was going to answer to :D
-
you can try
_unit doMove getmarkerpos "markername"
@unitReady _unit
_unit setBehaviour "STEALTH" (to use cover)
_unit setUnitPos "DOWN" (to get prone)
_unit stop true (to stop them)
_unit allowfleeing 0 (donÂ't let them flee)
maybe you have to "ungroup" them (that the commander donÂ't tell them what to do ...) 8)
Well with the setUnitPos "DOWN" and setBehaviour "STEALTH" it work's.
well not quite the way i wanted but at least they don't charge out in the open seeking a target.
unit stop true is not so good because that command freezes the AI completely and they won't fire.
This is a standard problem in AI behaviour. They are prety much hard coded to advance towards the enemy. When you think about it, this is more or less essential to make the game fun to play. BIS are good enough of course to make it much more complex than that, but that's basically what happens.
Making AI do what you want them to do here is difficult, though it has come up before and a really good effort with the forum search function might bring up something useful.
Try setting them to behaviour "combat" when the shooting starts, which will encourage them to stay prone. You could also run a looping script, something like this:-
#loop
"_x doMove getPos _x" forEach units loonGroup
~2
goto "loop"
syntax definitely not guaranteed, you'll probably have to play with it a bit but hopefully you can see what I mean. You could use the marker positions rather than the loon's own position, not sure which will look more realistic - you'll have to experiment.
I tried playing around with that script but no succes, it's like the AI ignores the looped command when in battle.
I'm gonna hit da solve button because with the setUnitpos command i got a result i can live with.
I knew that one but figured that AI would ignore it when in combat just like doStop.
But thankyou all for your help, it's greatly appreciated.
Cheers :cheers: