forked from Adeptus-Dominus/ChapterMaster
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAlarm_3.gml
More file actions
198 lines (157 loc) · 7.58 KB
/
Alarm_3.gml
File metadata and controls
198 lines (157 loc) · 7.58 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// if (battle_over=1) then exit;
if (defeat_message=1) then exit;
if (wall_destroyed=1) then wall_destroyed=0;
var i,good,changed;i=0;good=0;changed=0;
// if (messages_to_show=8) and (messages_shown=0) then alarm[6]=75;
// if (messages_shown=105) then exit;
/*i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);*/
repeat(100){
if (good=0){
changed=0;i=0;
repeat(55){
i+=1;
// Collide the messages if needed
if (message[i]="") and (message[i+1]!=""){
message[i]=message[i+1];
message_sz[i]=message_sz[i+1];
message_priority[i]=message_priority[i+1];
message[i+1]="";
message_sz[i+1]=0;
message_priority[i+1]=0;
changed=1;
}
// Move larger messages up
if (message[i]!="") and (message[i+1]!="") and (message_sz[i]<message_sz[i+1]) and ((message_priority[i]<message_priority[i+1]) or (message_priority[i]=0)){
message[100]=message[i];
message_sz[100]=message_sz[i];
message_priority[100]=message_priority[i];
message[i]=message[i+1];
message_sz[i]=message_sz[i+1];
message_priority[i]=message_priority[i+1];
message[i+1]=message[100];
message_sz[i+1]=message_sz[100];
message_priority[i+1]=message_priority[100];
changed=1;
}
// Move messages with higher priority up
if (message[i]!="") and (message[i+1]!="") and (message_priority[i]<message_priority[i+1]){
message[100]=message[i];
message_sz[100]=message_sz[i];
message_priority[100]=message_priority[i];
message[i]=message[i+1];
message_sz[i]=message_sz[i+1];
message_priority[i]=message_priority[i+1];
message[i+1]=message[100];
message_sz[i+1]=message_sz[100];
message_priority[i+1]=message_priority[100];
changed=1;
}
if (changed=0) then good=1;
}
}
}
if ((messages > 0) and (messages_shown < messages_to_show)) {
show_debug_message("Message Received!");
var that_sz, that; // show_message("Largest Message");
that_sz = 0;
that = 0;
var i = 0;
repeat(100) {
i += 1;
if (message[i] != "") and(message_sz[i] > that_sz) {
that_sz = message_sz[i];
that = i;
}
}
if (that != 0) and(that_sz > 0) {
newline = message[that];
if (newline_color == "") {
if (string_count(" casts '", newline) > 0) then newline_color = "blue";
if (string_count("Perils of the Warp!", newline) > 0) then newline_color = "red";
if (string_count("confers knowledge", newline) > 0) then newline_color = "purple";
if (string_count("^", newline) > 0) {
newline_color = "white";
newline = string_replace(newline, "^", "");
}
if (string_count("unit_lost_text", newline) > 0) {
if (string_count("been lost", newline) > 0) {
newline_color = "red";
} else {
newline_color = c_gray;
}
newline = string_replace(newline, "unit_lost_text", "");
}
if (message_priority[that] > 0) then newline_color = "bright";
if (message_priority[that] = 2.1) then newline_color = "purple";
if (message_priority[that] = 135) then newline_color = "blue";
if (message_priority[that] = 136) then newline_color = "blue";
}
scr_newtext();
messages_shown += 1;
largest += 1;
message[that] = "";
message_sz[that] = 0;
message_priority[that] = 0;
messages -= 1;
}
alarm[3]=2;
}
if (messages==0) or (messages_shown> messages_to_show) then messages_shown=999;
/*var noloss;noloss=instance_nearest(50,300,obj_pnunit);
if (!instance_exists(noloss)) then player_forces=0;
if (instance_exists(noloss)){if (point_distance(50,300,noloss.x,noloss.y)>500) then player_forces=0;}*/
if (instance_exists(obj_pnunit)){
var plnear;plnear=instance_nearest(room_width,240,obj_pnunit);
if (plnear.x<-40) then player_forces=0;
}
if (!instance_exists(obj_pnunit)) then player_forces=0;
if ((messages_shown=999) or (messages=0)){
newline_color="yellow";
if (obj_ncombat.enemy!=6){
if (enemy_forces>0) and (obj_ncombat.enemy!=30) then newline="Enemy Forces at "+string(max(1,round((enemy_forces/enemy_max)*100)))+"%";
if (obj_ncombat.enemy=30) and (instance_exists(obj_enunit)){newline="Enemy has ";var yoo;yoo=instance_nearest(0,0,obj_enunit);newline+=string(round(yoo.dudes_hp[1]))+"HP remaining";}
if (enemy_forces<=0) or (!instance_exists(obj_enunit)) and (defeat_message=0){defeat_message=1;newline="Enemy Forces Defeated";timer_maxspeed=0;timer_speed=0;started=2;instance_activate_object(obj_pnunit);}
}
newline_color="yellow";
if (obj_ncombat.enemy=6){
var jims;jims=0;
repeat(20){jims+=1;
if (dead_jim[jims]!="") and (dead_jims>0){
newline=dead_jim[jims];newline_color="red";
scr_newtext();dead_jim[jims]="";dead_jims-=1;
}
}
if (player_forces>0){newline=string(global.chapter_name)+" at "+string(round((player_forces/player_max)*100))+"%";four_show=0;}
var plnear;plnear=instance_nearest(room_width,240,obj_pnunit);
if ((player_forces<=0) or (plnear.x<-40)) and (defeat_message=0){defeat_message=1;newline=string(global.chapter_name)+" Defeated";timer_maxspeed=0;timer_speed=0;started=4;defeat=1;instance_activate_object(obj_pnunit);}
}
messages_shown=105;done=1;scr_newtext();timer_stage=3;exit;
}
if ((messages_shown=999) or (messages=0)) and ((timer_stage=4) or (timer_stage=5)) and (four_show=0){
newline_color="yellow";
if (obj_ncombat.enemy!=6){
var jims;jims=0;
repeat(20){jims+=1;
if (dead_jim[jims]!="") and (dead_jims>0){
newline=dead_jim[jims];newline_color="red";
scr_newtext();dead_jim[jims]="";dead_jims-=1;
}
}
if (player_forces>0){newline=string(global.chapter_name)+" at "+string(round((player_forces/player_max)*100))+"%";four_show=1;}
var plnear;plnear=instance_nearest(room_width,240,obj_pnunit);
if ((player_forces<=0) or (plnear.x<-40)) and (defeat_message=0){defeat_message=1;newline=string(global.chapter_name)+" Defeated";timer_maxspeed=0;timer_speed=0;started=4;defeat=1;instance_activate_object(obj_pnunit);}
}
newline_color="yellow";
if (obj_ncombat.enemy=6){
if (enemy_forces>0) then newline="Enemy Forces at "+string(max(1,round((enemy_forces/enemy_max)*100)))+"%";
if ((enemy_forces<=0) or (!instance_exists(obj_enunit))) and (defeat_message=0){defeat_message=1;newline="Enemy Forces Defeated";timer_maxspeed=0;timer_speed=0;started=2;instance_activate_object(obj_pnunit);}
}
messages_shown=105;done=1;scr_newtext();timer_stage=5;exit;
}
/* */
/* */