Home   Help Search Login Register  

Author Topic: Scoring Zone  (Read 1277 times)

0 Members and 1 Guest are viewing this topic.

Offline CyDoN

  • Members
  • *
Scoring Zone
« on: 22 Jan 2008, 20:13:45 »
i wanna make a trigger that when specific units enter an aera blufor for istance takes an amound of points.
also i want to use a radio alpha BUT i want only bluefor to be able to use it.

Thank u all for reading it.

Offline Loyalguard

  • Former Staff
  • ****
Re: Scoring Zone
« Reply #1 on: 23 Jan 2008, 18:47:46 »
CyDon-

For your trigger scoring system you would need to do something like the following:

init.sqf
scoreWest = 0; // create a global variable (later to be made public) to store the current BluFor team's score.

Trigger (BLUFOR present, once, etc.)
Cond: this
On Act.: scoreWest = ScoreWest + 10; publicVariable "scoreWest";

The way the above works is that the init.sqf initializes a variable to store the score, and the trigger adds points to the score and updates all clients with the new value using publicVariable.

If you want this to be JIP compatible you need to have an JIP player update routine to make sure they get the current value of scoreWest and not just 0 (as set in the init.sqf).  The best way to do this is perhaps like this:

init.sqf
Code: [Select]
scoreWest = 0; // create a global variable (later to be made public) to store the current BluFor team's score.
waitUntil {alive player}; // Pauses the init.sqf until the player object is in game.
onPlayerConnected "[] execVM ""onPlayerConnected.sqf"""; // When player connects the server will run the appropriate script.

onPlayerConnected.sqf
Code: [Select]
publicVariable "scoreWest"; // Broadcast the current value of scoreWest from the server to all clients.

For the radio trigger one way is to use setRadioMsg with "NULL" in the init line for all the units you do NOT want to be able to use the radio trigger.

I hope that helps!