Skip to content

Commit cbd9f42

Browse files
committed
Closes #125
- Acid lance throw ability transfers to new thrown location if it is already summoned - - Also refreshes duration when transferred to new location
1 parent 6051596 commit cbd9f42

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

scripts/items/proj_pole_a.script

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
const PROJ_AOE_FALLOFF 0
2121
const PROJ_STICK_DURATION 0 //Don't stick in enemies
2222
const PROJ_COLLIDE 1
23+
24+
const PROJ_CLOUD_DURATION 20.0
2325
}
2426

2527
#include items/proj_arrow_base
@@ -116,5 +118,19 @@
116118
dbg game_projectile_landed MY_ORG
117119
local GROUND_Z $get_ground_height(MY_ORG)
118120
vectorset MY_ORG z GROUND_Z
119-
createnpc monsters/summon/affliction_lance MY_ORG $get(ent_expowner,id) MY_ORG $get(ent_me,angles)
121+
122+
//ent_expowner
123+
//
124+
//scriptflags <target> add <name> <type> [value:1] [expiretime:-1] [expiremsg:none]
125+
//$get_scriptflag(<target>,<type>,type_exists) - returns 1 if <type> found
126+
127+
local L_FX_ID $get_scriptflag(ent_expowner,pole_a,name_value)
128+
if ( L_FX_ID isnot 'none' )
129+
{
130+
callexternal L_FX_ID transfer_location MY_ORG
131+
}
132+
else
133+
{
134+
createnpc monsters/summon/affliction_lance MY_ORG $get(ent_expowner,id) MY_ORG $get(ent_me,angles) PROJ_CLOUD_DURATION //<ownerId> <origin> <angles> <duration>
135+
}
120136
}

scripts/monsters/summon/affliction_lance.script

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
const AOE_RADIUS 255
3-
const AOE_DURATION 20.0
3+
//const AOE_DURATION 20.0
44
const AOE_SCAN_FREQ 1.0
55
const AOE_VADJ 32
66
const AOE_AFFECTS_WARY 1
77
}
88

99
{ game_spawn
10+
1011
setmodel weapons/projectiles.mdl
1112
setmodelbody 0 70
1213
nopush 1
@@ -20,21 +21,24 @@
2021
fly 1
2122
invincible 1
2223
gravity 0
23-
setangle face $vec(270,0,0)
24+
//setangle face $vec(270,0,0)
2425
}
2526

2627
#include monsters/summon/base_aoe2
2728

28-
{ game_dynamically_created //<owner> <origin> <pitch>
29+
{ game_dynamically_created //<owner> <origin> <pitch> <duration>
2930

3031
dbg game_dynamically_created $get(PARAM1,name) PARAM2
3132

3233
setvard MY_OWNER PARAM1
3334
local SPAWN_ORG PARAM2
35+
setvard AOE_DURATION PARAM4
3436
vectoradd SPAWN_ORG z 32
3537
setorigin ent_me SPAWN_ORG
3638
setidleanim axis_spin
3739
playanim once axis_spin
40+
41+
scriptflags MY_OWNER add pole_a "Affliction Lance" $get(ent_me,id) AOE_DURATION
3842

3943
setvard CUR_PITCH $vec.pitch(PARAM3)
4044
//subtract CUR_PITCH 360
@@ -48,6 +52,8 @@
4852
svplaysound 1 10 ambience/steamjet1.wav
4953

5054
clientevent new all monsters/summon/affliction_lance_cl $get(ent_me,index) 19.0
55+
setvard MY_FX game.script.last_sent_id
56+
setvard MY_END_TIME $math(add,game.time,AOE_DURATION)
5157
}
5258

5359
{ fix_pitch_loop
@@ -72,7 +78,30 @@
7278
applyeffect PARAM1 effects/effect_poison 5.0 MY_OWNER DOT_POISON
7379
}
7480

75-
{ aoe_end
76-
svplaysound 1 0 ambience/steamjet1.wav
77-
deleteent ent_me fade
81+
{ [override] aoe_end
82+
83+
if ( game.time >= MY_END_TIME )
84+
{
85+
setvard AOE_ACTIVE 0
86+
svplaysound 1 0 ambience/steamjet1.wav
87+
deleteent ent_me fade
88+
}
89+
else
90+
{
91+
callevent 1 aoe_end
92+
}
93+
}
94+
95+
{ transfer_location //<newLocationVector>
96+
97+
local L_NEW_POS PARAM1
98+
99+
setvard MY_END_TIME $math(add,game.time,AOE_DURATION) //Resets the duration
100+
clientevent update all MY_FX keep_on //Resets duration of client effect
101+
102+
vectoradd L_NEW_POS z 32
103+
setorigin ent_me L_NEW_POS
104+
105+
scriptflags MY_OWNER edit pole_a "Affliction Lance" $get(ent_me,id) AOE_DURATION
106+
//scriptflags <target> edit <name> <type> <value> [expiretime] [msg] - edits properties of first flag found with this name
78107
}

scripts/monsters/summon/affliction_lance_cl.script

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
setvard FX_DURATION PARAM2
44

55
setvard FX_ACTIVE 1
6-
callevent FX_DURATION end_fx
76
setvard FX_ANGS 0
7+
8+
setvard END_TIME $math(add,game.time,FX_DURATION)
89
callevent fx_loop
910
}
1011

1112
{ end_fx
13+
14+
repeatdelay 1.0
15+
if game.time >= END_TIME
16+
setvard FX_ACTIVE 0
1217
callevent 2.0 remove_fx
1318
}
1419

@@ -54,4 +59,9 @@
5459
cleffect tempent set_current_prop velocity CLOUD_VEL
5560
cleffect tempent set_current_prop collide none
5661
cleffect tempent set_current_prop fadeout lifetime
62+
}
63+
64+
{ keep_on
65+
66+
setvard END_TIME $math(add,game.time,FX_DURATION)
5767
}

0 commit comments

Comments
 (0)