Jump to content
Sign in to follow this  
mthcom

right down menu items

Recommended Posts

i'm making a mission in multiplayer and i want to see make a motorcycle for myself. i do this by making a radio trigger. a big problem with this is that anyone could do this in mission.

In some mission i have seen that there are some new items in the yellow menu in right corner. can i make a new entry for them and add my own code to it?

thanks for your interest:D

Share this post


Link to post
Share on other sites

There are a couple of options here for multiplayer. Radio triggers are less obtrusive than action menu items since they don't interfere with gameplay. There's nothing more frustrating than having to scroll past a dozen menu items to select your LAW launcher in the heat of battle. So there are two options here:

If I want to make a given radio trigger "local" i.e. only visible for one player in a mission I would add the radio trigger to the mission (in the below example I use Radio Alpha) as normal but add the following code in init.sqs:

1 setradiomsg "NULL"
?(S1 == player): 1 setradiomsg "Alpha"

So in the above code, initially the radio message is disabled for all players. It is then re-enabled only for the player controlling the unit named S1.

If I want to add an action to an object (even the player) I would use addaction as in the following code:

myAction = S1 addaction["AC-130","killstreaks\r_ac130.sqs"]

In this case an action is being added to the unit S1, it will appear in the action menu as "AC-130" and will call the script killstreaks\r_ac130.sqs. If this is the player unit then the action will appear in their action menu. If it is applied to an object other than the player, it will be appear in the player's action menu only when they are near the object (about 15m). Note that actions added with the "addaction" command always appear at the top of the action menu, above the in-engine commands like reload etc. This means it quickly becomes cumbersome for a player if there are too many actions in their menu.

You can remove the action at a later time by calling removeaction and passing the number of the action to be removed so if I wanted to remove the action from the above code I would call:

S1 removeaction myAction

There are also issues with addaction to do with locality. As far as I remember addaction is only local in effect, so it only effects the computers on which the script is being run. The same goes for setradiomsg I think (although this isn't a problem in the above example because all machines will run init.sqs on mission start).

Another problem with addaction is that if you attach an action to the player unit, that action is linked to that specific unit. If the player is killed and respawns, the action would remain linked to the player's dead body. So you would have to trap that event and move the action to the player's new body. Isn't multiplayer scripting fun?!

Edited by *Zeewolf*

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  

×