forked from NovaRain/Fallout2_Unofficial_Patch
-
Notifications
You must be signed in to change notification settings - Fork 11
/
schoss.ssl
409 lines (336 loc) · 12.4 KB
/
schoss.ssl
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
/*
Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
*/
/*
Name: Hoss
Location: Dusty's place on NCR1.map
Description: He is a bully yeah.
Log:
Please note any changes that have been made to the file in Updated. Then comment
the code which you have changed/altered/commented out. Please, do not delete any
code which was written.
Created:
Updated:
*/
/* Include Files */
/* Note, the Following Lines need to be in this order so that
the script will be compilable. The define Name is referenced
in a module from define.h and used in command.h. Please do
not change the ordering.
-rwh2 11/13/97
*/
#define SCRIPT_REALNAME "schoss"
#include "../headers/define.h"
#include "../headers/ncr1.h"
#define NAME SCRIPT_SCHOSS
#define TOWN_REP_VAR GVAR_TOWN_REP_NCR
#include "../headers/command.h"
#include "../headers/modreact.h"
#include "../headers/ncr.h"
/* Standard Script Procedures */
procedure start;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;
procedure combat_p_proc;
/* Script Specific Procedure Calls */
procedure Node998; // This Node is Always Combat
procedure Node999; // This Node is Always Ending
// The next lines are added in by the Designer Tool.
// Do NOT add in any lines here.
//~~~~~~~~~~~~~~~~ DESIGNER TOOL STARTS HERE
procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;
procedure Node005;
procedure Node006;
procedure Node007;
procedure checkTime;
procedure getTimeBit;
procedure surrender;
procedure dude_pulls_gun;
#define TIME_12TO24 (bit_12 bwor bit_13 bwor bit_14 bwor bit_15 bwor \
bit_16 bwor bit_17 bwor bit_18 bwor bit_19 bwor \
bit_20 bwor bit_21 bwor bit_22 bwor bit_23 bwor bit_24)
#define TIMER_CHECK_END_FIGHT 1
#define TIMER_TALK 2
//~~~~~~~~~~~~~~~~ DESIGN TOOL ENDS HERE
// The Following lines are for anything that is not needed to be
// seen by the design Tool
/* Local Variables which are saved. All Local Variables need to be
prepended by LVAR_ */
#define LVAR_Herebefore (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)
#define LVAR_Used_Gun (7)
#define LVAR_Surrendered (8)
/* Imported variables from the Map scripts. These should only be
pointers and variables that need not be saved. If a variable
Needs to be saved, make it a map variable (MVAR_) */
/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;
variable HpStop := 0;
procedure start begin
end
procedure combat_p_proc begin
if (global_var(GVAR_NCR_BEAT_HOSS) == 0)
and (
(self_cur_hits <= (self_max_hits / 3))
or is_critter_prone(self_obj)
)
then begin
call surrender;
end
end
procedure timed_event_p_proc begin
if (global_var(GVAR_NCR_BEAT_HOSS) == 0) and (fixed_param == TIMER_CHECK_END_FIGHT) then begin
ndebug("checking for weapon");
if (self_cur_hits <= (self_max_hits / 3)) then begin
call surrender;
end else if (dude_pulls_gun) then begin
set_local_var(LVAR_Used_Gun, 1);
call surrender;
end else begin
if (combat_is_initialized) then
add_timer_event(self_obj, game_ticks(2), TIMER_CHECK_END_FIGHT);
end
end else if (fixed_param == TIMER_TALK) then begin
dialogue_system_enter;
end
end
/* This procedure will get called each time that the map is first entered. It will
set up the Team number and AI packet for this critter. This will override the
default from the prototype, and needs to be set in scripts. */
procedure map_enter_p_proc begin
Only_Once:=0;
set_self_team(TEAM_NCR);
set_self_ai(AI_TOUGH_CITIZEN);
if (is_loading_game == FALSE) then begin
// call checkTime;
end
end
/* Every heartbeat that the critter gets, this procedure will be called. Anything from
Movement to attacking the player on sight can be placed in here.*/
procedure critter_p_proc begin
/* If the critter is mad at the player for any reason, it will attack and remember to attack
the player should the game be saved and loaded repeatedly. Additionally, if any special
actions need to be taken by the critter based on previous combat, the critter will remember
this as well. */
if ((local_var(LVAR_Hostile) == 2) and (self_can_see_dude)) then begin
set_local_var(LVAR_Hostile,1);
attack(dude_obj);
end
if (local_var(LVAR_Herebefore) == 0) then
if (beat_hoss == 0 and tile_distance_objs(self_obj, dude_obj) <= 2 and self_can_see_dude) then
dialogue_system_enter;
// call checkTime;
end
/* Whenever the critter takes damage of any type, this procedure will be called. Things
like setting ENEMY_ and LVAR_Personal_Enemy can be set here. */
procedure damage_p_proc begin
/* If the player causes damage to this critter, then he will instantly consider the player
his personal enemy. In Critter_Proc or through dialog, actions will be taken against
the player for his evil acts. */
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Personal_Enemy,1);
end
if (global_var(GVAR_NCR_BEAT_HOSS) == 0) and (self_cur_hits <= (self_max_hits / 3)) then begin
set_global_var(GVAR_NCR_BEAT_HOSS, 1);
call surrender;
end
end
/* Any time that the player is caught stealing from this critter, Pickup_proc will be called.
In here, various things can happen. The most common response is instant hostility which
will be remembered. */
procedure pickup_p_proc begin
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Hostile,2);
end
end
/* The dialog system is setup and prepares the player to talk to this NPC. Where To Go
written by designers are placed in here. Additionally, Reactions are generated and
stored which affects player interactions. */
procedure talk_p_proc begin
Evil_Critter:=0;
Slavery_Tolerant:=SLAVE_TOLERANT;
Karma_Perception:=KARMA_PERCEPTION3;
CheckKarma;
GetReaction;
set_local_var(LVAR_Herebefore, 1);
set_map_var(MVAR_Hoss_State, HOSS_KNOWN);
if (beat_hoss == 0 and local_var(LVAR_Surrendered) == 0) then begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node001;
gSay_End;
end_dialogue;
end else if ( ( (beat_hoss == 0) and (local_var(LVAR_Surrendered) == 1) ) or ( (beat_hoss == 1) and (local_var(LVAR_Surrendered) == 0) ) ) then begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
if (local_var(LVAR_Used_Gun)) then
call Node006;
else
call Node005;
gSay_End;
end_dialogue;
end else if (beat_hoss == 1) then begin
call Node007;
end
end
/* This procedure gets called only on the death of this NPC. Special things like
incrementing the death count for reputation purposes and Enemy Counters are placed
in here. */
procedure destroy_p_proc begin
/* Increment the aligned critter counter*/
inc_good_critter
/* Set global_variable for Enemy status*/
end
/* Look_at_p_proc gets called any time that the player passes the cursor over any object.
This should only hold the most cursory of glances for the player. */
procedure look_at_p_proc begin
script_overrides;
if (local_var(LVAR_Herebefore) == 0) then
display_msg(mstr(100));
else
display_msg(mstr(101));
end
/* The player will see more indepth descriptions from this procedure. They are actively
looking at the critter and want more information. Things like names can be added here
if the critter is known to the player. */
procedure description_p_proc begin
script_overrides;
display_msg(mstr(102));
end
/* Any time a skill is used on a critter this call is made. This can be to give examinations
for things like Doctor skill or messages for various other skills. */
procedure use_skill_on_p_proc begin
end
/* Should the Player ever cause the NPC too much discomfort that he desires to attack the player,
this call will be made. Essentially, it stores the Hostile vaule so that the critter remembers
he was once hostile towards the player.*/
procedure Node998 begin
set_local_var(LVAR_Hostile,2);
end
/* Anytime that there is a need for an ending to dialog, this node is to be called. It will just
exit from the dialog system without any reprisals from the NPC. */
procedure Node999 begin
end
// Not lines are allowed to be added below here
// The Following lines are from the Design Tool
//~~~~~~~~~~~~~~~~ DESIGN TOOL STARTS HERE
procedure NodeCombat begin
set_self_team(TEAM_LOANER);
add_timer_event(self_obj, game_ticks(2), TIMER_CHECK_END_FIGHT);
call Node998;
end
procedure Node001 begin
if (dude_is_male) then
Reply(103);
else
Reply(104);
BLowOption(105, Node002);
BOption(106, Node002, 4);
BOption(107, Node003, 4);
end
procedure Node002 begin
Reply(108);
NOption(ENDSTRING, NodeCombat, 1);
end
procedure Node003 begin
Reply(109);
BOption(110, NodeCombat, 4);
BOption(111, Node004, 4);
end
procedure Node004 begin
inc_general_rep(REP_BONUS_NCR_HOSS_RAZZ);
Reply(112);
ENDOPTION;
end
procedure Node005 begin
set_global_var(GVAR_NCR_BEAT_HOSS, 1);
set_local_var(LVAR_Surrendered, 1); //added by killap
Reply(113);
ENDOPTION;
end
procedure Node006 begin
set_global_var(GVAR_NCR_BEAT_HOSS, 1);
set_local_var(LVAR_Surrendered, 1); //added by killap
Reply(114);
ENDOPTION;
end
procedure Node007 begin
float_msg(self_obj, mstr(115), FLOAT_MSG_NORMAL);
end
procedure checkTime begin
if not (getTimeBit bwand TIME_12TO24) then
set_obj_visibility(self_obj, OBJ_INVIS);
else
set_obj_visibility(self_obj, OBJ_VIS);
end
procedure getTimeBit begin
variable time := 0;
time := game_time_hour;
if (time >= 100 and time <= 159) then return bit_1;
if (time >= 200 and time <= 259) then return bit_2;
if (time >= 300 and time <= 359) then return bit_3;
if (time >= 400 and time <= 459) then return bit_4;
if (time >= 500 and time <= 559) then return bit_5;
if (time >= 600 and time <= 659) then return bit_6;
if (time >= 700 and time <= 759) then return bit_7;
if (time >= 800 and time <= 859) then return bit_8;
if (time >= 900 and time <= 959) then return bit_9;
if (time >= 1000 and time <= 1059) then return bit_10;
if (time >= 1100 and time <= 1159) then return bit_11;
if (time >= 1200 and time <= 1259) then return bit_12;
if (time >= 1300 and time <= 1359) then return bit_13;
if (time >= 1400 and time <= 1459) then return bit_14;
if (time >= 1500 and time <= 1559) then return bit_15;
if (time >= 1600 and time <= 1659) then return bit_16;
if (time >= 1700 and time <= 1759) then return bit_17;
if (time >= 1800 and time <= 1859) then return bit_18;
if (time >= 1900 and time <= 1959) then return bit_19;
if (time >= 2000 and time <= 2059) then return bit_20;
if (time >= 2100 and time <= 2159) then return bit_21;
if (time >= 2200 and time <= 2259) then return bit_22;
if (time >= 2300 and time <= 2359) then return bit_23;
if (time >= 2400 and time <= 2459) then return bit_24;
end
procedure surrender begin
set_global_var(GVAR_NCR_BEAT_HOSS, 1);
set_local_var(LVAR_Surrendered, 1);
ndebug("terminating combat");
terminate_combat;
set_self_team(TEAM_NCR);
add_timer_event(self_obj, game_ticks(1), TIMER_TALK);
end
procedure dude_pulls_gun begin
//Check weapons currently in use if gun return 1;
variable pid;
variable obj;
if (dude_is_armed) then begin // added check by killap - prevents crash when calling proto_data
obj := dude_right_hand;
if (obj >= 0) then begin // changed to >=0 so that we actually check both hands - killap
pid := obj_pid(obj);
if (not(pid) or pid == -1) then begin
obj := dude_left_hand;
if (obj) then
pid := obj_pid(obj);
end
end
if (pid and (pid != -1)) then begin
if (proto_data(pid, it_weapon_range) > 2) then
return 1;
end
return 0;
end else begin
return 0;
end
end
//xxxxxxxxxxxxxxxxxxxx