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
Smoke = {}
Smoke.Duration = 15
Smoke.Radius = 3
Smoke.Static = 4
Smoke.TotalObj = Smoke.Radius*Smoke.Static + 1
Smoke.Table = {}
Smoke.HookFunctions = {}
addhook('projectile_impact','Smoke.HookFunctions.projectile_impact')
Smoke.HookFunctions.projectile_impact = function(id, weapon, x, y, mode, projectileid)
if mode==100 then
if weapon == 53 then
timer(2,'parse','freeprojectile '..projectileid..' '..id)
local Sx = math.floor(x/32)
local Sy = math.floor(y/32)
if Smoke.Table[projectileid] then
repeat projectileid = projectileid + 1
until
not Smoke.Table[projectileid]
end
Smoke.Table[projectileid] = {
SmokeStartx = Sx,
SmokeStarty = Sy,
Radius = Smoke.Radius,
TotalObj = Smoke.TotalObj,
ImageTable = {},
Smoke_Dur = Smoke.Duration,
ProjectId = projectileid,
Floor = image('gfx/mora/Smoke/Smoke_floor.png',x,y,0)
}
local SmokeIndex = Smoke.Table[projectileid].ImageTable
SmokeIndex[Smoke.Table[projectileid].TotalObj] = {
X = Sx,
Y = Sy,
image = image("incbin::incbindata/smokepuff"..math.random(0,3)..".bmp<a>",((Sx*32)+16),((Sy*32)+16),3),
duration = Smoke.Duration,
ProjectId = projectileid
}
newIndex = Smoke.Table[projectileid].ImageTable[Smoke.Table[projectileid].TotalObj]
imagealpha(newIndex.image,0.0)
tween_scale(newIndex.image,1000,1.5 + (math.random(10,100)*0.01),1.5 + (math.random(10,100)*0.01))
tween_alpha(newIndex.image,1000,math.random(60,100)*0.01)
local rndm = math.random(50,200)
tween_color(newIndex.image,3000,rndm,rndm,rndm)
imagehitzone(newIndex.image,1,-16,-16,32,32)
Smoke.Table[projectileid].TotalObj = Smoke.Table[projectileid].TotalObj - 1
tween_rotateconstantly(newIndex.image,math.random(-1,1))
Smoke.PuffFunction(projectileid)
end
end
end
addhook('hitzone','Smoke.HookFunctions.hitzone')
Smoke.HookFunctions.hitzone = function(image_id,player_id,object_id,weapon,impactx,impacty,damage)
imagealpha(image_id,0.0)
tween_alpha(image_id,5000,math.random(60,100)*0.01)
end
Smoke.PuffFunction = function(projectileid)
local NoWayInAllDirections = false
local NoWayDirection = false
local Side = 3
local SmokeIndex = Smoke.Table[projectileid]
local TotalObjCurrently = SmokeIndex.TotalObj
for i = 1, TotalObjCurrently do
if NoWayInAllDirections~=true then
if Side - 1 < 0 then
NoWayInAllDirections=true
break
end
if NoWayDirection == false then
for i = 0,Side do
local Dot = Smoke.DirectionCheck(i, SmokeIndex.SmokeStartx, SmokeIndex.SmokeStarty, SmokeIndex, projectileid)
if Dot then
NoWayDirection = Dot
end
end
end
Side = Side - 1
end
end
end
Smoke.DirectionCheck = function(Side, xx, yy, SmokeIndex, smoke_key)
local Dir_tile = "UP"
local Moverx = xx
local Movery = yy-1
if Side == 1 then
Dir_tile = "RIGHT"
Moverx = xx+1
Movery = yy
elseif Side == 2 then
Dir_tile = "DOWN"
Moverx = xx
Movery = yy+1
elseif Side == 3 then
Dir_tile = "LEFT"
Moverx = xx-1
Movery = yy
end
local allower = false
if SmokeIndex then
for k,v in pairs(SmokeIndex.ImageTable) do
if v.image == objectat(Moverx,Movery,40) then
allower = true
break
end
end
end
if not tile(Moverx,Movery,'wall') then
if not allower then
SmokeIndex.ImageTable[SmokeIndex.TotalObj] = {
X = x,
Y = y,
image = image("incbin::incbindata/smokepuff"..math.random(0,3)..".bmp<a>",((Moverx*32)+16),((Movery*32)+16),3),
duration = Smoke.Duration,
ProjectId = smoke_key
}
imagealpha(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,0.0)
tween_alpha(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,1000,math.random(60,100)*0.01)
tween_scale(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,1000,1.5 + (math.random(10,100)*0.01),1.5 + (math.random(10,100)*0.01))
local rndm = math.random(100,200)
tween_color(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,3000,rndm,rndm,rndm)
imagehitzone(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,1,-16,-16,32,32)
tween_rotateconstantly(SmokeIndex.ImageTable[SmokeIndex.TotalObj].image,math.random(-1,1))
SmokeIndex.TotalObj = SmokeIndex.TotalObj - 1
else
return true
end
else
return true
end
local newIndex = Smoke.Table[SmokeIndex.ProjectId]
if newIndex.TotalObj>=1 then
for q = 0,3 do
timer(5*newIndex.TotalObj,"parse",'lua Smoke.DirectionCheck('..q..','..Moverx..','..Movery..',Smoke.Table['..SmokeIndex.ProjectId..'],'..SmokeIndex.TotalObj..')')
end
end
end
addhook('second','Smoke.HookFunctions.second')
Smoke.HookFunctions.second = function()
for key, value in pairs(Smoke.Table) do
Smoke.HookFunctions.InTableCheck(value.ImageTable)
if value.Smoke_Dur - 1 > 5 then
value.Smoke_Dur = value.Smoke_Dur - 1
parse("effect \"smoke\" " .. object(value.Floor,"x") .. " " .. object(value.Floor,"y") .. " 2 2")
elseif value.Smoke_Dur - 1 == 5 then
parse("effect \"smoke\" " .. object(value.Floor,"x") .. " " .. object(value.Floor,"y") .. " 2 2")
value.Smoke_Dur = 3
tween_alpha(Smoke.Table[key].Floor,5000,0.0)
timer(5000,"parse",'lua freeimage('..value.Floor..')')
timer(5001,"parse",'lua Smoke.Table['..key..']=nil')
end
end
end
addhook('startround','Smoke.HookFunctions.startround')
Smoke.HookFunctions.startround = function(mode)
for key, value in pairs(Smoke.Table) do
Smoke.HookFunctions.InTableCheck(value.ImageTable,true)
Smoke.Table[key] = nil
end
Smoke.Table = {}
end
addhook('endround','Smoke.HookFunctions.endround')
Smoke.HookFunctions.endround = function(mode, delay)
for key, value in pairs(Smoke.Table) do
Smoke.HookFunctions.InTableCheck(value.ImageTable,true)
Smoke.Table[key] = nil
end
Smoke.Table = {}
end
Smoke.HookFunctions.InTableCheck = function(ImageTable_Index,mode)
if mode then
for k, v in pairs(ImageTable_Index) do
freeimage(v.image)
end
return
end
for k, v in pairs(ImageTable_Index) do
if v.duration - 1 > 5 then
v.duration = v.duration - 1
local rndm = math.random(100,200)
tween_color(v.image,1000,rndm,rndm,rndm)
tween_alpha(v.image,1000,math.random(60,100)*0.01)
tween_rotateconstantly(v.image,math.random(-1,1))
elseif v.duration - 1 == 5 then
v.duration = 4
tween_alpha(v.image,3500,0.0)
timer(3500,"parse",'lua freeimage('..v.image..')')
end
end
end