Home   Help Search Login Register  

Author Topic: AddAction bug with vehicles  (Read 1258 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
AddAction bug with vehicles
« on: 17 May 2005, 00:23:25 »
Recipe:

Take multiple empty vehicles and AddAction to each of them:
i.e. in Init field for each put this AddAction ["piss","piss.sqs"]

Place the vehicles very close to each other.
Now add one player unit.  Preview the mission.  When you approach any one of the vehicles you will see multiple pisses in the action menu.
Now mount one of the vehicles and drive away from the other vehicles. You will still see multiple pisses. Now dismount and remount vehicle.  Now there is only a single piss.

This is pissing me off.  Any suggestions other than place the vehicles far apart from each other?   I have several vehicles to be stolen from a confined area.  This bug is buggering me up! ???

See demo attached below...

 
« Last Edit: 17 May 2005, 13:42:32 by Mr.Peanut »
urp!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:AddAction bug with vehicles
« Reply #1 on: 17 May 2005, 09:02:47 »
How about using a getIn EH to add the action to the vehicle, and removing the action when you get out.  That way there will be no more than one action active at a time.  But you will need to be in the vehicle.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:AddAction bug with vehicles
« Reply #2 on: 17 May 2005, 13:41:08 »
Here is the problem.  I have added two actions to each vehicle, a nitro action and a repair action.  The repair action can only be used when dismounted.  I will just spread the vehicles out a bit more, which is a drag since the action menu seems to pop up about 10m away from a vehicle.  Now I need a pen 120m long to hold them all.  That won't look very pretty.

I wanted to know if anyone else had encountered this bug or found a work  around.
« Last Edit: 17 May 2005, 13:41:35 by Mr.Peanut »
urp!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:AddAction bug with vehicles
« Reply #3 on: 17 May 2005, 14:58:37 »
I did have that problem and the above was my work around - only allowing the action to be available when the player is inthe vehicle.  

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:AddAction bug with vehicles
« Reply #4 on: 17 May 2005, 15:29:51 »
my suggestion - which seems a tedious workaround - is to have separate actions for each vehicle, all pointing to the same script copy/pasted. which, thinking about it, wouldn't stop the actions popping up in the player's menu.

an even more lengthy workaround would be to have a script running in the background when the player enters the pen, tracking said player's progress and continuously monitoring his/her distance from the given vehicles. when s/he is close enough to one, add the action, further away, remove the action.

it does seem very pissy doesn't it. the third alternative is to go with THobson's suggestion, and alter your logic accordingly to fit with the game limitations - i.e. repair is called from inside the vehicle, but also triggers a 'get out' animation.... also makes some limited sense, as you're going to know when the vehicle needs repairing only on getting into it.

unless it has wheels missing, or is on fire...

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:AddAction bug with vehicles
« Reply #5 on: 17 May 2005, 17:26:17 »
Urp...

The reason I AddAction'd twice directly on the vehicles was for simplicity.  I guess BIS didn't properly reinitialise the Action list when a player enters a vehicle.  Thanks for the suggestions...   :-X
urp!

Grendel

  • Guest
Re:AddAction bug with vehicles
« Reply #6 on: 17 May 2005, 19:51:09 »
you could try another workaround...

Have a script that runs a loop (initiated by a trigger while in the car pen maybe) checking the distance of the player to each vehicle (in an array) every second or so.  if the distance is less than say, 1.5, then add the action passing the closest vehicle into the script. If the distance is less, run removeaction to get rid of it.  If you want I could probably do one up, did something similar to do a script to climb on a tank.

-Grendel

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:AddAction bug with vehicles
« Reply #7 on: 17 May 2005, 22:45:00 »
With 12 vehicles and 12 players (it is a coop mission) that is a lot of looping...

I will probably try a mix of the above suggestions i.e. have a looping script running for each vehicle and an event handler.

Thanks for the help.
« Last Edit: 17 May 2005, 22:45:30 by Mr.Peanut »
urp!

Offline KTottE

  • Former Staff
  • ****
Re:AddAction bug with vehicles
« Reply #8 on: 18 May 2005, 11:01:39 »
I had a similar problem once. What I ended up doing was I placed a trigger over each vehicle.

It would fire when a player was inside of it, and add an action to the appropriate vehicle. When the player left the area, the action was removed from the vehicle.

Then I used a simple script to setpos each trigger to the position of the appropriate vehicle. I did all the setpos'ing inside of a single script, so I didn't have tons of looping scripts.

It worked out quite well actually.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:AddAction bug with vehicles
« Reply #9 on: 29 May 2005, 21:01:17 »
I've heard of this bug before. Apparently OFP doesn't remove actions properly when you enter a vehicle, then drive away. So you aren't alone.

Good ideas about adding the action via an EH though. Perhaps you could do the same thing with the 'repair' action: that is, add it to the vehicle when the player gets out ("getout" EH). Or possibly add it when the vehicle gets damaged ("dammaged" EH).

Of course... the problem would still occur if the player has 2 vehicles that he keeps near each other, but the chances of this happening are slim.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:AddAction bug with vehicles
« Reply #10 on: 30 May 2005, 17:25:35 »
It's a real bug in OFP. The game doesn't isn't able to remove the actions from you when you arent you but have become the vehicle. When boarding a vehicle you become that vehicle and it's actions are not removed.
You could try scripting it to check if unit != vehicle unit or something like that and remove the actions. If everything fails you at least can do a check in the begining of your actionscript about who it was that launched the action and if it's not the guy who should have had the action, then it's not performed.

Kind of confusing when you write it out loud, isn't it  ;D
Not all is lost.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:AddAction bug with vehicles
« Reply #11 on: 07 Jun 2005, 15:20:37 »
In the end, I simply used an event handler to add and remove the actions from the vehicle when the player got in and out of the driver's seat.  Since a player becomes the  vehicle, the addAction id's can be stored as global variables on the player's machine, making it all multiplayer friendly and allowing for multiple vehicles, each with its own event handler.  The repair script can only be called from inside the vehicle, but that is the necessary sacrifice to get it all to work with a minimum of fuss and processing.

Addendum:
To get this to work properly in MP, the actions should only be added when the driver of the vehicle is local.
« Last Edit: 26 Jul 2005, 18:56:55 by Mr.Peanut »
urp!