Jump to content
Sign in to follow this  
total

NEEDHELP: Create FOB with radio

Recommended Posts

What must I do to have a constant Squad leader ONLY-Trigger, 50 meters around a movable Cargobox, with addAction ["Create FOB", "fobscript.sqf"] ?

OLD:

I want the Squad leader to have the ability to create a FOB spawn point by pressing "Place FOB" with the radio - one time only.

One requirement: A specific object must be 0-50 feet away to build FOB. Is this object within reach and Squad Leader press "Place FOB" so there will be built a building and a Virtual ammo box right next to it + an invisible marker.

Isn't the object within range = Hint message and no FOB.

Does anyone have a suggestion on how I can do this?

Edited by Total

Share this post


Link to post
Share on other sites

Should be pretty simple, create a radio trigger with "Place FOB" in the Text field and set it to only be used once. Then in the On Act pace a call to your script that would create the FOB (i.e. nul = [] execVM "fob_creator.sqf"; ). Then within the script have a check for if they are the squad leader, which you could do bu classname or the variable name of the unit, if they aren't have a hint that says this is for squad leaders only, but if they are move onto the next part of the script. Next part would be to check if they are less than 50m away from your special object, if not waituntil they are then check again, if they are within range move on. Then you get into the creation of the objects and such with createVehicle and other such scripting commands for objects and markers to get what you want.

Share this post


Link to post
Share on other sites

What must I do to have a constant Squad leader ONLY-Trigger, 50 meters around a movable Cargobox, with addAction ["Create FOB", "fobscript.sqf"] ?

Edited by Total

Share this post


Link to post
Share on other sites

You can use the condition parameter of addAction to implement that.

init.sqf:

if isServer then { FOB_created = FALSE; publicVariable "FOB_created" }; // on server and public to prevent JIP issues
player addAction ["Create FOB", "fobscript.sqf", [], 1, TRUE, TRUE, "",
	"_this == _target && _this distance [b]cargobox_object[/b] < 50 && leader group _this == _this && !FOB_created"];

Then somewhere in fobscript.sqf put FOB_created = TRUE; publicVariable "FOB_created";

Don't know if it's for MP, just in case I put the public variables and the check for updating the leader. A trigger isn't necessary unless I missed something.

Edit: Explanation for the command in case someone is wondering:

player addAction ["Create FOB", "fobscript.sqf", [], 1, TRUE, TRUE, "",

Stuff you have to give before getting to the condition. In order: Action name, script or code, extra arguments passed to the script, priority in the action menu, show text in the middle of the screen if active, close menu on use, shortcut key.

_this == _target

The condition field has two special variables available, _this referring to the person using the action and _target referring to the target. In this case the action is attached to the player itself, so this is kind of redundant, mainly for issues with switchable units in SP.

_this distance cargobox_object < 50

Check that the activator is less than 50 meters from the vehicle named cargobox_object.

leader group _this == _this

Check that the activator is the leader of his group. Or is it leader group _this == leader _this?

!FOB_created

Check that variable FOB_created is FALSE.

Edited by Magirot

Share this post


Link to post
Share on other sites

Thank you! - Again!

Will test this as soon I get home from work! ;)

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  

×