OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Triggerhappy on 15 Dec 2004, 03:35:39

Title: addaction ids
Post by: Triggerhappy on 15 Dec 2004, 03:35:39
if you are using a script to give multiple vehicles an action could you do something like:
placebomb = vehicle addaction ["place bomb","bomb.sqs"]

or would placebomb only reference one of the vehicles action. i think i already know the answer, and its not the one i want, so, can anyone give me a quick answer?
Title: Re:addaction ids
Post by: General Barron on 15 Dec 2004, 07:15:29
Let me get this straight... you want to use the same line of code:

placebomb = vehicle addaction ["place bomb","bomb.sqs"]

On a bunch of different vehicles? Like this?

placebomb = vehicle1 addaction ["place bomb","bomb.sqs"]
placebomb = vehicle2 addaction ["place bomb","bomb.sqs"]
placebomb = vehicle3 addaction ["place bomb","bomb.sqs"]

And you want to know if placebomb will have the right action ID for all the vehicles? Is that right?

Well, obviously placebomb only contains the action ID of the very last action added, since you overwrite the variable each time except the last. So the answer is, not always. It will only be the same if all the vehicles already had the same number of actions added before you added this action to them.

Is that what you were after? I'm not really sure I understand...
Title: Re:addaction ids
Post by: Triggerhappy on 15 Dec 2004, 14:48:21
alright, that means it should work, i'm using foreach to give a bunch of vehicle a few actions, right at the beginning (execing with a trigger to get the list, which will be instant since it covers stuff that will activate it)

thanks
Title: Re:addaction ids
Post by: Tyger on 16 Dec 2004, 03:04:28
watch out. If you remove the action then the action id becomes null, and you cannot reassign it.

I had this problem with one of my scripts, and learned it the hard way.  :'(
Title: Re:addaction ids
Post by: Triggerhappy on 16 Dec 2004, 03:40:25
that won't be a problem, thanks for your concern tho  ;)
Title: Re:addaction ids
Post by: OFPfreak on 16 Dec 2004, 04:52:49
theres a mission in the addons depot in the misc section and it has an exellent way of 1 vehicle getting destroyed.. Yes I know you need multiple vehicles but it may be helpful..  ;)
Title: Re:addaction ids
Post by: Triggerhappy on 16 Dec 2004, 05:07:42
that, to tell you the truth, has nothing to do with what i am asking, or what i am trying to accomplish (if it works you'll see what it is in the script beta test board). thanks though