warzone2100/data/script/demo/demo_global.slo

207 lines
4.2 KiB
Plaintext
Raw Normal View History

/* Demo Map Global Script */
/* put all non player specific stuff in here */
/* currently has:
Fog colour
Starting Technology and Starting Research
*/
//structures
public STRUCTURESTAT command;
public STRUCTURESTAT factory;
public STRUCTURESTAT wall;
public STRUCTURESTAT cornerWall;
public STRUCTURESTAT oilDerrick;
public STRUCTURESTAT powerGen;
public STRUCTURESTAT research;
public STRUCTURESTAT commandrelay;
//starting tech
public int numtecCommon;
public int numtecP0, numtecP1, numtecP2, numtecP3,numtecP4, numtecP5, numtecP6, numtecP7;
public RESEARCHSTAT tecCommon[32];
public RESEARCHSTAT tecP0[1], tecP1[1], tecP2[1], tecP3[1], tecP4[1], tecP5[1], tecP6[1], tecP7[1];
public int numResCommon;
public int numResP0, numResP1, numResP2, numResP3, numResP4, numResP5, numResP6, numResP7;
public RESEARCHSTAT resCommon[10];
public RESEARCHSTAT resP0[1], resP1[1], resP2[1], resP3[1], resP4[1], resP5[1], resP6[1], resP7[1];
private INT count;
private INT playnum;
/* Triggers */
trigger startTrig(every, 50);
trigger stopTrig(every, 100);
/* Events */
event weatherStop;
event startup(CALL_GAMEINIT)
{
setFogColour(182, 225, 236); //set fog to blue-white
setBackgroundFog(TRUE); //set fog on
setDepthFog(TRUE);
centreViewPos(3392, 10944); //centre on P0 base
randomiseSeed();
playnum=0;
while (playnum < 8)
{
enableStructure(command ,playnum); //make structures available to build
enableStructure(factory ,playnum);
enableStructure(wall ,playnum);
enableStructure(cornerWall ,playnum);
enableStructure(oilDerrick ,playnum);
enableStructure(powerGen ,playnum);
enableStructure(research ,playnum);
count = 0; // Common Starting Technologies
while (count < numtecCommon)
{
completeResearch(tecCommon[count], playnum);
count = count +1;
}
count = 0; // Common Starting Research
while (count < numResCommon)
{
enableResearch(resCommon[count], playnum);
count = count +1;
}
setStructureLimits(factory, 5, playnum); // set structure limits
setStructureLimits(powerGen, 5, playnum);
setStructureLimits(research, 3, playnum);
setStructureLimits(command, 1, playnum);
//setPowerLevel(1500,playnum);
playnum = playnum + 1;
}
// player specific technology startups
count = 0;
while (count < numtecP0)
{
completeResearch(tecP0[count], 0);
count = count +1;
}
count = 0;
while (count < numtecP1)
{
completeResearch(tecP1[count], 1);
count = count +1;
}
count = 0;
while (count < numtecP2)
{
completeResearch(tecP2[count], 2);
count = count +1;
}
count = 0;
while (count < numtecP3)
{
completeResearch(tecP3[count], 3);
count = count +1;
}
count = 0;
while (count < numtecP4)
{
completeResearch(tecP4[count], 4);
count = count +1;
}
count = 0;
while (count < numtecP5)
{
completeResearch(tecP5[count], 5);
count = count +1;
}
count = 0;
while (count < numtecP6)
{
completeResearch(tecP6[count], 6);
count = count +1;
}
count = 0;
while (count < numtecP7)
{
completeResearch(tecP7[count], 7);
count = count +1;
}
// player specific research startups
count = 0;
while (count < numResP0)
{
enableResearch(resP0[count], 0);
count = count +1;
}
count = 0;
while (count < numResP1)
{
enableResearch(resP1[count], 1);
count = count +1;
}
count = 0;
while (count < numResP2)
{
enableResearch(resP2[count], 2);
count = count +1;
}
count = 0;
while (count < numResP3)
{
enableResearch(resP3[count], 3);
count = count +1;
}
count = 0;
while (count < numResP4)
{
enableResearch(resP4[count], 4);
count = count +1;
}
count = 0;
while (count < numResP5)
{
enableResearch(resP5[count], 5);
count = count +1;
}
count = 0;
while (count < numResP6)
{
enableResearch(resP6[count], 6);
count = count +1;
}
count = 0;
while (count < numResP7)
{
enableResearch(resP7[count], 7);
count = count +1;
}
}
event weatherStart(startTrig)
{
if (random(10)< 5)
{
setSnow(TRUE);
setEventTrigger(weatherStop, stopTrig);
setEventTrigger(weatherStart, inactive);
}
}
event weatherStop(inactive)
{
if (random(10)< 4)
{
setSnow(FALSE);
setEventTrigger(weatherStart, startTrig);
setEventTrigger(weatherStop, inactive);
}
}