-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0_mg_sim.xml
75 lines (68 loc) · 2.14 KB
/
0_mg_sim.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" standalone="yes" ?>
<scenario>
<difficulty value="3"/>
<players>
<player control="human" faction="farmer" team="1"/>
<player control="network" faction="farmer" team="2"/>
<player control="cpu" faction="farmer" team="3"/>
<player control="cpu" faction="farmer" team="4"/>
<!--<player control="network" faction="penguin" team="1"/>
<player control="network" faction="penguin" team="2"/>
<player control="network" faction="penguin" team="1"/>
<player control="network" faction="penguin" team="2"/>-->
</players>
<map value="testmap"/>
<tileset value="mg_sim_europe"/>
<tech-tree value="mg_sim_default"/>
<fog-of-war value="false"/>
<default-resources value="true"/>
<default-units value="true"/>
<default-victory-conditions value="false"/>
<scripts>
´ <global>
seconds_per_year = 60 --60*60
year=1601
maxPlayer = 4
function mod(x,y)
return x - (math.floor(x/y)*y)
end
function div(x,y)
return math.floor(x/y)
end
function balance_timer_tick(player)
wheat = resourceAmount('wheat', player)
wood = resourceAmount('wood', player)
giveResource( 'gold' , player , resourceAmount('balance', player) + ( wheat * 35))
giveResource( 'gold' , player , resourceAmount('balance', player) + ( wood * 5))
addConsoleText('Player '..player..': '..(resourceAmount('balance', player)..' + '..( wheat * 35)..' + '..( wood * 5)))
giveResource( 'wheat', player, 0 - wheat )
giveResource( 'wood', player, 0 - wood )
end
function eachPlayer(todo)
for i=1,maxPlayer do
todo(i-1)
end
end
balance_timer = nil;
</global>
<startup>
balance_timer = startEfficientTimerEvent(seconds_per_year)
setDisplayText(year)
</startup>
<timerTriggerEvent>
setRandomGenInit(getWorldFrameCount())
if triggeredTimerEventId() == balance_timer then
eachPlayer(balance_timer_tick)
year = year + 1
setDisplayText(year)
balance_timer = startEfficientTimerEvent(seconds_per_year)
end
</timerTriggerEvent>
<unitDied>
</unitDied>
<unitCreatedOfType type="worker">
</unitCreatedOfType>
<gameOver>
</gameOver>
</scripts>
</scenario>