Do not edit `minetest.conf' while the game is running.Silent-Hunter wrote:I can't seem to add only_peaceful_mobs = true to the minetest.conf, as it reverts when the game starts.
[Mod] Simple Mobs [mobs]
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!
Check out my stuff! | Donations greatly appreciated! PayPal
Check out my stuff! | Donations greatly appreciated! PayPal
- Silent-Hunter
- Member
- Posts: 30
- Joined: Wed Nov 06, 2013 20:06
Is there a way to add a function to the spawn command? Like
I know this isn't how it's done but it's a start. I only know of two other options, of one which is improper programming methods, the other just more complicated. I would rather keep it in the mobs family.
Code: Select all
mobs:register_spawn("dwarves:dwarf", {"default:stone"}, 3, -1, 7000, 3, -7000)
If spawn then
local name=dwarves:dwarf
if minetest.get_node(pos.x-2, pos.y, pos.z).name=="air" then
minetest.env:add_entity(pos.x-2, pos.y, pos.z, name)
end
if minetest.get_node(pos.x+2, pos.y, pos.z).name=="air" then
minetest.env:add_entity(pos.x+2, pos.y, pos.z, name)
end
if minetest.get_node(pos.x, pos.y, pos.z-2).name=="air" then
minetest.env:add_entity(pos.x, pos.y, pos.z-2, name)
end
if minetest.get_node(pos.x, pos.y, pos.z+2).name=="air" then
minetest.env:add_entity(pos.x, pos.y, pos.z+2, name)
end
end
uhh...I mean,can I post when I made a fork?PilzAdam wrote:Hmmm.... Let me quote the WTFPL:Ikishida wrote:hey,pilzadam,is it okay if i change the textures
to make a pokemon mod?(also,I'll change the
names)WTFPL wrote:You just DO WHAT THE FUCK YOU WANT TO.
When life hands you lemons,throw it back at life saying "I don't need your goddamn lemons!"
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
22:58:27: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: attempt to index local 'p' (a nil value)
22:58:27: ERROR[main]: stack traceback:
22:58:27: ERROR[main]: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: in function <...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:115>
22:58:27: ERROR[main]: stack traceback:
22:58:27: ERROR[main]: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: in function <...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:115>
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
-
- Member
- Posts: 90
- Joined: Tue Aug 20, 2013 02:00
I don't know why that happened, but I do know that the local p is supposed to be the position of a player and it uses minetest.get_connected_players to get this player. Do you have any other details on this error?VanessaE wrote:22:58:27: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: attempt to index local 'p' (a nil value)
22:58:27: ERROR[main]: stack traceback:
22:58:27: ERROR[main]: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: in function <...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:115>
I was thinking in his version of the mod though that something was slightly off about the code for following, but I can't remember offhand what I changed. Although, I don't think it'll fix whatever that occured.
Also, people keep in mind my commits that still has yet to be reviewed. My version has the mobs actually jumping to chase you.
https://github.com/ElectricSolstice/mobs
Do you somehow have players that return nil when you get their position?
Last edited by ElectricSolstice on Fri Nov 15, 2013 08:14, edited 1 time in total.
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
I'm not at all sure what the circumstances were that caused this error to pop up - it was just one of those random things (I see a restart on the servers' IRC channel, check the log, and... like that).
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
proller reported that too. I think it might happen since https://github.com/minetest/minetest/co ... a890cd05c5.VanessaE wrote:22:58:27: ERROR[main]: ERROR: An unhandled exception occurred: ServerError: LuaError: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: attempt to index local 'p' (a nil value)
22:58:27: ERROR[main]: stack traceback:
22:58:27: ERROR[main]: ...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:243: in function <...minetest/.minetest/games/vanessae_game/mods/mobs/api.lua:115>
My guess is that on_step() runs before register_on_leaveplayer(). (That would be a bug in the engine then.)
-
- Member
- Posts: 90
- Joined: Tue Aug 20, 2013 02:00
If all you care about is a quick fix for the mod on your server, you could probably wrap that bit of code in an if statement. All that code there does is check for players to start following and a mob wouldn't need to follow a non existant player if pilzAdam is right about step being called before register_on_leaveplayer.VanessaE wrote:I'm not at all sure what the circumstances were that caused this error to pop up - it was just one of those random things (I see a restart on the servers' IRC channel, check the log, and... like that).
change right after line 242
so if starting at line 241, change it to look like this
Code: Select all
local s = self.object:getpos()
local p = player:getpos()
if p~= nil then
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if self.view_range and dist < self.view_range then
self.following = player
end
end
Last edited by ElectricSolstice on Fri Nov 15, 2013 17:26, edited 1 time in total.
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Thanks, I'll give it a try.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Seems to help - a similar fix was needed for the subroutine near line 222 also.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
I'm new to Minetest, and recently setup a server for my and my two boys to play on. Working very nicely!PilzAdam wrote:Depends:
default
fire
This mod looked interesting, but I can't seem to find the "fire" mod, which it appears to be dependent on.
I've dug through the "Mod Releases" area, and have found other mods mentioning fire, but have had no luck finding a mod specifically titled simply "Fire".
Does anyone have a link please?
Thanks so much!
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Fire is part of minetest_game, so you dont need to install it as an external mod.Dukie wrote:I'm new to Minetest, and recently setup a server for my and my two boys to play on. Working very nicely!PilzAdam wrote:Depends:
default
fire
This mod looked interesting, but I can't seem to find the "fire" mod, which it appears to be dependent on.
I've dug through the "Mod Releases" area, and have found other mods mentioning fire, but have had no luck finding a mod specifically titled simply "Fire".
Does anyone have a link please?
Thanks so much!
Thanks! I found that out in the few minutes after I posted.. The "find" command works wonders, eh? ;-)PilzAdam wrote:Fire is part of minetest_game, so you dont need to install it as an external mod.
So - Now I've enabled the mod, and when I fire up the server it bonks out,
I grabbed Minetest via github.com a few nights ago, so it's a fairly new build.
I grabbed the Simple Mobs mod today via:
$ wget -O simplemobs.zip https://github.com/PilzAdam/mobs/zipball/master
Once I unzipped it, I moved it to the mobs directory:
$ mv PilzAdam-mobs-c49cc47 simplemobs
$ mv simplemobs /home/minetest/minetest_server/minetest-minetest-bb54e2c/mods/
I then added "load_mod_simplemobs = true" to my "/home/minetest/minetest_server/minetest-minetest-bb54e2c/worlds/world/world.mt" file.
And when I start the server, I get the following:
-snip-
Automatically selecting world at [/home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../worlds/world]
14:40:41: ERROR[main]: ========== ERROR FROM LUA ===========
14:40:41: ERROR[main]: Failed to load and run script from
14:40:41: ERROR[main]: /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua:
14:40:41: ERROR[main]: ...est-minetest-bb54e2c/bin/../mods/simplemobs/init.lua:1: attempt to concatenate a nil value
14:40:41: ERROR[main]: stack traceback:
14:40:41: ERROR[main]: ...est-minetest-bb54e2c/bin/../mods/simplemobs/init.lua:1: in main chunk
14:40:41: ERROR[main]: =======END OF ERROR FROM LUA ========
14:40:41: ERROR[main]: Server: Failed to load and run /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua
14:40:41: ERROR[main]: ERROR: An unhandled exception occurred: ModError: Failed to load and run /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua
In thread 7fbb13658740:
/root/minetest/minetest-minetest-bb54e2c/src/main.cpp int main(int, char**): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 7fbb13658740:
#0 int main(int, char**)
(Leftover data: #1 Dedicated server branch)
Aborted (core dumped)
-snip-
$ /home/minetest/minetest_server/minetest_server.bin --version
minetestserver 0.4.7-dev
Build info: VER=0.4.7-dev BUILD_TYPE=Release RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=0 USE_CURL=1 USE_FREETYPE=0 USE_LUAJIT=0 STATIC_SHAREDIR=.
Any ideas or suggestions would be most appreciated,
Last edited by Dukie on Sat Nov 16, 2013 20:00, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Rename the modfolder to "mobs". More info: viewtopic.php?id=6450Dukie wrote:Thanks! I found that out in the few minutes after I posted.. The "find" command works wonders, eh? ;-)PilzAdam wrote:Fire is part of minetest_game, so you dont need to install it as an external mod.
So - Now I've enabled the mod, and when I fire up the server it bonks out,
I grabbed Minetest via github.com a few nights ago, so it's a fairly new build.
I grabbed the Simple Mobs mod today via:
$ wget -O simplemobs.zip https://github.com/PilzAdam/mobs/zipball/master
Once I unzipped it, I moved it to the mobs directory:
$ mv PilzAdam-mobs-c49cc47 simplemobs
$ mv simplemobs /home/minetest/minetest_server/minetest-minetest-bb54e2c/mods/
I then added "load_mod_simplemobs = true" to my "/home/minetest/minetest_server/minetest-minetest-bb54e2c/worlds/world/world.mt" file.
And when I start the server, I get the following:Any ideas or suggestions would be most appreciated,Code: Select all
-snip- Automatically selecting world at [/home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../worlds/world] 14:40:41: ERROR[main]: ========== ERROR FROM LUA =========== 14:40:41: ERROR[main]: Failed to load and run script from 14:40:41: ERROR[main]: /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua: 14:40:41: ERROR[main]: ...est-minetest-bb54e2c/bin/../mods/simplemobs/init.lua:1: attempt to concatenate a nil value 14:40:41: ERROR[main]: stack traceback: 14:40:41: ERROR[main]: ...est-minetest-bb54e2c/bin/../mods/simplemobs/init.lua:1: in main chunk 14:40:41: ERROR[main]: =======END OF ERROR FROM LUA ======== 14:40:41: ERROR[main]: Server: Failed to load and run /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua 14:40:41: ERROR[main]: ERROR: An unhandled exception occurred: ModError: Failed to load and run /home/minetest/minetest_server/minetest-minetest-bb54e2c/bin/../mods/simplemobs/init.lua In thread 7fbb13658740: /root/minetest/minetest-minetest-bb54e2c/src/main.cpp:1854: int main(int, char**): Assertion '0' failed. Debug stacks: DEBUG STACK FOR THREAD 7fbb13658740: #0 int main(int, char**) (Leftover data: #1 Dedicated server branch) Aborted (core dumped) -snip- $ /home/minetest/minetest_server/minetest_server.bin --version minetestserver 0.4.7-dev Build info: VER=0.4.7-dev BUILD_TYPE=Release RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=0 USE_CURL=1 USE_FREETYPE=0 USE_LUAJIT=0 STATIC_SHAREDIR=.
-
- Member
- Posts: 158
- Joined: Sat Aug 03, 2013 15:16
- In-game: naro
That did it! Thanks very much!PilzAdam wrote:Rename the modfolder to "mobs". More info: viewtopic.php?id=6450
Time to go read-up on naming conventions,
I've got it loading but it doesn't seem to do anything,wcwyes wrote:Is there a way to add a function to the spawn command? LikeI know this isn't how it's done but it's a start. I only know of two other options, of one which is improper programming methods, the other just more complicated. I would rather keep it in the mobs family.Code: Select all
mobs:register_spawn("dwarves:dwarf", {"default:stone"}, 3, -1, 7000, 3, -7000) If spawn then local name=dwarves:dwarf if minetest.get_node(pos.x-2, pos.y, pos.z).name=="air" then minetest.env:add_entity(pos.x-2, pos.y, pos.z, name) end if minetest.get_node(pos.x+2, pos.y, pos.z).name=="air" then minetest.env:add_entity(pos.x+2, pos.y, pos.z, name) end if minetest.get_node(pos.x, pos.y, pos.z-2).name=="air" then minetest.env:add_entity(pos.x, pos.y, pos.z-2, name) end if minetest.get_node(pos.x, pos.y, pos.z+2).name=="air" then minetest.env:add_entity(pos.x, pos.y, pos.z+2, name) end end
Code: Select all
attack_type = "dogfight",
action = function(pos)
function dwarves.scatter(pos)
if minetest.get_node(pos.x-2).name=="air" then
minetest.env:add_entity(pos.x-2, {name=dwarves:dwarf}),
end
if minetest.get_node(pos.x+2).name=="air" then
minetest.env:add_entity(pos.x+2, {name=dwarves:dwarf}),
end
if minetest.get_node(pos.z-2).name=="air" then
minetest.env:add_entity(pos.z-2, {name=dwarves:dwarf})
end
if minetest.get_node(pos.z+2).name=="air" then
minetest.env:add_entity(pos.z+2, {name=dwarves:dwarf}),
end
minetest.env:remove_entity(pos)
end
end,
Last edited by wcwyes on Mon Nov 18, 2013 06:28, edited 1 time in total.
hey as I usually do I modified some of the code for my own game so that the mobs would drop the items when killed by an arrow (from throwing mod), instead of losing it, and found it much funnier, because now hunting has a point
In mobs/api you just replace the :
by:
Basically, it drops the item when the mob dies, but i've not tested every possible death. Also, you may not want to use it on a server because items will be also dropped when light kills the mobs, causing random items drops everywhere.
I'm also going to try and use it for mob farming I replaced the drops to be more interesting to farm.
In mobs/api you just replace the :
Code: Select all
if self.object:get_hp() <= 0 then ......................... end
Code: Select all
if self.object:get_hp() <= 0 then
if hitter and hitter:is_player() and hitter:get_inventory() then
for _,drop in ipairs(self.drops) do
if math.random(1, drop.chance) == 1 then
hitter:get_inventory():add_item("main", ItemStack(drop.name.." "..math.random(drop.min, drop.max)))
end
end
else
for _,drop in ipairs(self.drops) do
if math.random(1, drop.chance) == 1
then
minetest.env:add_item(self.object:getpos(), drop.name.." "..math.random(drop.min, drop.max))
end
end
end
end
I'm also going to try and use it for mob farming I replaced the drops to be more interesting to farm.
k8NzxjXgxpd3KOKx8pz2z12pStfpe5tR
- Nightshade
- Member
- Posts: 25
- Joined: Thu Oct 24, 2013 15:25
-
- Member
- Posts: 90
- Joined: Tue Aug 20, 2013 02:00
I'm guessing change the chance in mob.register_spawn on whichever monster you want to spawn more. I'm guessing a lower number would make it spawn more often because it uses an abm to spawn the monsters. For example,Nightshade wrote:What do I need to change to get the mobs to spawn more frequently?
change
Code: Select all
mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 7000, 3, 31000)
Code: Select all
mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 3000, 3, 31000)
-
- Member
- Posts: 25
- Joined: Fri Jul 26, 2013 17:42
- Nightshade
- Member
- Posts: 25
- Joined: Thu Oct 24, 2013 15:25
Thanks, Electric. I'll test it out some time. I just wasn't sure which value in that mess to change (I'm not a coder...)ElectricSolstice wrote:I'm guessing change the chance in mob.register_spawn on whichever monster you want to spawn more. I'm guessing a lower number would make it spawn more often because it uses an abm to spawn the monsters. For example,Nightshade wrote:What do I need to change to get the mobs to spawn more frequently?
changetoCode: Select all
mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 7000, 3, 31000)
and I think they should spawn a little more than twice as they already do. However, I haven't tried it yet, so you'll have to tweak that number to your desire.Code: Select all
mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 3000, 3, 31000)
Last edited by Nightshade on Thu Dec 05, 2013 20:37, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 4 guests