Jump to content
Sign in to follow this  
ManDay

Trigger Reaction Time - Is it alway arround .5 ?

Recommended Posts

Hi. I just was playing arround with dialogs and created a script which spawn enemies so there always will be a certain amount of enemies in the area. I am german thus I am a perfectionist - I always try to optimize my scripts to the extremest. Here I wanted to create the whole script with only one trigger - well I came to the following:

Quote[/b] ]Man (West,Player)

Init: cnt_east = createCenter east; grp_east = createGroup east; int_reqEnemies = 0; bool_switchstate = true;

Trigger - tr_zone

Activation: by East ... present

Radius: 50

Condition: count thislist < int_reqEnemies && bool_switchstate

onActivation: scr_run = 0 execVM "spawn.sqf";

File - spawn.sqf

Data: bool_switchstate = false;

grp_east createUnit[ "SoldierEB",position tr_zone,[],50,"FORM" ];

sleep 0.5;

hint format[ "Units: %1 | Required: %2",count list tr_zone,int_reqEnemies ];

bool_switchstate = true;

It's simple: The dialog will set int_reqEnemies to a number greater than 0 which will call up the trigger because there are "not enough" enemies in it.

The trigger will spawn exactly one enemy by call - using the script. Because trigger only react on state-changes (i.e. it would not react "once more" if one enemy has been spawned tho there still arent enough) there is a further variable called bool_switchstate which will cause the partial contion to switch each time from true to false and back so the trigger is "checking its state" again.

Now you notice the sleep instruction: at least for me - if set to a value less than 0.5 - it will cause the whole procedure to fail because the trigger doesnt recognize the statechange which occurs. You can notice that by checking the "hint" where the numer of units within the area of the trigger is not the right one.

Where does that delay come from? Is it alway arround 0.5 or does it depend on the CPU-Speed?

Another question: Does anyone know why the "FORM"-Parameter doesnt spawn the units in formation - and why are they not shooting at me?

=> This seems to be a bug. Can someone report it in the bugtracker because I dont know how to register there?

A new side spawned with createCenter will not regard the other side as enemy. I.E. Eastern soldiers will not fire on western soldiers etc.

So either you fix that or you introduce a function which will set hostileness in regards to other sides.

Share this post


Link to post
Share on other sites

About the trigger:

http://community.bistudio.com/wiki/trigger

Quote[/b] ]Condition

In addition to the 'Activation' options above, this field allows you to specify other conditions that have to be fulfilled before the Trigger activates. By default only the boolean variable this is present in this field. It is set to the result of the main 'Activation' condition (e.g. 'east'/'present' ). The expression in this field must return a boolean value (e.g. "this && alive player"). Trigger conditions are tested every 0.5 seconds.

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  

×