Home   Help Search Login Register  

Author Topic: getting David Berka's cargo drop script to work in multiplayer...  (Read 1985 times)

0 Members and 1 Guest are viewing this topic.

Offline filth

  • Members
  • *
  • Who's the bad man?
can anyone help me try to get this working in multiplayer? i need it to work as an ammodrop from a chopper and so far, the other players can see the chute deploy, but the ammo crate disappears apparently. any ideas on a workaround plz? ta.
« Last Edit: 12 Aug 2007, 17:34:54 by filth_merchant 101 »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Lo again you dirty boy!

Heheh. You have encountered one of the many thrills of MP editing.

In OFP objects of the STATIC(i.e.non-vehicle) class, such as ammo boxes, do not broadcast their position across the network.  A parachute, however, is a a vehicle, so its position will be synched across the network.

To solve this problem you must make sure the drop script is run on every machine on the network. To do this I need to be reminded how you are calling the script. Are you using a trigger or an action?

In either case what you want to do is use the trigger or action to broadcast a variable, and then use another trigger that uses that variable to start the drop script.

Assuming a radio trigger. In the trigger OnActivation:
Code: [Select]
startDropScript = TRUE; publicVariable "startDropScript"
Now add another trigger (none,once) with Condition:
Code: [Select]
startDropScriptIn the On Activation put the call to the drop script.

Some people think that initialising the variable also helps. I do this myself, mostly out of paranoia. If you want to do it too then add the following line to your init.sqs
Code: [Select]
startDropScript = FALSE
« Last Edit: 24 Jul 2007, 16:32:01 by Mr.Peanut »
urp!

Offline filth

  • Members
  • *
  • Who's the bad man?
lo nutster.  :cool2: another lesson learnt. brilliant.  :good: thx for the explanation. i'm calling the script via an action added to the chopper. so should the action start the following chain reaction? :

ie. 'Drop ammo crate' action runs a script which simply says:

startDropScript = TRUE
publicVariable "startDropScript"

which fires the trigger:

condition: startDropScript
on activation: [] exec "ammodrop.sqs"
would changing the first trigger to a script work?  :dunno:
cheers buster.  :)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
How you have done it above is correct.  AddAction is a local command; the script it calls only runs on the machine of the player who activates the action, so you need the extra machinery for MP.

You really should try reading again the tutorial I once pointed you to here. It should start to make more sense now.
urp!

Offline filth

  • Members
  • *
  • Who's the bad man?
lo nutmeg.  :cool2: been away hence lateness of reply. thx for the tip. just read the tut. it has all come into focus now. cheers buster.  :good: