Code: Select all
2018-04-23 23:02:44: ERROR[Main]: ModError: Failed to load and run script from /home/user/.minetest/mods/medicine/init.lua:
2018-04-23 23:02:44: ERROR[Main]: ...e/user/.minetest/mods/medicine/effects_and_illnesses.lua:1: '=' expected near 'minetest'
2018-04-23 23:02:44: ERROR[Main]: stack traceback:
2018-04-23 23:02:44: ERROR[Main]: [C]: in function 'dofile'
2018-04-23 23:02:44: ERROR[Main]: /home/user/.minetest/mods/medicine/init.lua:6: in main chunk
Code: Select all
function minetest.register_poisoning_effect(player, pos, effect_time) -- line:1
player:set_physics_override({
speed = 0.4,
jump = 0.4})
minetest.hud_replace_builtin({
hud_elem_type = "statbar",
position = {x = 0.5, y = 1},
text = "poisonous_heart.png",
number = core.PLAYER_MAX_HP_DEFAULT,
direction = 0,
size = {x = 24, y = 24},
offset = {x = (-10*24) - 25, y = -(48 + 24 + 16)},
}

minetest.add_particlespawner(amount = effect_time / 0.5,
time = effect_time,
min_pos = {x = pos.x + 0.5, y = pos.y, z = pos.z + 0.5},
max_pos = min_pos,
min_vel = 0.5,
max_vel = 0.5,
min_acc = 0,
max_acc = 0,
minexptime = effect_time,
maxexptime = effect_time,
minsize = 0.4,
maxsize = 0.4,
colissiondetection = true,
vertical = true,
texture = "poisonous_effect.png"
})
minetest.add_particlespawner(amount = effect_time / 0.5,
time = effect_time,
min_pos = {x = pos.x - 0.5, y = pos.y, z = pos.z + 0.5},
max_pos = min_pos,
min_vel = 0.5,
max_vel = 0.5,
min_acc = 0,
max_acc = 0,
minexptime = effect_time,
maxexptime = effect_time,
minsize = 0.4,
maxsize = 0.4,
colissiondetection = true,
vertical = true,
texture = "poisonous_effect.png"
})
minetest.add_particlespawner(amount = effect_time / 0.5,
time = effect_time,
min_pos = {x = pos.x + 0.5, y = pos.y, z = pos.z - 0.5},
max_pos = min_pos,
min_vel = 0.5,
max_vel = 0.5,
min_acc = 0,
max_acc = 0,
minexptime = effect_time,
maxexptime = effect_time,
minsize = 0.4,
maxsize = 0.4,
colissiondetection = true,
vertical = true,
texture = "poisonous_effect.png"
})
minetest.add_particlespawner(amount = effect_time / 0.5,
time = effect_time,
min_pos = {x = pos.x - 0.5, y = pos.y, z = pos.z - 0.5},
max_pos = min_pos,
min_vel = 0.5,
max_vel = 0.5,
min_acc = 0,
max_acc = 0,
minexptime = effect_time,
maxexptime = effect_time,
minsize = 0.4,
maxsize = 0.4,
colissiondetection = true,
vertical = true,
texture = "poisonous_effect.png"
})
for i = 1, effect_time do
minetest.after(1, function (i, pos)
if i // 2 == 0 then
for h = 1, 3 do
if h == 1 then
minetest.after(0.1, minetest.add_particle({pos1 = {x = pos.x, y = pos.y, z = pos.z - 0.3},
velocity = {x = pos1.x, y = pos1.y + 0.4, z = pos1.z},
acceleration = nil,
expirationtime = 0.2,
size = 0.9,
collisiondetection = true,
collision_removal = true,
vertical = true,
glow = 0,
texture = "vomiting_1.png"
})
elseif h == 2 then
minetest.after(0.1, minetest.add_particle({pos1 = {x = pos.x, y = pos.y, z = pos.z - 0.3},
velocity = {x = pos1.x, y = pos1.y + 0.4, z = pos1.z},
acceleration = nil,
expirationtime = 0.2,
size = 0.9,
collisiondetection = true,
collision_removal = true,
vertical = true,
glow = 0,
texture = "vomiting_2.png"
})
elseif h == 3 then
minetest.after(0.1, minetest.add_particle({pos1 = {x = pos.x, y = pos.y, z = pos.z - 0.3},
velocity = {x = pos1.x, y = pos1.y + 0.4, z = pos1.z},
acceleration = nil,
expirationtime = 0.2,
size = 0.9,
collisiondetection = true,
collision_removal = true,
vertical = true,
glow = 0,
texture = "vomiting_3.png"
})
end
end
end
end
end
player:set_physics_override({
speed = 1.0,
jump = 1.0})
minetest.hud_replace_builtin({
hud_elem_type = "statbar",
position = {x = 0.5, y = 1},
text = "heart.png",
number = core.PLAYER_MAX_HP_DEFAULT,
direction = 0,
size = {x = 24, y = 24},
offset = {x = (-10*24) - 25, y = -(48 + 24 + 16)},
})
end
Also, if i have any other mistakes in this code?
And here you can download my file with the code: