Jump to content
Sign in to follow this  
Valixx

Got a little script problem..

Recommended Posts

Hey Guys.

This is the task: Clear Agia Marina. If the marker ( named "marker1" ) turns green, the task ( id "tsk1" ) should be set succeeded. After that, the next task ( synced with triggers etc ) is assigned. Everything works but the "task succeed" thing...

This is what i got,

Trigger -> Condition:

if (getMarkerColor "marker1" == "ColorGreen") then { Hint "Successfully cleared the town, good job soldiers!";};

Trigger -> On Act:

tsk1 setTaskState "Succeeded";

I've tested everything.. even together in the condition box or the on act box.. like so:

if (getMarkerColor "marker1" == "ColorGreen") then { Hint "Successfully cleared the town, good job soldiers!"; tsk1 setTaskState "Succeeded";};

The hint appears, but the task won't update/succeed. There is the starting sound when the task is being updated but it is looping the first second of the sound like, ding ding ding ding :confused:

Does anyone know what the problem might be?

Edited by Valixx

Share this post


Link to post
Share on other sites

If marker1 doesn't start out green you are changing the color of it somehow. However you're doing that can mark your task complete. Don't need a trigger for that. It's kind of like setting up your home alarm motion sensor to alert you when you get up for another beer to remind you to pause your movie when you get up for another beer.

Share this post


Link to post
Share on other sites

marker1 is starting out black..if the player enters marker1 it turns red and the enemy is spawning ( using EOS from BangaBob ). When the enemy is defeated, marker1 is turning green. Then the task should be succeeded ( as written above ).

Heres a little bit of code from the eos_Init.sqf:

if ("Default" == getmarkercolor _currentMKR) then {
   _currentMKR setmarkercolor "colorRed";
           }else{
       _currentMKR setmarkercolor getmarkercolor _currentMKR;
       };
_currentMKR setmarkerAlpha _mkrAlpha;

   _spotFriendlies = createTrigger ["EmptyDetector",_currentPOS]; 
   _spotFriendlies setTriggerArea [(_SafeZone+ _eosMarkerSizeA),(_SafeZone+ _eosMarkerSizeB),0,true]; 
   _spotFriendlies setTriggerActivation ["ANY","PRESENT",true]; 
   _spotFriendlies setTriggerStatements ["{vehicle _x in thisList && isplayer _x} count allUnits > 0","",""];

waitUntil {triggeractivated _spotFriendlies};

// ZONE ACTIVE. CREAT SUB-TRIGGERS
   _currentMKR setmarkercolor getmarkercolor _currentMKR;
   if ("colorGreen"==getmarkercolor _currentMKR) then {_currentMKR setmarkerAlpha _mkrAlpha;} else {
   _currentMKR setmarkerAlpha _mkrAlphaHighlight;};
           _spotEnemies = createTrigger ["EmptyDetector",_currentPOS]; 
           _spotEnemies setTriggerArea [_eosMarkerSizeA,_eosMarkerSizeB,0,true]; 
           _spotEnemies setTriggerActivation [_enemyFaction,"NOT PRESENT",true]; 
           _spotEnemies setTriggerStatements ["this","",""]; 
               _spotTaken = createTrigger ["EmptyDetector",_currentPOS]; 
               _spotTaken setTriggerArea [_eosMarkerSizeA,_eosMarkerSizeB,0,true]; 
               _spotTaken setTriggerActivation ["ANY","PRESENT",true]; 
               _spotTaken setTriggerStatements ["{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0","",""]; 

Share this post


Link to post
Share on other sites

EOS really should either set some variable that tells when something is complete or allow you to feed it a function to run when it's complete.

Your trigger condition should be just this:

getMarkerColor "marker1" == "ColorGreen"

Conditions are basically the "if" part of the if/than structure. Just a simple yes/no question, a boolean. So move the hint part down to the onAct field.

Share this post


Link to post
Share on other sites

if (getMarkerColor "marker1" == "ColorGreen") then { Hint "Successfully cleared the town, good job soldiers!";};

This is working but

tsk1 setTaskState "Succeeded";

isnt. I'll try yours.

Share this post


Link to post
Share on other sites

Task (as needed by task COMMANDS) are not the same as TaskID's as created by the module or using bis_fnc's.

As in your first post you refer to "tsk1" as a taskID im presumming this is created via a module or by the bis_fnc's so you will need to update it by using

["tsk1","succeeded"] call bis_fnc_tasksetstate;

and not via the task commands.

["tsk1",player] call bis_fnc_taskreal

Will return the real TASK of a TaskID

So in essence you could do

(["tsk1",player] call bis_fnc_taskreal) setTaskState "Succeeded";

but thats just overkill, just use the functions provided. Plus you also get your nice task notifications if using the proper functions.

Edited by Larrow

Share this post


Link to post
Share on other sites

Got it working now.

I've set this into the condition box from a trigger:

[left][color=#0000BB][font=monospace]getMarkerColor [/font][/color][color=#DD0000][font=monospace]"marker1" [/font][/color][color=#007700][font=monospace]== [/font][/color][color=#DD0000][font=monospace]"ColorGreen"[/font][/color][/left]


In the same trigger in the box "onAct":

Hint "Lorem Ipsum Dolor Sit Amet";

Then i synced the "things" together and everything is working right now. :)

As you can see, i started with advanced things like if&then / waitUntil etc.. in the end its much easier....

The only problem is, the task destination isnt working correctly because of the beta. Sometimes its there, sometimes not..have to wait until BI fixed it.

Thanks again for the help! I'll write a tutorial on how to do it for those who also use the EOS Script. It'll be published on my server website ( www.valixx-online.de ). It'll be written in english. Cheers!

Share this post


Link to post
Share on other sites

Don't really need Task Destination. It's often good enough to simply have a Marker on the map for the players to follow.

Congrats on starting your website and getting into ArmA3. Keep asking question as you get them! :)

Share this post


Link to post
Share on other sites

Hey thanks for your kind words :)

Ive got the task destinations modules and in the description of the task the <marker mkr1>030040</marker> thing. So, if the task destinations is not working, the other one will do it.

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  

×