OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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?
-
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
-
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.
-
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.
-
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...
-
Ahhhhh.........the clouds have receded and everything has become clear.....thanks gundernak.
Actually I lie............it is snowing. ::)
Planck
-
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
-
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.
-
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
-
Nice one. I forgot about the action ID. 8)
Anyone know if _this select 3 is used by anything?
-
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. :)
( ::) )
-
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?
-
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
-
neither do I :) :moon: