OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: macguba on 07 Feb 2004, 14:19:08

Title: Phantom addaction
Post by: macguba on 07 Feb 2004, 14:19:08
I have this line of code in my init.sqs.    sn1 is the player unit and leader of a squad.

morphineAction = sn1 addAction ["Use morphine", "morphine.sqs"]

I'm pleased to say the whole thing works perfectly.    

However, it seems that the action is also being added to the group members:   when you hit say F5 - 6, at the top of the list of "take m16 mag" etc. there is "Use morphine".      Why is it there?   How can I get rid of it?  
Title: Re:Phantom addaction
Post by: Planck on 07 Feb 2004, 14:24:20
Not an expert, but, if you add an action to a group leader doesn't it add it for the whole group also?

As you want to add it to the player, maybe you could try:

morphineAction = player addAction ["Use morphine", "morphine.sqs"]

Just a guess though.


Planck
Title: Re:Phantom addaction
Post by: deaddog on 07 Feb 2004, 14:25:10
I've noticed that kind of thing, as well.  Send them away (or "stop" them and move somewhere else) and see if the action is still there.  I'm thinking that it has to do with the fact that actions have a "distance" associated with them.

I don't know if it is possible to get rid of that.
Title: Re:Phantom addaction
Post by: gundernak on 07 Feb 2004, 14:28:04
If you add an action to a unit or vehicle or object, the action can be seen by anyone who is in a certain range to the unit having the action.

I guess if you add the action to your unit, and other units can see only its action when they are close...

And of course if they use athe action it will not be applied to them, but to the unit who is haveing the action in deed.

If you add an action to your player, the action is always available, because you are always close to yourself... ;)

This is my experience, though I have not read abouti anything.

I hope it is clear, and if I am wrong, please anyone correct me.
Title: Re:Phantom addaction
Post by: gundernak on 07 Feb 2004, 14:31:41
Anyway does anybody know or is it possible to detect exactly who performed the action.

It will be nice if we could pass units or arrays to the script executed by the action...

Title: Re:Phantom addaction
Post by: Planck on 07 Feb 2004, 14:32:39
Ahhhhh.........the clouds have receded and everything has become clear.....thanks gundernak.

Actually I lie............it is snowing.   ::)


Planck
Title: Re:Phantom addaction
Post by: Chris Death on 07 Feb 2004, 15:32:37
Yep, Gundernak is right here.

To answer Gundernaks question:

The script, which gets executed by the custom action
will receive a few parameters automatically.

_this select 0
and
_this select 1

are the two parameters, where you can indicate who
has executed the command and to which object the action
is assigned to.

I can't remember which one stands for what, but it shouldn't
be hard to figure that out  ;)

Soz, but i can't try it out at the mo

~S~ CD
Title: Re:Phantom addaction
Post by: Welshmanizer on 08 Feb 2004, 03:18:20
I did a bit of messing around with this before.

When an AddAction is used, there are 4 things passed to the script:


_this select 0 is the object which has the action

_this select 1 is the object 'using' the action

_this select 2 is the number '0'

_this select 3 is a null value


If you try more (_this select 4 for example) you start getting Zero division errors.

I tried to figure out what the Zero and Null values represented, but I couldn't find anything. I tried all the settings for the object and the ones for the unit 'using' the action, including health, rank, init, skill, name, all of them. Also I tried speed, altitude, rating, units killed but non of these affect the Zero and Null values.
Also I tried using members of my team to use the action but this didn't tell me anything about these 2 values.


Title: Re:Phantom addaction
Post by: Chris Death on 08 Feb 2004, 06:59:43
Welshmanizer,

_this select 2 represents the action-id

If you want to remove the action straight by the script which
was executed, you would use _this select 2 then.

If you would have tried two actions, it would have shown
you more than only a '0'  ;)
Same goes for adding and removing and readding an action.
_this select 2 increases from action to action.

~S~ CD
Title: Re:Phantom addaction
Post by: Welshmanizer on 08 Feb 2004, 12:22:31
Nice one. I forgot about the action ID. 8)

Anyone know if _this select 3 is used by anything?
Title: Re:Phantom addaction
Post by: Tomb on 08 Feb 2004, 15:00:19
potatoes are best served with brown sauce made upon a roasted hen.
Once  the pan is at some 156 dgr's you should down the temp. to some 110.

Now, this is where you add the carrots.  :)




( ::) )


Title: Re:Phantom addaction
Post by: Welshmanizer on 08 Feb 2004, 15:02:16
ya could use in in vehicles...


this select 0 == a tank
this select 1 == the Commander
this select 2 == the gunner
this select 3 == the driver

eh?
Title: Re:Phantom addaction
Post by: macguba on 09 Feb 2004, 16:11:35
Thanks chaps.   I'll just change it to a radio call rather than an action.    My intention is just to provide a "get out of jail free" card if the player can't walk.    The mission is set on The Hill on Kolgujev and you know how easy it is to pick up damage on those steep slopes.

Tomb m8, I have no idea what you're talking about.   ;D
Title: Re:Phantom addaction
Post by: Tomb on 09 Feb 2004, 16:29:40


neither do I  :) :moon: