-
Notifications
You must be signed in to change notification settings - Fork 19
/
sphere_events_npcs.scp
432 lines (391 loc) · 10.4 KB
/
sphere_events_npcs.scp
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
//****************************************************************************
// SPHERE by : Menasoft ©1997-2019
// www.sphereserver.net
// All SPHERE script files and formats are copyright Menasoft & Partners.
// This file may be freely edited for personal use, but may not be distributed
// in whole or in part, in any format without express written permission from
// Menasoft & Partners. All donations and contributions
// become the property of Menasoft & Partners.
//****************************************************************************
// FILE LAST UPDATED: Tuesday, Feb 5, 2019
//
VERSION=0.56d
///////////////////////////
// Some Useful Functions //
///////////////////////////
[FUNCTION f_isHuman]
IF ( (<OBODY>==c_man) || (<OBODY>==c_woman) )
RETURN 1
ENDIF
RETURN 0
[FUNCTION f_isElf]
IF ( (<OBODY>==c_elf_male) || (<OBODY>==c_elf_female) )
RETURN 1
ENDIF
RETURN 0
[FUNCTION f_isGarg]
IF ( (<OBODY>==c_gargoyle_male) || (<OBODY>==c_gargoyle_female) )
RETURN 1
ENDIF
RETURN 0
[FUNCTION f_isFemale]
if (<serv.chardef.<obody>.can>&mt_female) //Checking on chardef directly here because if you change your body your Can flags won't be updated since they are now stored in the char itself when it creates.
return 1
endif
return 0
[FUNCTION f_isCursed]
FORCHARLAYER 32
IF (<BASEID>==i_rune_curse)
RETURN 1
ENDIF
ENDFOR
RETURN 0
[FUNCTION MODMAXHITS]
LOCAL.Result=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
RETURN <EVAL <TAG0.MODMAXHITS>>
ELSE
TAG.MODMAXHITS=<EVAL <TAG0.MODMAXHITS>+<LOCAL.Result>>
IF !(<TAG0.MODMAXHITS>)
TAG.MODMAXHITS=
MAXHITS=
ELSE
MAXHITS=<EVAL <MAXHITS>+<LOCAL.Result>>
ENDIF
ENDIF
[FUNCTION MODMAXSTAM]
LOCAL.Result=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
RETURN <EVAL <TAG0.MODMAXSTAM>>
ELSE
TAG.MODMAXSTAM=<EVAL <TAG0.MODMAXSTAM>+<LOCAL.Result>>
IF !(<TAG0.MODMAXSTAM>)
TAG.MODMAXSTAM=
MAXSTAM=
ELSE
MAXSTAM=<EVAL <MAXSTAM>+<LOCAL.Result>>
ENDIF
ENDIF
[FUNCTION MODMAXMANA]
LOCAL.Result=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
RETURN <EVAL <TAG0.MODMAXMANA>>
ELSE
TAG.MODMAXMANA=<EVAL <TAG0.MODMAXMANA>+<LOCAL.Result>>
IF !(<TAG0.MODMAXMANA>)
TAG.MODMAXMANA=
MAXMANA=
ELSE
MAXMANA=<EVAL <MAXMANA>+<LOCAL.Result>>
ENDIF
ENDIF
////////////
// Events //
////////////
[EVENTS e_Undead]
ON=@EnvironChange
Return 0
// Enter "//" before Return 0, if you want to make script working
// i like the dark
if (<sector.isdark>) || (<flags>& (statf_nightsight|statf_indoors))
if (!<tag0.lightstr>)
return 0
endif
anim 011
bark 4
str=<tag.lightstr> // restore me.
hits=<str>
tag.lightstr=
karma=<tag0.lightkarma>
tag.lightkarma=//just dispose of this.
fame=<tag0.lightfame>
tag.lightfame=
flags ^= statf_conjured // no loot if killed.
return 0
endif
// i can't live in light areas. weaken me ? or destroy me ?
anim 014
bark 4
if (<tag0.lightstr>)
return 0
endif
if ( <flags>&statf_conjured )
remove
return 1
endif
flags |= statf_conjured // no loot if killed.
tag.lightstr=<str>
str=1
hits=1 // very weak.
tag.lightkarma=<karma> // killing it means nothing now.
karma=-2
tag.lightfame=<fame>
fame=10
return 0
[EVENTS e_polymorphed_lich]
ON=@SPELLEFFECT
// Dispell spells will return a polymorphed lich into lich.
IF ((<SERV.SPELL.<ARGN1>.DEFNAME> == s_dispel) || (<SERV.SPELL.<ARGN1>.DEFNAME> == s_mass_dispel))
TRYSRC <I.UID> SRC.EFFECT 2,i_fx_smoke_small,16,10,0
I.BODY = c_lich
I.EVENTS -e_polymorphed_lich
TIMERF <I.TAG.BEHAVIOURDELAY>,I.f_lich_polymorph
ENDIF
RETURN 0
[EVENTS e_lich_death]
// Check for summoned skeletons to remove him.
ON=@DEATH
FOR 0 <EVAL <TAGCOUNT> - 1>
// Loop hover tags. If the value is the UID of a c_skeleton, dispel it.
LOCAL.UID = <TAGAT.<LOCAL._FOR>.VALUE>
IF (<UID.<LOCAL.UID>>)
IF (<UID.<LOCAL.UID>.DEFNAME> == c_skeleton)
UID.<LOCAL.UID>.HITS = 0
ENDIF
ENDIF
ENDFOR
RETURN 0
[EVENTS e_skeleton_summoned_by_lich]
ON=@SPELLEFFECT
// Dispell spells will remove summoned skeletons.
IF ((<SERV.SPELL.<ARGN1>.DEFNAME> == s_dispel) || (<SERV.SPELL.<ARGN1>.DEFNAME> == s_mass_dispel))
I.HITS = 0
ENDIF
RETURN 0
ON=@DEATH
REF1 = <TAG.MASTER>
// First check if c_lich exists.
IF (!<REF1>)
RETURN 0
ENDIF
// We must check if the f_lich_summon_skeletons needs to be invoked.
LOCAL.LIMIT = <REF1.CURFOLLOWER> + <I.FOLLOWERSLOTS>
IF (<LOCAL.LIMIT> > <REF1.MAXFOLLOWER>)
REF1.TIMERF <REF1.TAG.BEHAVIOURDELAY>,f_lich_summon_skeletons
ENDIF
REF1.TAG.SLOT_<I.UID> =
REF1.CURFOLLOWER = <EVAL <REF1.CURFOLLOWER> - <I.FOLLOWERSLOTS>>
RETURN 0
[EVENTS e_Carnivores]
// weak carnivores.
[EVENTS e_Carnivores2]
// normal carnivores.
[EVENTS e_Carnivores3]
// strong carnivores.
[EVENTS e_Terathan]
[EVENTS e_Ophidian]
[EVENTS e_Horses]
[EVENTS e_Notoriety]
[EVENTS e_Ostards]
[EVENTS e_Minotaurs]
[EVENTS e_poisonbite]
//Poison bite attack
ON=@Hit
IF !(<SRC.FLAGS> & statf_poisoned)
SRC.SPELLEFFECT s_poison,<POISONING>,1,<UID>
// SRC.EFFECT 3,i_fx_sparkle,1,16,0,044
// SRC.SOUND snd_spell_poison
ENDIF
[EVENTS e_poisoned_spit]
//Poisoned Spit Defense
ON=@GetHit
REF1=<SRC> // Source of damage
REF2=<UID> // Victim of damage (the spitter)
IF (<MANA> > 15) && (<DISTANCE> > 2) && !(<SRC.FLAGS> & statf_poisoned) && (<REF1> != <REF2>)
MANA -= 15
TRYSRC <REF2> EFFECT 0,i_fx_fireball,10,16,0,044,4
REF1.SPELLEFFECT s_poison,<REF2.POISONING>,<REF2>
REF1.DAMAGE <R15,25> <DEF.dam_poison> <QVAL <REF2>?<REF2>:0>
REF1.SOUND snd_spell_poison
REF1.SYSMESSAGELOC color_text,1070821,<NAME>//"~ spits a poisonous substance at you!"
ENDIF
[EVENTS e_solen_spit]
//Acidic Spit Defense
ON=@GetHit
REF1=<SRC>
REF2=<UID>
IF (<MANA> > 15) && (<DISTANCE> > 2) && (<REF1> != <REF2>)
MANA -= 15
TRYSRC <REF2> EFFECT 0,i_fx_fireball,10,16,0,044,4
REF1.DAMAGE <R15,25> <DEF.dam_acidic> <QVAL <UID>?<UID>:0>
REF1.SYSMESSAGELOC color_text,1071966//"The solen's damaged acid sac squirts acid!"
REF1.SOUND snd_spell_poison
SERV.NEWITEM i_pool_acid
NEW.P=<REF1.P>
NEW.ATTR=attr_decay|attr_move_never
NEW.TIMER={5 10}
NEW.LINK=<UID>
ENDIF
[ITEMDEF i_pool_acid]
ID=021c
NAME=acid pool
TYPE=t_normal
CATEGORY=Monster
SUBSECTION=Attack
DESCRIPTION=Acid Pool
ON=@Create
ATTR=attr_decay|attr_move_never
TIMER={4 8}
ON=@Step
IF (<SRC.ISPLAYER>)
SRC.DAMAGE <R10,15> <DEF.dam_acidic> <QVAL <LINK>?<LINK>:0>
SRC.SYSMESSAGELOC color_text,1077483//"The acid burns you!"
//FIXME: Damage a random equipped item...
ENDIF
[EVENTS e_bleed_attack]
ON=@Hit
//Bleed attack
IF (<MANA> >= 25)&&(RAND(10)==1)
MANA -= 25
SERV.NEWITEM=i_bleed_timer
NEW.LINK=<UID>
SRC.EQUIP <NEW>
ENDIF
[ITEMDEF i_bleed_timer]
//1060202//"*Bleeding*"
ID=0122a
NAME=bleed timer
TYPE=t_eq_script
LAYER=layer_special
WEIGHT=0
ON=@Create
ATTR=attr_decay
MORE1=6
ON=@Equip
ATTR=attr_decay
TIMER=2
ON=@Timer
IF (<CONT>)
IF !(<CONT.HITS>)
MORE1=0
ELSE
MORE1 -= 1
ENDIF
DOSWITCH <MORE1>
BEGIN // MORE1=0
CONT.SYSMESSAGELOC color_text,1060167//"The bleeding wounds have healed, you are no longer bleeding!"
REMOVE
END
BEGIN // MORE1=1
CONT.EMOTE bleed slowly
CONT.DAMAGE {1 2} <DEF.dam_god> <QVAL <LINK>?<LINK>:0>
TIMER=2
END
BEGIN // MORE1=2
CONT.EMOTE bleed slowly
CONT.DAMAGE {2 4} <DEF.dam_god> <QVAL <LINK>?<LINK>:0>
TIMER=2
END
BEGIN // MORE1=3
CONT.EMOTE bleed moderately
CONT.DAMAGE {3 6} <DEF.dam_god> <QVAL <LINK>?<LINK>:0>
TIMER=2
END
BEGIN // MORE1=4
CONT.EMOTE bleed heavily
CONT.DAMAGE {4 9} <DEF.dam_god> <QVAL <LINK>?<LINK>:0>
TIMER=2
END
BEGIN // MORE1=5
CONT.EMOTE bleed profusely
CONT.DAMAGE {5 12} <DEF.dam_god> <QVAL <LINK>?<LINK>:0>
TIMER=2
END
ENDDO
ENDIF
RETURN 1
[ITEMDEF i_summon_mem]
ID=i_rune_summon_creature
NAME=custom summon memory
TYPE=t_spell
LAYER=41
WEIGHT=0
ON=@Create
MOREX=40
MOREY=900
TIMER=20
ATTR=026
[FUNCTION f_NPCRemovalTimer]
SERV.NEWITEM i_removetimer_mem
EQUIP <NEW>
NEW.TIMER=<ARGN1>
[ITEMDEF i_removetimer_mem]
ID=i_memory
NAME=remove timer
TYPE=t_eq_script
ON=@Timer
CONT.REMOVE
RETURN 1
[ITEMDEF i_mem_vicious_bite]
ID=0e23
NAME=Vicious bite memory
TYPE=t_eq_script
LAYER=layer_special
WEIGHT=0
ON=@Create
ATTR=attr_decay
TIMER=2
ON=@Timer
IF (<MORE1> > 0)
MORE1 -= 1
CONT.DAMAGE 5 <DEF.dam_poison> <QVAL <LINK>?<LINK>:0>
CONT.SYSMESSAGELOC color_text,1112473//"Your vicious wound is festering!"
TIMER=20
RETURN 1
ENDIF
[ITEMDEF i_blockheal_timer]
//
// Ideally Healing Spells and Bandages should look for this timer and prevent
// the healing attempt.
//
ID=i_bandage
NAME=block heal timer
TYPE=t_eq_script
LAYER=layer_special
WEIGHT=0
ON=@Equip
ATTR=attr_decay
IF (<CONT.NPC>)
MORE1=12
ELSE
MORE1=6
ENDIF
TIMER=1
ON=@Timer
IF (<MORE1>) && !(<CONT.FLAGS> & statf_dead)
CONT.ACTION = -1 //stop all actions
MORE1 -= 1
TIMER=1
ELSE
CONT.SYSMESSAGELOC color_text,1060208//"You are no longer mortally wounded."
REMOVE
ENDIF
RETURN 1
[ITEMDEF i_parablow_timer]
ID=01d8c
NAME=paralyzing blow timer
TYPE=t_eq_script
LAYER=layer_special
WEIGHT=0
ON=@Equip
ATTR=attr_decay
IF (<CONT.NPC>)
MORE1=6
ELSE
MORE1=3
ENDIF
CONT.SYSMESSAGELOC color_text,1072221//"You have been hit by a paralyzing blow."
TIMER=1
ON=@Timer
IF (<MORE1>) && !(<CONT.FLAGS> & statf_dead)
CONT.ACTION = -1 //stop all actions
CONT.FLAGS |= statf_freeze
MORE1 -= 1
TIMER=1
ELSE
CONT.FLAGS &= ~statf_freeze
REMOVE
ENDIF
RETURN 1
[EVENTS e_angry_fire]
[EOF]