Jump to content
Sign in to follow this  
Somerville

Use script to select weapon, can't pick up

Recommended Posts

Basically, the player hits an action within a certain distance of the armoury and that weapon is put into the crate. However, I've had players complaining that they can't actually pick the gun up from the crate.

Does anyone have any idea why this happens?

Share this post


Link to post
Share on other sites

It sounds like a multiplayer locality problem.

When a player uses a custom action, non-global script effects within that script won't have any effect on the other players. When it comes to addWeaponCargo, you can see the ELocal icon on the page.

Depending on what you are trying to do there are different ways of solving this. If the weapons added are the same every time, set a publicVariable (fx fillAmmoCrateNow) and put that variable as a condition in a trigger (which adds the ammo and weapons).

If your mission is more dynamic, setting the variable to different values and a second script may work for you.

Share this post


Link to post
Share on other sites

Basically, the unit steps near a flag, and it says "Take AK", "Take M16" sort of thing. When they do this, the script says:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">crate 1 addWeaponCargo ["M16A2"]; crate 1 addmagazineCargo ["Ammo!"];

Anyways. The magazines and gun appear in the crate, but the players are saying they can't actually pick them up. So they are there, just.. er.. not?

Share this post


Link to post
Share on other sites

Well, I haven't tried adding stuff to crates during the mission. But as the command is listed as local in the wiki, using it without executing the code on all clients won't give global effects...

So try something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">SOMER_AddWeapon = "M16";

publicVariable "SOMER_AddWeapon";

Then in trigger or script running on all clients run the addWeaponCargo and addMagazineCargo according to that variable.

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  

×