OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 09 May 2009, 15:26:42

Title: Quick count list question.
Post by: laggy on 09 May 2009, 15:26:42
Setup:

All editor placed (triggers and units).

Trigger #1 - BLUFOR present, repeatedly, named goodguys.

Trigger #2 - OPFOR present, repeatedly, named badguys.

Trigger#3 - count list goodguys > count list badguys
OnAct: ending = true

Question:

Is there a risk that different players get different counts, causing the mission to end too early on some computers?

Global triggers are coordinated I know, but the reason I ask is the memory of OFP where a trigger "NOT PRESENT" would activate prematurely on clients if the trigger was counting AI (local to the server). You simply had to count on the server. The problem with using "AND isServer" in condition is if the count should include ALL from i.e one side: players + local AI + non local AI.

Worried  :confused:



Title: Re: Quick count list question.
Post by: Spooner on 10 May 2009, 03:42:56
A trigger list incorporates all units regardless of locality, so I don't think that is your issue. There are, however, may reasons why triggers could count differently on different computers or in different situations.

Triggers are only updated, and their conditions checked, every 0.5 seconds. I'm pretty sure that this timing is not exactly in sync on each machine, and that, since objects can be in different places on different machines (the difference caused by desync) it is reasonable to assume that sometimes different machines have different things inside their triggers at the same time. Generally, this isn't a massive problem, but if a trigger causes a critical event (such as ending the mission) it can be best to do this on the server and broadcast the results.

A possible related issue is that a manned vehicle only counts one in your example, so if 3 soldiers get into a humvee, they will only count one. In case there are vehicles in your mission, you need to count the total people in each crew of each vehicle:
Code: (condition counting all the living crew; true if goodguys outnumber badguys) [Select]
total = 0; { total = total + { alive _x } count (crew _x) } forEach goodguys; { total = total - { alive _x } count (crew _x) } forEach badguys; total > 0
Title: Re: Quick count list question.
Post by: laggy on 10 May 2009, 10:49:53
Quote
A trigger list incorporates all units regardless of locality
Great to know, never got a really clear answer to this before, thanks a lot.
Quote
if 3 soldiers get into a humvee, they will only count one
That explains many "random" effects back since the OFP days  :P

Much obliged,

Laggy