Home   Help Search Login Register  

Author Topic: remove action  (Read 541 times)

0 Members and 1 Guest are viewing this topic.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
remove action
« on: 30 Jan 2005, 13:49:19 »
i'm a wee bit stuck.

scenario - i have a first-aid kit script. i want it to be called from the action menu of the player, so in the init.sqs file i've added the action. fine. it works.

i have other loons joining the player throughout the mission, and curiously the first-aid kit is displayed in their respective actions lists too. when activating it however, the first-aid kit script would heal only the player.

i've sorted that; seems the action has to be added individually to each loon who will join the player that you want to have the first-aid kit. fine. that works.

now, the problem. what about the loons who will join the player who i don't want to have the first-aid kit? i've tried

Code: [Select]
this removeaction 0
but that's not doing it, it still appears in their actions list. any ideas?

thanks meantime,
b

Silencer

  • Guest
Re:remove action
« Reply #1 on: 30 Jan 2005, 13:57:15 »
if you have:

Heal11 = Player addAction ["Heal me!","Heal.sqs"]

to remove that action you must have:

Player RemoveAction Heal11

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:remove action
« Reply #2 on: 30 Jan 2005, 14:47:41 »
Or as the addAction passes three variables ([what the action is attached to,who is using the action,action ID]) in the script the action will execute you can use something like this in the "heal.sqs":

_unit = _this select 1
_actID = _this select 2

_unit removeAction _actID...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:remove action
« Reply #3 on: 30 Jan 2005, 15:47:31 »
hmm right... well i've tried variations on the above with little success. the action is still being displayed in my loons' action menus, even if i explicitly take them out.

for reference, here's what i'm doing:

in the init.sqs file -

Code: [Select]
meds = me addAction ["Medi-Pac", "medi.sqs"]
meds_civvy1 = civvy1 addAction ["Medi-Pac", "medi.sqs"]
meds_civvy2 = civvy2 addAction ["Medi-Pac", "medi.sqs"]
meds_civvy3 = civvy3 addAction ["Medi-Pac", "medi.sqs"]
meds_police1 = police1 addAction ["Medi-Pac", "medi.sqs"]
meds_police2 = police2 addAction ["Medi-Pac", "medi.sqs"]

and in the cutscene where the civvies join the player, i have

Code: [Select]
[civvy1,civvy2,civvy3] join me
civvy1 RemoveAction meds_civvy1
civvy2 RemoveAction meds_civvy2
civvy3 RemoveAction meds_civvy3

and yet the civvies still have the medi-pac appearing on the list of actions.


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:remove action
« Reply #4 on: 30 Jan 2005, 16:49:59 »
Actions have a radius of effect.      If an object has an action attached to it the action will appear in the Action menu of any unit close to it.      This is of great benefit in certain circumstances but a bloody nuisance in others.     Check that that is not what is happening here.
Plenty of reviewed ArmA missions for you to play

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:remove action
« Reply #5 on: 30 Jan 2005, 18:53:58 »
In addition to what Macguba said, note that in the command menu, AI units will show actions that they are not currently in range to use. For example, to pick up a weapon, you need to be almost on top of the crate/body/etc. But an AI can be standing a ways away from any crate, but still have that action in the command menu. Again, sometimes helpful, sometimes annoying. :(

To keep the AI from activating someone else's action (or another player from doing it in MP), you should put this at the top of your action:

? (_this select 1) != (_this select 0) : exit

I usually have that at the top of my action scripts, in addition to the line HateR_Kint mentioned that will remove the action from the unit:

(_this select 0) removeaction (_this select 2)
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 bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:remove action
« Reply #6 on: 31 Jan 2005, 13:24:06 »
mmmwell i haven't managed to get rid of the problem, but i've at least managed to make it a bit more realistic seeming - those without first-aid kits assigned have to move to the player's position in order to be healed, which makes sense if s/he had the kit. those with a kit can heal themselves. i'm content to leave it like that. however....

when a unit is healed, the wee 'out of ammo/injured' unit indicator at the bottom of the screen remains red. is setdamage 0 not enough to make it revert to the default grey?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:remove action
« Reply #7 on: 31 Jan 2005, 16:43:45 »
Quote
when a unit is healed, the wee 'out of ammo/injured' unit indicator at the bottom of the screen remains red. is setdamage 0 not enough to make it revert to the default grey?
This is some OFP bug...
I think sometimes even healing at a medic does not change that indicator back to grey, especially the player's indicator...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

UNN

  • Guest
Re:remove action
« Reply #8 on: 31 Jan 2005, 17:23:26 »
Quote
This is some OFP bug

Yep, sometimes even respawning in MP does not fix it either.