OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lihamatti on 14 Jul 2004, 17:27:56
-
I have a couple of problems with AI units:
1. How can I make a unit to stay in a position and shoot a specified person?
Using dotarget and dofire works somethimes but sometimes the unit start running towards target and it tooks about 15s for him to start firing. (target distance unit < 20). I have ordered the unit to move to target with domove (before dotarget and dofire commands), maybe that's the problem?. Using stop or disableAI "move" commands will make unit stay in position but not firing. How can I enable AI move again? using unit stop false works for the "stop" command, but then again the unit will move towards target (maybe it still remembers the domove command?). Any idead?
2. How can I make a unit to run and fire at the same time?
-
1. I don't understand why you've given the loon a doMove command if you want him to stand still. What have I missed?
2. You probably can't. If you can he won't be likely to hit anything.
-
Yeah, it's been asked, you can make the AI move and fire..
Oh, did you know, in Half-Life, the enemy couldn't move and fire at the same time..</pointless fact>
;D
- Ben
-
I made a script where a police chases the player or something like that. So he first moves to target = player (in his car) and then ( when close) comes out and start shooting for a while. Then again goes in his car and drive close to player, gets out and start shooting, and so on...
-
Ah, well, in that case you might want something like this
? (shooter distance target < 20) and (shooter knowsAbout target > 1.5) : shooter doMove getPos Shooter
-
Thanks macguba, that helped.
This is much harder than I thought, though. I mean to get a script to work properly. There is always something not working as supposed. Now I'm having a problem that police can't shoot the player if player is too close (distance <10, or something). If I make the police to be on enemy side, it works otherwice, but sometimes the police starts running towards the position where its "group leader" was, even if I deleted that unit after the police got his side. Police domove getpos police don't work in this situation.