Author Topic: addaction and vehicles  (Read 703 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
addaction and vehicles
« on: 20 Mar 2004, 20:59:19 »
Hi, could someone please enlighten me as to why my added action (SmokeMe = player addaction["SMOKE!!!","test.sqs"])
dissapears when I enter a vehicle?

I'm working on my own vehicle mounted smokescreen and I want the command "SMOKE!!!" to show up in the actionlist when inside any vehicle, and dissapear when you exit the vehicle.

Seems like it does the exact opposite now  :'(

//Zith - Scripting aprentice

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:addaction and vehicles
« Reply #1 on: 20 Mar 2004, 22:19:25 »
umm.. Isn't it supposed to do that? I mean, when you board a vehicle, all the normal actions like 'put weapon on back' and 'weapon M16' and 'salute' .. disapear as well. I think it has to do with the fact that when a unit boards a vehicle, he seizes to be the unit he was and becomes the vehicle itself. Kind of hard to explain :P but anywho, thus the actions which the unit had don't show.

unit has unit's actions like 'salute'
unit boards a truck
unit becomes truck
unit has unit's actions no more
unit has truck's actions like 'engine on'

Oh, and I forgot to mention, that if you want the unit to be able to have the action in the vehicle too, you might have to detect if the player is inside a vehicle (if the player IS vehicle) and then add the action to the vehicle he's in (to the vehicle he IS). That or if your script is some tank smokescreen script, you can add it to the tank itself.

Forgot to mention one more thing about actions in MP.. it's that the script launched by the action will be executed only on that players machine who activated it.

player1 activates a smoke script
player1 sees smoke
player2 does not see smoke

There's a solution to this, but it's sort of complicated. Can be found by searching this board though.
« Last Edit: 20 Mar 2004, 22:33:02 by Artak »
Not all is lost.


  • Guest
Re:addaction and vehicles
« Reply #2 on: 21 Mar 2004, 04:23:57 »
Like Artak said, when the player enters a vehicle, he sorta becomes that vehicle. So insted of add the action to the player, add the action to what ever vehicle the player is in. Use something like

Code: [Select]
SmokeMe = vehicle player addaction["SMOKE!!!","test.sqs"]

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:addaction and vehicles
« Reply #3 on: 21 Mar 2004, 06:25:01 »
From memory, so the usual warning of "untested" applies...

Say you have a vehicle called "myride". Then do
Code: [Select]
myride addEventHandler ["getin", {SmokeMe = _this select 0 addAction [{SMOKE!!!}, {smoke.sqs}] }]

myride addEventHandler ["getout", {_this select 0 removeAction SmokeMe}]

You can do that in the init line of "myride" like so:
Code: [Select]
myride addEventHandler ["getin", {SmokeMe = _this select 0 addAction [{SMOKE!!!}, {smoke.sqs}] }]; myride addEventHandler ["getout", {_this select 0 removeAction SmokeMe}]Note: this only works for one vehicle in the mission (since SmokeMe will hold the action id for that vehicle and SmokeMe is a global variable).

« Last Edit: 21 Mar 2004, 06:27:07 by Killswitch »