Home   Help Search Login Register  

Author Topic: [Dedi] end condition  (Read 5878 times)

0 Members and 3 Guests are viewing this topic.

Offline Nephris

  • Members
  • *
[Dedi] end condition
« on: 20 Oct 2009, 13:06:38 »
Hi gents,
since OFP i didnt get very used to scripting anymore, and even less to mp scripting.
Atm i have some probs with public variables and locals and stuff.
I read some articles in the Bis Wikis made by Sickboy, but i fear learning by doing or try and error is the more successful way to get things working as desired.
Well long story short sense:

When i activate my ending conditions like
Code: [Select]
taskState tskObj1 == "SUCCEEDED"it doesnt seem to work for each client at same time or at all.

So what variables have to be set publicvariable?
I set in the example above
Code: [Select]
publicvariable "tskObj1"but it stil doesnt seem to work correct.

Could you give me some help/hints concerning variable/publicvariable in briefings for dedis?
Greetz
« Last Edit: 20 Oct 2009, 13:15:28 by Nephris »

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: [Dedi] end condition
« Reply #1 on: 20 Oct 2009, 16:24:39 »
The publicvariable method is only meant to give JIP players updated tasks. I don't think it would update mid-game unless you called a script.

The publicvariable is different from the objname. So:
objKill setTaskState "SUCCEEDED"; obj1=true; publicVariable "obj1";

In init.sqf:
if(isServer) then {obj1=false};

In briefing.sqf:
if(obj1) then {objKill setTaskState "SUCCEEDED"} else {objKill setTaskState "CREATED"};

You could then check the new globals instead of the objectives themselves for the trigger.

You could also try taskmaster script which I think has a more advanced way of updating tasks.

Offline Nephris

  • Members
  • *
Re: [Dedi] end condition
« Reply #2 on: 20 Oct 2009, 17:53:33 »
Cheerz for ya help m8...dusk is lifting  :)
Gonna try it when back from work!

edit:
searched for "taskmaster script" ....unfortunately i didnt find it via the search function.
Or did i get ya wrong?
« Last Edit: 20 Oct 2009, 17:56:17 by Nephris »

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: [Dedi] end condition
« Reply #3 on: 20 Oct 2009, 18:51:45 »

Offline Nephris

  • Members
  • *
Re: [Dedi] end condition
« Reply #4 on: 20 Oct 2009, 20:01:57 »
You are right taskmaster has a more advanced way of updating...for me a bit too advanced, am a dumbass at the modern scripting. ...and i was glad being able to understand sqs scritpting in OFP times, but well.

I think i should
Quote
In init.sqf:
if(isServer) then {obj1=false};

In briefing.sqf:
if(obj1) then {objKill setTaskState "SUCCEEDED"} else {objKill setTaskState "CREATED"};
for each object, means obj1 - obj4....?

Should i set the term for briefing into a loop or simply like that?

Code: [Select]
eaair = player createSimpleTask["Luftabwehr Olsha zerstoeren"];
eaair setSimpleTaskDescription["Die in <marker name='obj1'>Olsha</marker> stationierte Luftabwehr macht unseren Luftstreitkraeften in diesem Sektor unnoetige Probleme. Zerstoeren Sie die Anlage!", "Luftabwehr Olsha zerstoeren", "Luftabwehr Olsha zerstoeren"];
eaair setSimpleTaskDestination (getMarkerPos "obj1");
eaair settaskstate "Created";

if(obj1) then {eaair setTaskState "SUCCEEDED"} else {eaair setTaskState "CREATED"};
« Last Edit: 20 Oct 2009, 20:51:07 by Nephris »

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: [Dedi] end condition
« Reply #5 on: 21 Oct 2009, 01:20:35 »
You've got it right.

It you mean to create a loop to constantly update tasks:
No, you can't create a loop for that with/within briefing.sqf. It would be too taxing for one. Also, briefing.sqf is executed on every respawn (and only once or duplicate tasks will occur) and should not contain anything special except what we've done (simply linking taskState to a publicVariable)

You could create a seperate script:
Code: [Select]
if(obj1) then {eaair setTaskState "SUCCEEDED"} else {eaair setTaskState "CREATED"};
if(obj2) then {eaOther setTaskState "SUCCEEDED"} else {eaair setTaskState "CREATED"};
And run it when you want all tasks updated on every client, but if its only for a trigger, just try using the publicVariable condition.

If you meant a loop for processing multiple objectives at once:
Code: (init.sqf) [Select]
if(isServer) then {
_num = 0;
compile format[_num = _num + 1; objList = objList + 'obj%1',_num] forEach simpleTasks;
}
Code: (briefing.sqf) [Select]
_num = 0;
{if(objList select _num) then {(simpleTasks select _num) setTaskState "SUCCEEDED"; _num = _num +1} else {(simpleTasks select _x) setTaskState "CREATED"}} forEach simpleTasks;
This hasn't been tested though, so it might cause more trouble than just typing it all out.
« Last Edit: 21 Oct 2009, 01:23:26 by tcp »

Offline Shuko

  • Members
  • *
Re: [Dedi] end condition
« Reply #6 on: 21 Oct 2009, 19:28:39 »
You are right taskmaster has a more advanced way of updating...for me a bit too advanced, am a dumbass at the modern scripting.

Well, don't know about advanced. But, isn't doing this:

nul = ["eaair","succeeded"] call TASKMASTER_upd;

more simple than the stuff listed in this thread? ;)

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: [Dedi] end condition
« Reply #7 on: 21 Oct 2009, 20:40:48 »
I would say so. I actually use taskmaster. I only meant it was advanced in its internal handling (taking care of the JIP/publicVariables and providing tskCompleted booleans for you).

Once you learn how to call the functions it's easier to implement than the default method.

Offline Nephris

  • Members
  • *
Re: [Dedi] end condition
« Reply #8 on: 22 Oct 2009, 12:59:44 »
Thx for all your effort to explain me those things to handle.
After bothering a bit longer with taskmaster it become easier than it seemed to be at first look.

Gonna check the changes now.
I am still a bit curious if my publicvarialbe are correct...
Thx so far.

Offline Shuko

  • Members
  • *
Re: [Dedi] end condition
« Reply #9 on: 22 Oct 2009, 15:31:39 »
Feel free to ask any questions about the master here.

Offline Nephris

  • Members
  • *
Re: [Dedi] end condition
« Reply #10 on: 24 Oct 2009, 01:45:44 »
I think i got the briefing and stuff as mentioned managed.
But another issue occured that fits actual into the same thread, so...

What is the best way to end a mission via a trigger after 3 objectives are completed?I ArmA1 and OFP following code worked

Code: [Select]
this && obj1 && obj2 && obj3but not in ArmA2 (as i may believe Mrs. RPT)

The endconditions shall work also on an dedicated server, so obj1,obj2,obj3 were also publicvariables.

Offline Shuko

  • Members
  • *
Re: [Dedi] end condition
« Reply #11 on: 24 Oct 2009, 02:22:03 »
There are taskCompleted and taskState which you can use. Or you can just make and update your own set of publicvariable booleans.

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: [Dedi] end condition
« Reply #12 on: 24 Oct 2009, 06:02:44 »
Get rid of < this > unless the trigger actually checks for something else as well.

So if you are using Taskmaster:
tskeaairCompleted && tskeaOtherCompleted && tskKillCompleted

Offline Nephris

  • Members
  • *
Re: [Dedi] end condition
« Reply #13 on: 07 Jun 2010, 00:02:32 »
Hi folks,
sry for digging my old thread, but this question refers to the same topic,...and i am doing very hard with global,local etc....dedicated...

-I got one team...the teamleader init:
Code: [Select]
Alpha = group this-I got 3 variables (var1,var2,var3 set to publicvariable in init.sqf) which have to be set to true when i change my flags.
-My endtrigger, that shall end my mission, shall check the living team members inside and the 3 variables (var1-3)

This is my condition of the endtrigger:
Code: [Select]
radius: 100x100
type: end
countdown: 10 sec
var1 and var2 and var3 && ({_x In thislist} Count (Units Alpha) >= {Alive _X} Count (Units Alpha))


The 3 variables work, and i get my debug hint at same time as my team members.
The endtrigger works only for one member. I guess the first who activates the trigger.
The game ends just for him.
The game doe not end for the remainig members.

So i am sure there is sth wrong but i am just to stupid to figure out what exactly.
Can u help me?



Offline Ironman

  • Former Staff
  • ****
    • {GSF} Home Page
Re: [Dedi] end condition
« Reply #14 on: 07 Jun 2010, 10:12:30 »
This is how I do every objective no matter what the number....

Lets say only 2 objectives:

obj1 and obj2 are defined in the briefing....

Code: [Select]
Trigger1:
Condition: blah blah blah
Activation: obj1 setTaskState ""SUCCEEDED""; obj1COMPLETED = true;

Trigger2:
Condition: blah blah blah
Activation: obj2 setTaskState ""SUCCEEDED""; obj2COMPLETED = true;

Trigger3:
Condition: obj1COMPLETED && obj2COMPLETED
type: End
TS3 IP: tor.zebgames.com:9992