Forum Jump :

Author Message


Posts: 55
Rank:


Level: Member

Country: de
Location: Hamburg
Occupation:
Age: 20
In-game name: Nerodenecro

 
#1 Posted at 2015-10-24 11:25        
     
Hey guys,

so I am working on a mission with multiple tasks.
I hate the Task Modules and I am too dumb for SQF file stuff for tasks.

So...

I googled a bit and found this: This code works fine
["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; ["Task2", "ASSIGNED"] call BIS_fnc_taskSetState;

My Trigger condition is: (!alive Patrol1) && (!alive Patrol2)

I tried to get sleep into this, cause sometimes the "Assigned" pop up, pops up earlier than the "suceeded".
What I tried: None of these work
["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; sleep 2; ["Task2", "ASSIGNED"] call BIS_fnc_taskSetState;
["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; {sleep 2;["Task2", "ASSIGNED"] call BIS_fnc_taskSetState}; ["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; {sleep 2;["Task2", "ASSIGNED"] call BIS_fnc_taskSetState;}

I always get the message:

On Activation: Type code, expected nothing

Could anyone help me with this?

Regards,

Nerodenecro


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#2 Posted at 2015-10-24 17:40        
     
the "Assigned" pop up, pops up earlier than the "suceeded"
That's Arma engine.
On Activation: Type code, expected nothing
In a trigger, always wrap scheduled (parallel) code (here sleep command needs to be run a parallel):
0= [] spawn {
["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; sleep 2; ["Task2", "ASSIGNED"] call BIS_fnc_taskSetState;
};
Error will disappear.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 55
Rank:


Level: Member

Country: de
Location: Hamburg
Occupation:
Age: 20
In-game name: Nerodenecro

 
#3 Posted at 2015-10-25 10:43        
     
Hey Pierre,

thanks for the quick answer. Always good to have some active people which answer almost all my posts.
Seems to work, thanks!

Regards,

Nerodenecro


Author Message


Posts: 154
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age: 48
In-game name: Tay-uk

 
#4 Posted at 2015-10-25 17:04        
     
To have a delay between the succeeded and the new assigned, just use 2 triggers with the same on activation condition, one for the succeeded, then one for the new assigned, with say a 5 second delay.

I am lead to believe the sleep command does nothing in a trigger, as all trigger commands happen at same time and not in an order as such.


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#5 Posted at 2015-10-25 17:13        
     
# Tay-uk : I am lead to believe the sleep command does nothing in a trigger, as all trigger commands happen at same time and not in an order as such.

Do u even read m8?

# Pierre MGI :
...
In a trigger, always wrap scheduled (parallel) code (here sleep command needs to be run a parallel):
0= [] spawn {
["Task1", "SUCCEEDED"] call BIS_fnc_taskSetState; sleep 2; ["Task2", "ASSIGNED"] call BIS_fnc_taskSetState;
};
...

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#6 Posted at 2015-10-26 05:06        
     
Yes! triggers have plenty of interests! Even if you're not an expert for scripting sqf, you can easily adds trigger via editor for many reasons, but the 2 main advantages (on my opinion) are:
- trigger is already a loop, scanning for conditions every 0.5 seconds. Not to be confused with repeatability of the action!
- trigger has an embedded area, selecting units, often useful to avoid heavier scripts. Just choose carefully with units have to trigger.

Then, there is no reason to put all code you want in on activation (or deact). Just be conscious you're calling a code. So, if this code is scheduled (most of them have sleep or waituntil commands), you have to spawn it (run in parallel) to let the main script continue while your trigger action runs. So, you can execVM any sqf (because execVM means spawn) or wrap as I said your rough code in 0 = [params if any] spawn {the code here}.
For sure if trigger is used to setObjectTextureGlobal (example) and that's all, you can write this directly (calling the commands instead of spawning).
But if you want to do something more long, as a patrol script loitering in houses, you have to execVM an sqf or spawn the code.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS