Error after i modified the code of the spider from mobs_monster

Post Reply
User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

So i was trying to make a tameable spider for mobs_monster using the code given by the creator and i copy and pasted it into a lua file,added the details to init file and the spawn example file but when i load in a world it gives an error, please help!

here's the terminal code:
2021-09-10 14:50:00: WARNING[Main]: system-wide share not found at "/share/minetest"
2021-09-10 14:50:00: WARNING[Main]: system-wide share found at "/snap/minetest/1744/bin/../share/minetest"
2021-09-10 14:50:00: WARNING[Main]: Couldn't find a locale directory!
2021-09-10 14:50:03: WARNING[Main]: Could not load icon file '/share/icons/hicolor/128x128/apps/minetest.png'
2021-09-10 14:50:03: WARNING[Main]: Could not load icon file '/snap/minetest/1744/bin/../share/minetest/misc/minetest-xorg-icon-128.png'
Loaded texture: /snap/minetest/1744/share/minetest/games/devtest/screenshot.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
Loaded texture: /snap/minetest/1744/share/minetest/games/devtest/menu/icon.png
Loaded texture: /home/username/snap/minetest/1744/games/mineclone2/menu/icon.png
Loaded texture: /home/username/snap/minetest/1744/games/mineclone5/menu/icon.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/icon.png
Loaded texture: /snap/minetest/1744/share/minetest/textures/base/pack/plus.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
2021-09-10 14:54:09: ACTION[Main]: [MOD] Mobs Redo loaded
2021-09-10 14:54:10: ACTION[Main]: [Mod] Mobs Skeletons [v0.2.0] loaded.
2021-09-10 14:54:10: ERROR[Main]: ModError: Failed to load and run script from /home/username/snap/minetest/1744/.minetest/games/minetest_game/mods/mobs_monster/init.lua:
2021-09-10 14:54:10: ERROR[Main]: ...st/games/minetest_game/mods/mobs_monster/spider_tame.lua:110: function arguments expected near ':'
2021-09-10 14:54:10: ERROR[Main]: stack traceback:
2021-09-10 14:54:10: ERROR[Main]: [C]: in function 'dofile'
2021-09-10 14:54:10: ERROR[Main]: ....minetest/games/minetest_game/mods/mobs_monster/init.lua:33: in main chunk
2021-09-10 14:54:10: ERROR[Main]: Check debug.txt for details.
2021-09-10 14:54:10: ACTION[Main]: Server: Shutting down
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
cdb_55e935e0b607

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: Error after i modified the code of the spider from mobs_monster

by j0j0n4th4n » Post

What is in the file spider_tame.lua? Specially the block around line 110?
cdb_894a100ddd76

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

j0j0n4th4n wrote:
Fri Sep 10, 2021 11:19
What is in the file spider_tame.lua? Specially the block around line 110?
},
water_damage = 5,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 20,
stand_start = 0,
stand_end = 0,
walk_start = 1,
walk_end = 21,
run_start = 1,
run_end = 21,
punch_start = 25,
punch_end = 45,
},

on_rightclick = function(self, clicker)

local tool = clicker:get_wielded_item()

if tool:get_name() == "mobs:meat_raw" then

clicker:get_inventory:remove_item("main", "mobs:meat_raw")

local pet = minetest.add_entity(self.object:get_pos(),
"mobs_monster:spider_pet")

local ent = pet:get_luaentity()
ent.owner = clicker:get_player_name()
self.object:remove()
end
end
})
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

j0j0n4th4n wrote:
Fri Sep 10, 2021 11:19
What is in the file spider_tame.lua? Specially the block around line 110?
here's the full code
mobs:register_mob("mobs_monster:spider_tame", {
docile_by_day = true,
group_attack = true,
type = "npc",
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 3,
hp_min = 10,
hp_max = 30,
armor = 200,
collisionbox = {-0.8, -0.5, -0.8, 0.8, 0, 0.8},
visual_size = {x = 1, y = 1},
visual = "mesh",
mesh = "mobs_spider.b3d",
textures = {
{"mobs_spider_mese.png"},
{"mobs_spider_orange.png"},
{"mobs_spider_snowy.png"},
{"mobs_spider_grey.png"},
{"mobs_spider_crystal.png"},
},
makes_footstep_sound = false,
sounds = {
random = "mobs_spider",
attack = "mobs_spider",
},
walk_velocity = 1,
run_velocity = 3,
jump = true,
view_range = 15,
floats = 0,
drops = {
{name = "farming:string", chance = 1, min = 0, max = 2},
},
water_damage = 5,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 20,
stand_start = 0,
stand_end = 0,
walk_start = 1,
walk_end = 21,
run_start = 1,
run_end = 21,
punch_start = 25,
punch_end = 45,
}
})

mobs:register_mob("mobs_monster:spider", {
docile_by_day = true,
group_attack = true,
type = "monster",
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 3,
hp_min = 10,
hp_max = 30,
armor = 200,
collisionbox = {-0.8, -0.5, -0.8, 0.8, 0, 0.8},
visual_size = {x = 1, y = 1},
visual = "mesh",
mesh = "mobs_spider.b3d",
textures = {
{"mobs_spider_mese.png"},
{"mobs_spider_orange.png"},
{"mobs_spider_snowy.png"},
{"mobs_spider_grey.png"},
{"mobs_spider_crystal.png"},
},
makes_footstep_sound = false,
sounds = {
random = "mobs_spider",
attack = "mobs_spider",
},
walk_velocity = 1,
run_velocity = 3,
jump = true,
view_range = 15,
floats = 0,
drops = {
{name = "farming:string", chance = 1, min = 0, max = 2},
},
water_damage = 5,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 20,
stand_start = 0,
stand_end = 0,
walk_start = 1,
walk_end = 21,
run_start = 1,
run_end = 21,
punch_start = 25,
punch_end = 45,
},

on_rightclick = function(self, clicker)

local tool = clicker:get_wielded_item()

if tool:get_name() == "mobs:meat_raw" then

clicker:get_inventory:remove_item("main", "mobs:meat_raw")

local pet = minetest.add_entity(self.object:get_pos(),
"mobs_monster:spider_pet")

local ent = pet:get_luaentity()
ent.owner = clicker:get_player_name()
self.object:remove()
end
end
})
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

umm
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

hello?
cdb_55e935e0b607

User avatar
ywwv
Member
Posts: 299
Joined: Mon Jan 18, 2021 11:51

Re: Error after i modified the code of the spider from mobs_monster

by ywwv » Post

FrostTheLionCat wrote:
Fri Sep 10, 2021 13:17
hello?
hi

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

ywwv wrote:
Fri Sep 10, 2021 13:48
FrostTheLionCat wrote:
Fri Sep 10, 2021 13:17
hello?
hi
i need help
cdb_55e935e0b607

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by TenPlus1 » Post

Backup your original spider.lua file and replace it with the one inside the zip file which lets you tame a spider by right-clicking it with 5x raw meat:
Attachments
spider.zip
(1.37 KiB) Downloaded 39 times

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

so i should delete the spider_tame file?
alright then
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

OH YEAH BOIII I TAMED A SPIDER!!!
I DON'T KNOW HOW MUCH I SHOULD THANK YOU!!!!
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

oh no i can't heal it sadly :(
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

how do i add a healing feature?
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

TenPlus1 wrote:
Fri Sep 10, 2021 14:13
Backup your original spider.lua file and replace it with the one inside the zip file which lets you tame a spider by right-clicking it with 5x raw meat:
how do i add healing feature?
cdb_55e935e0b607

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by TenPlus1 » Post

For the mobs_animal:spider_tame mob definition, add these lines:

Code: Select all

follow = {"mobs:meat_raw},
on_rightclick = function(self, clicker)
	if mobs:feed_tame(self, clicker, 5, false, true) then return end
end

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by 56independent_actual » Post

Before OP goes on any more, i seriously suggest they read this article before they move on (do not ask the writers your question!).
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

TenPlus1 wrote:
Fri Sep 10, 2021 15:35
For the mobs_animal:spider_tame mob definition, add these lines:

Code: Select all

follow = {"mobs:meat_raw},
on_rightclick = function(self, clicker)
	if mobs:feed_tame(self, clicker, 5, false, true) then return end
end
Thank you very much
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

TenPlus1 wrote:
Fri Sep 10, 2021 15:35
For the mobs_animal:spider_tame mob definition, add these lines:

Code: Select all

follow = {"mobs:meat_raw},
on_rightclick = function(self, clicker)
	if mobs:feed_tame(self, clicker, 5, false, true) then return end
end

Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
2021-09-11 15:18:40: ACTION[Main]: [MOD] Mobs Redo loaded
2021-09-11 15:18:40: ACTION[Main]: [Mod] Mobs Skeletons [v0.2.0] loaded.
2021-09-11 15:18:40: ERROR[Main]: ModError: Failed to load and run script from /home/username/snap/minetest/1744/.minetest/games/minetest_game/mods/mobs_monster/init.lua:
2021-09-11 15:18:40: ERROR[Main]: ...inetest/games/minetest_game/mods/mobs_monster/spider.lua:110: '}' expected (to close '{' at line 56) near 'local'
2021-09-11 15:18:40: ERROR[Main]: stack traceback:
2021-09-11 15:18:40: ERROR[Main]: [C]: in function 'dofile'
2021-09-11 15:18:40: ERROR[Main]: ....minetest/games/minetest_game/mods/mobs_monster/init.lua:30: in main chunk
2021-09-11 15:18:40: ERROR[Main]: Check debug.txt for details.
2021-09-11 15:18:40: ACTION[Main]: Server: Shutting down
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
cdb_55e935e0b607

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by 56independent_actual » Post

FrostTheLionCat wrote:
Sat Sep 11, 2021 09:47
TenPlus1 wrote:
Fri Sep 10, 2021 15:35
For the mobs_animal:spider_tame mob definition, add these lines:

Code: Select all

follow = {"mobs:meat_raw},
on_rightclick = function(self, clicker)
	if mobs:feed_tame(self, clicker, 5, false, true) then return end
end

Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
2021-09-11 15:18:40: ACTION[Main]: [MOD] Mobs Redo loaded
2021-09-11 15:18:40: ACTION[Main]: [Mod] Mobs Skeletons [v0.2.0] loaded.
2021-09-11 15:18:40: ERROR[Main]: ModError: Failed to load and run script from /home/username/snap/minetest/1744/.minetest/games/minetest_game/mods/mobs_monster/init.lua:
2021-09-11 15:18:40: ERROR[Main]: ...inetest/games/minetest_game/mods/mobs_monster/spider.lua:110: '}' expected (to close '{' at line 56) near 'local'
2021-09-11 15:18:40: ERROR[Main]: stack traceback:
2021-09-11 15:18:40: ERROR[Main]: [C]: in function 'dofile'
2021-09-11 15:18:40: ERROR[Main]: ....minetest/games/minetest_game/mods/mobs_monster/init.lua:30: in main chunk
2021-09-11 15:18:40: ERROR[Main]: Check debug.txt for details.
2021-09-11 15:18:40: ACTION[Main]: Server: Shutting down
Loaded texture: /home/username/snap/minetest/1744/games/minetest_game/menu/header.png
Please show us line 56 and it's surrounding lines (20 is enough).
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

i fixed it and it works perfectly!
cdb_55e935e0b607

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by 56independent_actual » Post

FrostTheLionCat wrote:
Sat Sep 11, 2021 09:51
i fixed it and it works perfectly!
Please do not ask a question and then say it works fine. try fixing it and then ask your questions.

I strongly urge that you read http://www.catb.org/~esr/faqs/smart-questions.html in full. (Please note the authors are not there to answer your questions, they have no idea of your existence.)
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

ok
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

I ran into the error again because i accidentally uninstalled minetest_game
but this time
2021-10-21 16:17:36: ERROR[Main]: ModError: Failed to load and run script from /home/username/snap/minetest/1744/.minetest/games/minetest_game/mods/mobs_monster/init.lua:
2021-10-21 16:17:36: ERROR[Main]: ...inetest/games/minetest_game/mods/mobs_monster/spider.lua:125: unexpected symbol near '='
2021-10-21 16:17:36: ERROR[Main]: stack traceback:
2021-10-21 16:17:36: ERROR[Main]: [C]: in function 'dofile'
2021-10-21 16:17:36: ERROR[Main]: ....minetest/games/minetest_game/mods/mobs_monster/init.lua:30: in main chunk
2021-10-21 16:17:36: ERROR[Main]: Check debug.txt for details.
cdb_55e935e0b607

User avatar
FrostTheLionCat
Member
Posts: 28
Joined: Thu Sep 09, 2021 14:48

Re: Error after i modified the code of the spider from mobs_monster

by FrostTheLionCat » Post

TenPlus1 wrote:
Fri Sep 10, 2021 15:35
For the mobs_animal:spider_tame mob definition, add these lines:

Code: Select all

follow = {"mobs:meat_raw},
on_rightclick = function(self, clicker)
	if mobs:feed_tame(self, clicker, 5, false, true) then return end
end
here's the code:
local tex_backup = self.base_texture

local pet = minetest.add_entity(self.object:get_pos(),
"mobs_monster:spider_tame")
follow = {"mobs:meat_raw"},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 5, false, true) then return end
end
local ent = pet:get_luaentity()

if ent then
ent.owner = clicker:get_player_name()
ent.base_texture = tex_backup
pet:set_properties({textures = tex_backup})
end

self.object:remove()
end
end
})
cdb_55e935e0b607

User avatar
Blockhead
Member
Posts: 1602
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Error after i modified the code of the spider from mobs_monster

by Blockhead » Post

Your problem(s) look like simple syntax errors to me:
FrostTheLionCat wrote:
Thu Oct 21, 2021 10:56

Code: Select all

follow = {"mobs:meat_raw"},
                        ^ ^
                        | \-- Don't put a comma here
                        \--Don't forget to end the string with a matching quote
on_rightclick = function(self, clicker)
    if mobs:feed_tame(self, clicker, 5, false, true) then return end
end
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests