Home   Help Search Login Register  

Author Topic: Triggers in MP  (Read 1687 times)

0 Members and 1 Guest are viewing this topic.

Chris330

  • Guest
Triggers in MP
« on: 04 Apr 2005, 09:56:58 »
Following on from the other thread here is my question ;)

Quote
I have a script in my MP mission which calls for a helicopter to extract the squad once two enemy squads are either all dead or all fleeing. I have a trigger which calls the extraction script when the variables attached to the squads become true. So my question is...

Do I have to broadcast the true/false variables to the clients machines in the sensor scripts for the trigger to become active on their machines
 ???

Can anyone help. I would be very grateful :)

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:Triggers in MP
« Reply #1 on: 04 Apr 2005, 12:30:14 »
Yes. If a script changes a variable from false to true this change will probably register only on the machine running the script.

This is one way to do it inside a script (assuming your variable is named myVariable):

myVariable=true; publicVariable "myVariable"

This will first change the variable to true on the computer that was running the script (be it server or client) and then broadcast the current setting (=true) to all other computers in the network. The result: myVariable will be set to true om all computers.
« Last Edit: 04 Apr 2005, 12:30:46 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Chris330

  • Guest
Re:Triggers in MP
« Reply #2 on: 04 Apr 2005, 12:58:13 »
 :D You are a very helpful forum member. I must play some of your missions too sometime ;) Thanks for the reply I will update the scripts accordingly. It amazes me that if all the clients machines receive a copy of the scipts then why don't their machines register the variables as true aswell. MP scripting sure is mad :P

Thanks for the reply mate. I'll get my mission tested with a mate this week :D

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:Triggers in MP
« Reply #3 on: 05 Apr 2005, 02:32:26 »
Quote
I have a script in my MP mission which calls for a helicopter to extract the squad once two enemy squads are either all dead or all fleeing. I have a trigger which calls the extraction script when the variables attached to the squads become true. So my question is...

Do I have to broadcast the true/false variables to the clients machines in the sensor scripts for the trigger to become active on their machines
The actual answer to this depends on what "the sensor scripts for the trigger" is and how the trigger is setup. Can you describe that? Copy and paste excerpts from "the sensor scripts" (whatever they are) and tell us how the trigger is setup.

Furthermore, read up on how triggers work by checking my post in this thread: Scripts activated by triggers in MP are not local and make very sure you understand what I say there.

I need you to come to the realisation that the information you've given is insufficcient to answer the question fully. That will be absolutely crucial to your understanding triggers and MP fully.

Remember: trigger conditions are evaluated on all machines but the "On activation" field may or may not run on all those machines, depending on how the condition is setup.
« Last Edit: 05 Apr 2005, 22:08:34 by Killswitch »

Chris330

  • Guest
Re:Triggers in MP
« Reply #4 on: 05 Apr 2005, 14:02:45 »
Thanks for the reply :) I have a script which detects whether or no a squad is fleeing. I can't remember quite how it goes (I will check when I get home tonight) but it's something like this:

Quote

_group = units squad1  //make an array of the squads units
_groupsize = count _group  //count the number of units in the group

#loop
_fleeingcount = "fleeing _x" count _group  //count how many units are fleeing
?_fleeingcount == _groupsize : goto "allfleeing" //  check to see if the entire
//group is fleeing
goto "loop"

#allfleeing
squad1fleeing = true  //if entire group is fleeing then make this variable true
//and exit
exit


Then in the init line of the trigger which calls the extraction script I have the condition set to :

Cond: squad1fleeing

Then in the on activation field :

OnActivation: this exec "extract.sqs"

And that's it :D

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Triggers in MP
« Reply #5 on: 06 Apr 2005, 01:36:23 »
You should let this script run on the server only, and then
broadcast your boolean by publicVariable at the end.

Code: [Select]
#allfleeing
squad1fleeing = true  //if entire group is fleeing then make this variable true
//and exit

publicVariable "squad1fleeing"

exit

Now once squad1fleeing becomes true on the server and
gets broadcasted by publicVariable, the condition will be
true on all clients also --> the trigger will go off everywhere.

But still have a read at Killswitch's trigger thread  ;)

~S~ CD
« Last Edit: 06 Apr 2005, 01:37:11 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted