Home   Help Search Login Register  

Author Topic: Generic Time Limit Question  (Read 1856 times)

0 Members and 4 Guests are viewing this topic.

Offline Tom_Anger

  • Members
  • *
    • Shadow Company Elite (SCE_FATMAN)
Generic Time Limit Question
« on: 27 Mar 2007, 10:30:18 »
I have read different methods to set a time limit on a mission, and on some missions I witnessed I saw some nice screen updates to keep the players well informed.  Does anyone know of a script that I can use or logic in the description area that I can use to setup time limits?  I may need you to explain how to add the script as I am a bit new to much of this.  Still learning.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Generic Time Limit Question
« Reply #1 on: 27 Mar 2007, 11:10:02 »
You may try something like this:

Code: [Select]
// Time to wait in minutes as single script argument.
// waiter.sqf
// Example with 5 mins limit.
// [5]execVM"waiter.sqf"

_timetowait = _this select 0;

while {_timetowait > 0} do
{
   if (_timetowait != 1) then
   {
      cutText[format["%1 minutes left", _timetowait], "PLAIN"];
   }
   else
   {
      cutText["One minute left", "PLAIN"];
   };
   Sleep(60);
   _timetowait = _timetowait - 1;
}
cutText["Time is over", "PLAIN"];

Offline Tom_Anger

  • Members
  • *
    • Shadow Company Elite (SCE_FATMAN)
Re: Generic Time Limit Question
« Reply #2 on: 27 Mar 2007, 12:18:57 »
That looks nice and simple.  Forgive me for this next question.  Do I just use a generic trigger to call the script, can the call be added in the init program?  I don't see a command that tells the game that it is over so I want to make sure I add the call in correctly.  Thanks for your reply.

Offline Cheetah

  • Former Staff
  • ****
Re: Generic Time Limit Question
« Reply #3 on: 27 Mar 2007, 17:38:30 »
You can add it on the init line of a unit, for example with:
waitScript = [5] execVM "waiter.sqf";

No termination command is required for a script to stop working, don't worry.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Tom_Anger

  • Members
  • *
    • Shadow Company Elite (SCE_FATMAN)
Re: Generic Time Limit Question
« Reply #4 on: 29 Mar 2007, 10:57:40 »
Thanks guys - this worked great.  I took the script logic, made a .sqf file (nice tutorial cheetah - btw) and used a medic hospital to add the init line as mentioned.  This gave me the countdown.  I have spent a bit of time searching how to end properly and since some forum posts talk about .sqf, sqs, or triggers, I figured I would stay on topic and discuss how I can successfully have the mission end with the .sqf.  Here is the mission specs:

Team vs. Team (Attack & Defend).
OPFOR has a convoy setup, Pilots, engineers, riflemen, etc at the airbase and must get to Dolores to destoy Fuel Stations at the local Docks.  BLUFOR has a base setup not too far from the docks and their job is to DEFEND until the threat is over.  I have it end successfully if the fuel stations are destroyed so that works.  I am trying to work in the time limit to this as well.

SUMMARY:
An OPFOR victory occurs when the fuel stations are destroyed (this works)
A BLUFOR victory does not occur yet because the time limit is not ending the map with an END condition (my dilema)

Given the .sqf file above how can I make that part of the ending properties of this map?

When I get your answer I will have another question which will be how I can make it so that when BLUFOR accumulates enough kills/points that that will trigger a BLUFOR victory, but for now lets see if a time expiration can help make it happen.  I think the next part will be easy as well, but you whiz pros may be the help I need in this fun map for team battles.

Offline Tom_Anger

  • Members
  • *
    • Shadow Company Elite (SCE_FATMAN)
Re: Generic Time Limit Question
« Reply #5 on: 29 Mar 2007, 13:41:51 »
I PM'ed phelican, but I would be very interested in how I can make this happen.  Here is some of what I need in pseudocode

I am building an Attack & Defend map (almost done) where OPFor has to destroy 2 fuel station docks to win (I may add more targets).  That part works great.  My question/dilema is how I want the BLUFOR team to win.  There is a timelimit .sqf script that I have working, (used this forum post), but I don't see code or the "how-to" on making the mission end. 

My thoughts are as follows:

Once I get feedback on that part of my dilema, I would also like to entertain a point system method for the BLUFOR to stop the attack threats.

POINT SYSTEM METHOD
If a BLUFOR unit destroys a vehicle (jet, tank, etc) +50 points for BLUFOR
If a BLUFOR unit kills a player +100 points for BLUFOR
If a BLUFOR unit kills a Team Leader (Sergeant) +200 points for BLUFOR

When BLUFOR reaches 3500 points the threat is over and BLUFOR wins.

TIME LIMIT METHOD (only if player slots are under 16) -
Still keep the point system in the ending condition, but if there are less than 16 players add the time limit of 30 minutes.  Not sure if that can easily be done since players can join in and some may leave....

I am quite new to the scripting so I may not fully understand your reply, but I will do my best.  My guess is 1 script can be written for point increments.  For example:

For each Unit that dies I have this in the init line not alive (unit) [points] execVM score.sqf

So each time that particular unit dies/is destroyed the script is called and it passes in points that are added to the BLUFOR team.

score.sqf
// Script that passes in points for dead objects

_points = _this select 0;

Add points to the BLUFOR team and check accumlated points to end
I would need to know how I can make it so that if the OFPOR has casualties, self inflicted or from BLUFOR so that it will add points to the BLUFOR team as a whole.  Then I need it to check the score periodically to determine if it should end the mission in BLUFOR victory.

Any help is apreciated.  It will surely help develop a nice tactical team vs team map.