134 lines
4.3 KiB
Plaintext
134 lines
4.3 KiB
Plaintext
//SLO file for landing player's forces
|
|
//for PSX - numReinf Transporter loads are given to the player
|
|
//for PC - numReinf - 'the number of transporter loads the player already has' (so may be zero extra)
|
|
|
|
//reinforcement.SLO
|
|
|
|
/* ******************** */
|
|
/* Declared Variables */
|
|
/* ******************** */
|
|
public int player, transX[2], transY[2], numLoads, loadNum[15], numReinf, transLimit, ReinforceTime;
|
|
public TEMPLATE transporter, loadTemplate[15];
|
|
public SOUND noTransSnd;
|
|
private DROID transportDroid, loadDroid;
|
|
private BOOL transOnMap;
|
|
private int count, count2, temp, curTemplate, transCount, transTot, transExtra;
|
|
private GROUP playerGroup;
|
|
private int transPlayer;
|
|
|
|
trigger loadTransTrig(every, 10); //extra ones come in every 1 seconds - (used to be 50)
|
|
trigger nextTransTrig(every, 3000); //extra ones come in every 5 minutes after 1st load
|
|
//trigger startTransTrig(CALL_NO_REINFORCEMENTS_LEFT);
|
|
|
|
event start(CALL_GAMEINIT)
|
|
{
|
|
setReinforcementTime(ReinforceTime);
|
|
}
|
|
|
|
//called once player has got all his reinforcements from previous level - if any
|
|
event loadTrans(inactive)
|
|
{
|
|
if (not transOnMap) //make sure transporter not still on map!
|
|
{
|
|
//out of templates or done all bonus transports
|
|
if ((curTemplate < numLoads) and (transExtra < transTot))
|
|
{
|
|
//load the transport here
|
|
count = curTemplate;
|
|
temp = 0; //keep track of number of units loaded
|
|
while ((count < numLoads) and (temp < 10))
|
|
{
|
|
count2 = 0;
|
|
while (count2 < loadNum[count])
|
|
{
|
|
//not worth trying to create any if couldn't get a transporter
|
|
if (transportDroid != NULLOBJECT)
|
|
{
|
|
loadDroid = addDroidToMissionList(loadTemplate[count], player);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
if ((loadDroid.droidType == DROID_WEAPON) or (loadDroid.droidType == DROID_CYBORG)) //set experience
|
|
{
|
|
setDroidKills(loadDroid, random(8) + 2); //experience range 2 to 9
|
|
}
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
}
|
|
count2 = count2 + 1;
|
|
temp = temp + 1; //temp = # of units loaded
|
|
}
|
|
count = count + 1;
|
|
curTemplate = count;
|
|
}
|
|
//call in transport
|
|
setTransporterExit(player, transX[0], transY[0]);
|
|
flyTransporterIn(player, transX[1], transY[1], false);
|
|
transOnMap = TRUE;
|
|
transExtra = transExtra + 1;
|
|
setEventTrigger(loadTrans, nextTransTrig); //longer delay for next one
|
|
}
|
|
else
|
|
{
|
|
//last transport so stop
|
|
setEventTrigger(loadTrans, inactive);
|
|
}
|
|
}
|
|
}
|
|
|
|
//counts how many transport loads the player has brought in
|
|
event countReinforcements(CALL_TRANSPORTER_LANDED, playerGroup, transPlayer)
|
|
{
|
|
//count how many times the player's tranpsorter has landed
|
|
if (transPlayer == player)
|
|
{
|
|
transCount = transCount + 1;
|
|
}
|
|
//stop reinforcements after last one allowed (assuming limited!)
|
|
if ((transCount == transLimit) and (transLimit != 0))
|
|
{
|
|
//need audio here
|
|
pause(1200); //2 mins after 4th one landed
|
|
playSound(noTransSnd, player); //"Transport under attack"
|
|
setReinforcementTime(LZ_COMPROMISED_TIME); //MAGIC NUMBER IN HERE!!!
|
|
pause(400); //40 secs after last message
|
|
playSound(noTransSnd, player); //"Transport under attack"
|
|
pause(200); //20 secs after last message
|
|
playSound(noTransSnd, player); //"Transport under attack"
|
|
}
|
|
}
|
|
|
|
event startTrans(CALL_NO_REINFORCEMENTS_LEFT) //CALLBACK
|
|
{
|
|
//bring in numReinf - number of reinforcement transport loads if > 0
|
|
transTot = numReinf - transCount;
|
|
if (transTot > 0)
|
|
{
|
|
if (transCount == 0)
|
|
{
|
|
//if no player transporters - get the first one in PDQ
|
|
setEventTrigger(loadTrans, loadTransTrig);
|
|
}
|
|
else
|
|
{
|
|
//player already has transported units in so trigger the 'free' units after usual delay
|
|
setEventTrigger(loadTrans, nextTransTrig);
|
|
}
|
|
}
|
|
//give player a transport
|
|
transportDroid = addDroidToMissionList(transporter, player);
|
|
transOnMap = FALSE;
|
|
|
|
//make sure the timer does not appear on the next mission
|
|
setReinforcementTime(-1);
|
|
|
|
|
|
setEventTrigger(startTrans, inactive);
|
|
}
|
|
|
|
//trigger each time the transporter leaves the map
|
|
event checkTrans(CALL_TRANSPORTER_OFFMAP, player)
|
|
{
|
|
transOnMap = FALSE;
|
|
}
|
|
|