OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 28 Feb 2005, 18:35:11
-
Hi all,
I'm trying to get the eject command to work on AI, and failing :-[
Heres my problem.
There are 3 guys in a car. One called 'guy', one called player' and one called 'badguy'. None of them are in the same group. When the car hits a trigger, it speeds up, the driver (guy) dies, and the car is thrown off a cliff ;)
But heres the problem. I'm trying to get 'badguy' to eject from the car whilst its falling. I've set up a trigger that activates whilst the car is in mid-air. On it, I have put this:
badguy action ["eject",car]; unassignvehicle badguy
But, badguy does nothing, and stays in the car. What am I doing wrong here? ???
Any tips?
-
Don't use reserved words (or words you suspect might be reserved) like "car". Call it "car1" or something, to avoid the risk of confusing the game.
Although I don't know why it doesn't work. It may be because a ground vehicle is in the air. Try and get it to work with a chopper, and a car on the ground.
If all else fails, deleteVehicle the loon and createUnit a doppelganger in the air just outside the car.
-
Thanks for the reply ;)
I changed the name of the car to car1
As for the code, it works on flying choppers and cars on the ground. It must just be because the car is in the air that it does not work :(
I'll try to find a good tutorial for createunit so I can try your other suggestion. ;)
-
OK, heres what I have now. ;)
When the car goes near the edge of the cliff, a action comes up on the action menu, 'kick seat'. The trigger that activates it is set on 'once', not 'repeatedly', yet the action stays there after it is complete. Here is the script:
car1 setvelocity [-22,25,2]
object 4422 setdamage 1
guy setdamage 1
ap setcaptive false
titlecut ["{Driver} AARRGGGGHHHHH!!!!!","plain down",2]
ap RemoveAction ame1
Exit
Heres the activating trigger:
ame1=car1 AddAction ["Kick seat","Script.sqs"];
And heres the de-activating trigger:
"SoldierE" createunit [getpos badguy,group(badguy)]; badguy setdamage 1; ap RemoveAction ame1
ap being the player, and ame1 being the action variable.
But the action menu thing stay after the triggers are activated ???
I will replace badguy setdamage 1 with deletevehicle when I learn the correct syntax ;)
Anyone know how to fix this?
-
You are adding the action to the car, but removing it from the player. Hence it is not being removed.
-
going back to ejecting the guy:
you could try telling him to eject right before falling off the cliff, and it (and him) should be falling before he gets out
sorry for adding that bit of disorder, but i thought it was a good idea
-
@Macguba:
Ah, thats where I was going wrong ;) I'll change that ASAP.
@triggerhappy:
Thats what I was trying at first, but he would just be there at the top of the cliff dead, and I really wanted him halfway down or at the bottom :P . I would have thought the momentum would have pushed him down, but it didn't :-\
Although that will have to do if nothing else works ;)
-
Success! :D
The action disappears after its used, and I found out how to get the guy to eject in mid air (without a parachute 8) )
In my trigger I had this
Activation: East present
Condition: this
On activation: bad action ["eject", "car1"]
But when I changed it to activation: anyone, it worked ;D
Now he bails out, and falls aimlessly to the bottom of the cliff. Perfect. :)
Thanks for all the help ;)