Jump to content
Sign in to follow this  
spitfire007

Trying to add action menu when backpack picked up.

Recommended Posts

I am very stuck with how to add this code to a player.

I got this from another post.

What I am trying to do is have and action menu added to which ever player picks up and wears the backpack.

If the pack is placed on the ground it should do nothing.

this addAction ["Request Support","support.sqf", [], 6, true, true, "", """US_UAV_Pack_EP1"" in weapons _this"];

To me ... it look like it SHOULD work but I don't really understand what is going on.

Should it work ? Will it work ? Why does it not work for me :confused: ?

Share this post


Link to post
Share on other sites

This is driving me a little crazy.

I am just starting out scripting and the syntax is quite daunting for a mere noob.

Looking yet again at the script editing tutorial I see that the ; should not be in a units init.

Ok..... remove the ;

this addAction ["Request Support","support.sqf", [], 6, true, true, "", """US_UAV_Pack_EP1"" in weapons _this"]

No action menu when I pick up the UAV Backpack.

Scratch head ... must be syntax.

Try this as there looks to be one to many " around the condition.

this addAction ["Request Support","support.sqf", [], 6, true, true, "", ""US_UAV_Pack_EP1" in weapons _this"]

Nope ... that says I am missing a ]

try removing some more " as there look to be too many around the condition to me.

this addAction ["Request Support","support.sqf", [], 6, true, true, "", "US_UAV_Pack_EP1" in weapons _this]

Nope again.

Local variable in global space
error.

"insert tears here"

Looking at the wiki though it says

condition (optional): String - script code that must return true for the action to be shown. Special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit). Default value: "true"

Just how should I use this condition ?

Any help much appreciated.

Here is the mission file if anyone would like to see what I am doing.

https://www.dropbox.com/s/9ygof7b1she05oz/mission.sqm

Edited by spitfire007
added misson file link

Share this post


Link to post
Share on other sites

I have downloaded Squint to help with the syntax.

It seems that

this addAction ["Request Support","support.sqf", [], 6, true, true, "", """US_UAV_Pack_EP1"" in weapons _this"]

Is the correct syntax.

So why does it not work ?

Edited by spitfire007

Share this post


Link to post
Share on other sites

I have now tried this in an init.sqf

with only these 2 lines in it.

It gives the backpack but will STILL not give me an action menu ?

player addBackpack "US_UAV_Pack_EP1";
player addAction ["Call Support","support.sqf", [], 6, true, true, "", {typeOf (unitBackPack _this) == "US_UAV_Pack_EP1"}  ];

Any help at all would be great !.....

This is kind of a critical function I need for my first mission ever :-)

Share this post


Link to post
Share on other sites
player addBackpack "US_UAV_Pack_EP1";  
player addAction ["Call Support","support.sqf",[],6,true,true,"","(typeOf  unitBackPack _this) == 'US_UAV_Pack_EP1'"];

Share this post


Link to post
Share on other sites

You LEGEND !!

I can't believe that it was something so obscure. This syntax is going to make me go blind.

Thank you sooo much.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×