warzone2100/data/script/text/cam1bx.slo

93 lines
2.1 KiB
Plaintext
Raw Normal View History

//Cam1BX.SLO
//extra script file to show glimpse of new paradigm
//Variables
public int player, enemy, enemy1, enemy2;
public TEMPLATE NPScout;
public int maxCoords, coordsX[4], coordsY[4];
public int regionsX1[1], regionsY1[1], regionsX2[1], regionsY2[1];
/* Starting Technology */
public int numtecE2;
public RESEARCHSTAT tecE2[9];
private DROID scoutDroid;
private int grpPosCurrent, count;
//triggers
trigger scoutSeenTrig(every, 15);
trigger removeScoutTrig(droidInArea(enemy, regionsX1[0],regionsY1[0], regionsX2[0], regionsY2[0]), 10);
trigger wayTrig(every, 17);
//events
event startEvnt(CALL_GAMEINIT)
{
createAlliance(enemy, enemy1);
createAlliance(enemy, enemy2);
//NP technology startup
count = 0;
while (count < numtecE2)
{
completeResearch(tecE2[count], enemy);
count = count +1;
}
//place scout vehicle
scoutDroid = addDroid(NPScout, coordsX[0], coordsY[0], enemy);
//now turn him round!
grpPosCurrent = grpPosCurrent + 1;
if (scoutDroid != NULLOBJECT)
{
orderDroidLoc(scoutDroid, DORDER_MOVE, coordsX[grpPosCurrent], coordsY[grpPosCurrent]);
}
}
event wayEvnt(inactive)
{
if (scoutDroid != NULLOBJECT)
{
//has the scout got to waypoint or idle?
if (scoutDroid.order == DORDER_NONE)
{
grpPosCurrent = grpPosCurrent + 1;
if (grpPosCurrent > maxCoords)
{
setEventTrigger(wayEvnt, inactive);
}
else
{
orderDroidLoc(scoutDroid, DORDER_MOVE, coordsX[grpPosCurrent], coordsY[grpPosCurrent]);
}
}
}
}
event scoutSeenEvnt(scoutSeenTrig)
{
//make NP scout vehicle goto cam1C canyon when player sees him.
//pause(30); //wait for 3 second!
if (scoutDroid != NULLOBJECT)
{
if (droidHasSeen(scoutDroid, player))
{
orderDroidLoc(scoutDroid, DORDER_MOVE, coordsX[1], coordsY[1]);
setEventTrigger(wayEvnt, wayTrig);
setEventTrigger(scoutSeenEvnt, inactive);
}
}
else
{
setEventTrigger(scoutSeenEvnt, inactive);
}
}
event removeScoutEvnt(removeScoutTrig)
{
//remove scout droid when at edge of map
if (scoutDroid != NULLOBJECT)
{
vanishUnit(scoutDroid);
}
setEventTrigger(removeScoutEvnt, inactive);
}