Please help me! I'm losing my mind again!!!!
I have two objects. A game logic named "logicAntenna" and a game object (vysilacka radio) named "Radio".
To logicAntenna I have added the following action in its init:
idAntenna = this AddAction [""Adjust Antenna"",""adjustantenna.sqs""]";
To Radio I have added the following action in its init:
"idRadio = this AddAction [""Radio HQ"",""radiohq.sqs""]";
If the radio is used before the antenna is adjusted a message appears. If a player adjusts the antenna and then uses the radio, a message appears and the next ojective is activated. Both these actions are handled by boolean variable triggers. It works in SP but in MP the code in the script radiohqmsg.sqs does not seem to get executed on all clients and the hints, new objective, and sidechats are not displayed. The Ceiling function simply rounds up to the nearest integer.
Here is the mission.sqm code for the two triggers.
      {
         position[]={959.180298,0.397639,6675.228516};
         a=0.000000;
         b=0.000000;
         rectangular=1;
         age="UNKNOWN";
         expCond="Antenna";
         expActiv="[] Exec ""adjustantennamsg.sqs""";
         class Effects
         {
         };
      };
      {
         position[]={717.915405,0.397639,6705.841797};
         a=0.000000;
         b=0.000000;
         rectangular=1;
         repeating=1;
         age="UNKNOWN";
         expCond="RadioHQ";
         expActiv="[] Exec ""radiohqmsg.sqs""";
         class Effects
         {
         };
};
Here is the code for the four scripts involved:
adjustantenna.sqs
AntennaOp = _this Select 1
Hint "You have adjusted the antenna"
logicAntenna RemoveAction idAntenna
Antenna = TRUE
PublicVariable "AntennaOp"
PublicVariable "Antenna"
Exit
adjustantennamsg.sqs
AntennaOp GroupChat "I've adjusted the antenna. Now radio HQ!"
AntennaOp = NIL
If (Local Server) Then {DeleteVehicle logicAntenna}
Exit
radiohq.sqs
RadioOp = _this Select 1
If (Not Antenna) Then {Hint "You've hacked into the radio but the antenna needs adjusting."}
RadioHQ = TRUE
PublicVariable "RadioOp"
PublicVariable "RadioHQ"
Exit
radiohqmsg.sqs
RadioHQ = FALSE
If (Not Antenna) Then {RadioOp GroupChat "I've hacked into the radio junction box, but the signal is still too weak. Someone must climb up and adjust the antenna!" ; RadioOp = NIL ; RadioHQ = FALSE ; Exit}
Radio RemoveAction idRadio
;setup endgame
RandomInt = -99
If Not (Local Server) Then {Goto "client"}
RandomInt = [Random 10] Call Ceiling
PublicVariable "RandomInt"
#client
~1
@RandomInt!=-99
;radio exchange
RadioBox Say "static"
RadioOp SideChat "Firefly Base Come in! Firefly Base do you read me?"
RadioOp = NIL
~5
RadioBox Say "static"
FireFly SideChat "Zulu Red. This is FireFly Base..."
~5
RadioBox Say "static"
FireFly SideChat "Proceed to emergency extraction point at old ammo cache. Defend position until helicopter arrives."
;endgame markers
RandomMark = Format ["MarkerX%1",RandomInt]
RandomHMark = Format ["MarkerXH%1",RandomInt]
ExtractPos = GetMarkerPos RandomMark
ExtractHPos = GetMarkerPos RandomHMark
"MarkerExtract" SetMarkerPos ExtractPos
"MarkerExtract" SetMarkerType "END"
"3" ObjStatus "HIDDEN"
"6" ObjStatus "DONE"
"7" ObjStatus "ACTIVE"
Obj6 = TRUE
Mash1 SetPos [5 + (ExtractPos Select 0), ExtractPos Select 1, ExtractPos Select 2]
ammoEast3 SetPos ExtractPos
Mash1 SetDamage 0
ammoEast3 SetDamage 0
LZPad SetPos ExtractHPos
TriggerLZ SetPos ExtractPos
;
Hint "Objectives and Map Updated"
~5
RadioBox Say "static"
FireFly SideChat "Signal helicopter to approach extraction point with red flares."
~5
RadioBox Say "static"
FireFly SideChat "Signal helicopter to land with green flares."
~5
RadioBox Say "static"
FireFly SideChat "Flares must be fired within 200m of extraction point."
~5
.
.
.
Exit