OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 03 Apr 2009, 20:37:08

Title: Radio Trigger and format publicVariable problem
Post by: laggy on 03 Apr 2009, 20:37:08
I want the players to be able to wait X hours (skiptime) whenever they want.
With Radio Bravo you add 1 hour to a variable called "waitadd", this you can do any number of times wanted.
With Radio Charlie you then activate the waiting function and skip the X number of hours, chosen with Radio Bravo.

Radio Bravo
Condition: this
OnAct; if (isServer) then {waitadd = waitadd + 1; publicVariable "waitadd"; waitinfo = hint format ["%1 Waiting hour(s) chosen", waitadd]; publicVariable "waitinfo"}

Radio Charlie
Con: this
OnAct: titletext [format ["Waiting %1 hour(s)...", waitadd], "BLACK IN", 5]; skiptime waitadd

Problem:
On a dedi the format doesn't work, you dont see the hint but when you do Radio Charlie it says "Waiting X hours" and the correct number of hours hours are skipped.

Question:
I could just skip the if isServer thing, but how do I then avoid that the "waitadd" gets multipled by the number of players every time?

 :dunno:
Title: Re: Radio Trigger and format publicVariable problem
Post by: schuler on 04 Apr 2009, 00:13:19
iam not very good at this but this might help you set up some of it

Code: [Select]
; Activated By: Vehicle Present
;Condition: this
;On Activation: WaitAction = Player addaction ["Wait 10 hours", "skiptime.sqf"];
;On DeActivation: Player removeAction WaitAction; WaitAction = nil;

titleText ["You take a rest for a couple of hours, until night falls...", "plain down"];
cutText ["", "black out", 1];
sleep 2;
skipTime 10;
sleep 1;
cutText ["", "black in", 1];
but its set to 10 hours
Title: Re: Radio Trigger and format publicVariable problem
Post by: i0n0s on 04 Apr 2009, 01:09:49
Code: [Select]
waitadd = waitadd + 1; publicVariable "waitadd"; waitinfo = hint format ["%1 Waiting hour(s) chosen", waitadd]; publicVariable "waitinfo"runs completely on the server. So the client can't see it.
Easiest solution: Add an publicVariableEventhandler to waitinfo and display the hint there.
Title: Re: Radio Trigger and format publicVariable problem
Post by: schuler on 04 Apr 2009, 01:13:51
hey sorry Laggy i was way off track with server!
Title: Re: Radio Trigger and format publicVariable problem
Post by: laggy on 04 Apr 2009, 01:42:02
Much obliged  :D