-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
202 lines (155 loc) · 7.32 KB
/
main.lua
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
meta.name = 'JunkyLunky Script'
meta.version = '1.0'
meta.description = 'Performs Junky Scripts (Sounds, Textures, etc.)'
meta.author = 'Trixelized, Vissa'
-- Thanks @Trixelized
pre_spiritwhip = create_sound('custom_sounds/pre_spiritattack.wav')
spiritwhip = create_sound('custom_sounds/spiritattack.wav')
pre_chainwhip = create_sound('custom_sounds/whipchain_a1.wav')
chainwhip = create_sound('custom_sounds/whipchain_b1.wav')
roffy_character_id = 4
alto_character_id = 5
dirk_character_id = 18
-- the whip sound is split into two different vanilla sounds, one when pulling out the whip
set_vanilla_sound_callback(VANILLA_SOUND.PLAYER_WHIP1, VANILLA_SOUND_CALLBACK_TYPE.STARTED, function(whip_sound)
if whip_sound:get_parameter(VANILLA_SOUND_PARAM.PLAYER_CHARACTER) == roffy_character_id then
whip_sound:stop() -- stop the original sound
local pre_chainwhip_playing = pre_chainwhip:play(true) -- play our own sound
pre_chainwhip_playing:set_volume(0.7) -- though it's a bit loud, so tune it down just a bit
pre_chainwhip_playing:set_pitch(math.random()*0.2+0.85)
pre_chainwhip_playing:set_pause(false) -- and unpause it
end
if whip_sound:get_parameter(VANILLA_SOUND_PARAM.PLAYER_CHARACTER) == alto_character_id then
whip_sound:stop() -- stop the original sound
local pre_spiritwhip_playing = pre_spiritwhip:play(true) -- play our own sound
pre_spiritwhip_playing:set_volume(0.65) -- though it's a bit loud, so tune it down just a bit
pre_spiritwhip_playing:set_pitch(math.random()*0.2+0.9)
pre_spiritwhip_playing:set_pause(false) -- and unpause it
end
end)
-- and one when swinging it
set_vanilla_sound_callback(VANILLA_SOUND.PLAYER_WHIP2, VANILLA_SOUND_CALLBACK_TYPE.STARTED, function(whip_sound)
if whip_sound:get_parameter(VANILLA_SOUND_PARAM.PLAYER_CHARACTER) == roffy_character_id then
whip_sound:stop()
local chainwhip_playing = chainwhip:play(true)
chainwhip_playing:set_volume(0.9)
chainwhip_playing:set_pitch(math.random()*0.2+0.8)
chainwhip_playing:set_pause(false)
end
if whip_sound:get_parameter(VANILLA_SOUND_PARAM.PLAYER_CHARACTER) == alto_character_id then
whip_sound:stop()
local spiritwhip_playing = spiritwhip:play(true)
spiritwhip_playing:set_volume(0.85)
spiritwhip_playing:set_pitch(math.random()*0.1+0.95)
spiritwhip_playing:set_pause(false)
end
if whip_sound:get_parameter(VANILLA_SOUND_PARAM.PLAYER_CHARACTER) == dirk_character_id then
whip_sound:set_pitch(1.5+math.random())
end
end)
--[[
Random shoppie code! By Trixelized
--]]
local texture_def = get_texture_definition(TEXTURE.DATA_TEXTURES_MONSTERSBASIC01_0)
texture_def.texture_path = "custom_textures/custom_shoppie_01.png"
shoppie_tex_01 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_02.png"
shoppie_tex_02 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_03.png"
shoppie_tex_03 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_04.png"
shoppie_tex_04 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_05.png"
shoppie_tex_05 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_06.png"
shoppie_tex_06 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_07.png"
shoppie_tex_07 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_08.png"
shoppie_tex_08 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_09.png"
shoppie_tex_09 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_10.png"
shoppie_tex_10 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_11.png"
shoppie_tex_11 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_12.png"
shoppie_tex_12 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_13.png"
shoppie_tex_13 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_14.png"
shoppie_tex_14 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_15.png"
shoppie_tex_15 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_shoppie_16.png"
shoppie_tex_16 = define_texture(texture_def)
texture_def.texture_path = "custom_textures/custom_skeleton.png"
skeleton_text = define_texture(texture_def)
texture_def = get_texture_definition(TEXTURE.DATA_TEXTURES_MONSTERS01_0)
texture_def.texture_path = "custom_textures/custom_lizard.png"
lizard_text = define_texture(texture_def)
set_callback(function()
local shoppies = get_entities_by_type(ENT_TYPE.MONS_SHOPKEEPER)
for s, shoppie in ipairs(shoppies) do
local r_tex = math.random(16)+1
--message("n: " .. tostring(r_tex))
if r_tex == 1 then
-- simply don't change the texture
elseif r_tex == 2 then
get_entity(shoppie):set_texture(shoppie_tex_01)
elseif r_tex == 3 then
get_entity(shoppie):set_texture(shoppie_tex_02)
elseif r_tex == 4 then
get_entity(shoppie):set_texture(shoppie_tex_03)
elseif r_tex == 5 then
get_entity(shoppie):set_texture(shoppie_tex_04)
elseif r_tex == 6 then
get_entity(shoppie):set_texture(shoppie_tex_05)
elseif r_tex == 7 then
get_entity(shoppie):set_texture(shoppie_tex_06)
elseif r_tex == 8 then
get_entity(shoppie):set_texture(shoppie_tex_07)
elseif r_tex == 9 then
get_entity(shoppie):set_texture(shoppie_tex_08)
elseif r_tex == 10 then
get_entity(shoppie):set_texture(shoppie_tex_09)
elseif r_tex == 11 then
get_entity(shoppie):set_texture(shoppie_tex_10)
elseif r_tex == 12 then
get_entity(shoppie):set_texture(shoppie_tex_11)
elseif r_tex == 13 then
get_entity(shoppie):set_texture(shoppie_tex_12)
elseif r_tex == 14 then
get_entity(shoppie):set_texture(shoppie_tex_13)
elseif r_tex == 15 then
get_entity(shoppie):set_texture(shoppie_tex_14)
elseif r_tex == 16 then
get_entity(shoppie):set_texture(shoppie_tex_15)
elseif r_tex == 17 then
get_entity(shoppie):set_texture(shoppie_tex_16)
end
--[[
if r_tex == 1 then
-- simply don't change the texture
elseif r_tex == 2 then
get_entity(shoppie):set_texture(shoppie_tex_1)
elseif r_tex == 3 then
get_entity(shoppie):set_texture(shoppie_tex_2)
end
]]
end
local skeletons = get_entities_by_type(ENT_TYPE.MONS_SKELETON)
for s, skeleton in ipairs(skeletons) do
local r_tex = math.random(50)
if r_tex == 1 then
get_entity(skeleton):set_texture(skeleton_text)
end
end
local lizards = get_entities_by_type(ENT_TYPE.MONS_HORNEDLIZARD)
for s, lizard in ipairs(lizards) do
local r_tex = math.random(3)
if r_tex == 1 then
get_entity(lizard):set_texture(lizard_text)
end
end
end, ON.POST_LEVEL_GENERATION)