[Mod] Mobs Redo [1.62] [mobs]
Re: [Mod] Mobs Redo [1.62] [mobs]
@TenPlus1 - Then the monsters will stop attacking, but they are supposed to attack all the time. Maybe the attack probability can be configured somehow when they spawn? In that case, I would set it up in my spawn.lua files
Re: [Mod] Mobs Redo [1.62] [mobs]
@adikalon - That part is easy, when spawning say a hog that has a chance of attacking a player, you can turn it off like so e.g.
Code: Select all
mobs:spawn({
name = "mobs_animal:pumba",
nodes = "default:dirt_with_grass",
min_light = 14,
interval = 60,
chance = 8000,
min_height = 0,
max_height = 200,
day_toggle = true,
on_spawn = function(self, pos)
self.attack_players = false -- Don't attack players until hit first.
end,
})
Last edited by TenPlus1 on Fri Sep 26, 2025 17:12, edited 1 time in total.
Re: [Mod] Mobs Redo [1.62] [mobs]
@TenPlus1 - Ooh, cool. So if I hit it first, will the mob retaliate? That's exactly the kind of behavior I'm hoping for
Update:
- Refactor protected spawn checks for 'mobs_spawn_protected' and 'mobs_spawn_monster_protected' settings.
Re: [Mod] Mobs Redo [1.62] [mobs]
Is there any way to make the initial spawn not wait for the interval? In other words, to make the timer start counting after the first spawn in each chunk
Re: [Mod] Mobs Redo [1.62] [mobs]
@adikalon - If you mean spawning a mob outwith the spawner abm then yes, there are mobs:spawner nodes available or you can create a specific lbm or node that spawns a mob once generated on the map.
Re: [Mod] Mobs Redo [1.62] [mobs]
@TenPlus1 - I'm specifically talking about the ABM's behavior. The problem is that the first spawn is also delayed by the interval. I want the first spawn to be instant when the conditions are met, and then the 180-second interval should apply to all subsequent spawns.
Re: [Mod] Mobs Redo [1.62] [mobs]
@adikalon - Remember that abm spawns are using random chance, even if it runs straight away it may still not spawn a mob due to the chance factor alone. You would need to change the spawn settings for the mob in question or add a new spawn that generates with the world e.g.
Code: Select all
mobs:spawn({
name = "mobs_animal:bunny",
nodes = "default:dirt_with_grass",
chance = 10, -- very low chance so mob will spawn
min_height = 1, -- spawn above ground
day_toggle = true, -- spawn during daytime
active_object_count = 1, -- limit mob count so they dont overrun mapblock
on_map_load = true, -- only spawn mob on generation of mapblock
})
Re: [Mod] Mobs Redo [1.62] [mobs]
@TenPlus1 - Thanks for the example. I understand that method, but it only works for newly generated mapblocks.
My original question was specifically about the ABM respawn mechanic in already explored and loaded areas. I want the mob to appear immediately when a player enters an area where it's supposed to spawn (the first spawn after loading), and only then should the interval timer start for the next respawn.
Is there a way to configure the ABM itself to have no initial delay? Maybe a setting I'm missing, or a way to make the first ABM execution trigger instantly upon the chunk becoming active, before the interval loop begins?
My original question was specifically about the ABM respawn mechanic in already explored and loaded areas. I want the mob to appear immediately when a player enters an area where it's supposed to spawn (the first spawn after loading), and only then should the interval timer start for the next respawn.
Is there a way to configure the ABM itself to have no initial delay? Maybe a setting I'm missing, or a way to make the first ABM execution trigger instantly upon the chunk becoming active, before the interval loop begins?
Re: [Mod] Mobs Redo [1.62] [mobs]
@adikalon - Default abm timers only begin when the world starts and execute at their own intervals, so to have something start immediately you would need a custom function, node, globaltimer, lbm or smaller abm intervals.
Update:
- The Panda model in Mobs Animal has been fixed (thanks AspireMint).
- Penguins can eat group:fish from x_farming.
- Pandas can eat group:bamboo from everness.
- Pandas spawn in default jungle, or ethereal bamboo or everness bamboo biomes if found.
- Penguins can eat group:fish from x_farming.
- Pandas can eat group:bamboo from everness.
- Pandas spawn in default jungle, or ethereal bamboo or everness bamboo biomes if found.
- Nininik
- Member
- Posts: 945
- Joined: Thu Apr 06, 2023 01:55
- GitHub: nininik0
- IRC: nininik
- In-game: nininik
- Location: CA, Team thunderstrike headquarters
- Contact:
Re: [Mod] Mobs Redo [1.62] [mobs]
Have an issue, I'm trying to make a flying rideable mob but it keeps giving me this error, and the api isnt really documented for it. Previously I managed to get it to not crash but it would js fly up infinitely when I ride it. My code:
Code: Select all
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 11
self.max_speed_reverse = 5
self.speed = 27
self.accel = 7
self.fly_speed = 27
fly = 27
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 0, z = -2}
self.driver_eye_offset = {x = 0, y = 2, z = 0}
self.driver_scale = {x = 0, y = 0, z = 0} -- shrink driver to fit model
end
-- if driver present allow control of horse
if self.driver then
mobs.fly(self, fly, true, dtime, can_shoot, arrow_entity, can_fly)
can_shoot = true
arrow_entity = "mobs_monster:arrow"
can_fly = true
return true -- skip rest of mob functions
end
return false
end,
on_die = function(self, pos)
-- detach player from horse properly
if self.driver then
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
-- drop saddle if found
if self.saddle then
minetest.add_item(pos, "mobs:saddle")
end
-- drop any horseshoes added
if self.shoed then
minetest.add_item(pos, self.shoed)
end
end,
do_punch = function(self, hitter)
-- don't cut the branch you're... ah, that's not about that
if hitter ~= self.driver then
return true
end
end,
on_rightclick = function(self, clicker)
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
-- feed, tame or heal horse
if mobs:feed_tame(self, clicker, 10, true, true) then
return
end
-- applying protection rune
if mobs:protect(self, clicker) then
return
end
local player_name = clicker:get_player_name()
-- make sure tamed horse is being clicked by owner only
if self.tamed and self.owner == player_name then
local inv = clicker:get_inventory()
local tool = clicker:get_wielded_item()
local item = tool:get_name()
-- detatch player already riding horse
if self.driver and clicker == self.driver then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
return
end
-- attach saddle to horse
if not self.driver
and not self.child
and clicker:get_wielded_item():get_name() == "mobs:saddle"
and not self.saddle then
self.saddle = true
self.order = "stand"
self.object:set_properties({stepheight = 6})
-- take saddle from inventory
inv:remove_item("main", "mobs:saddle")
self.texture_mods = self.texture_mods .. "^tiddem.png"
self.object:set_texture_mod(self.texture_mods)
return
end
-- apply horseshoes (not needed)
if item:find("remoceditmw") then
-- drop any existing shoes
if self.shoed then
minetest.add_item(self.object:get_pos(), self.shoed)
end
local speed = shoes[item][1]
local jump = shoes[item][2]
local reverse = shoes[item][3]
local overlay = shoes[item][4]
self.max_speed_forward = speed
self.jump_height = jump
self.max_speed_reverse = reverse
self.accel = speed
self.shoed = item
-- apply horseshoe overlay to current horse texture
if overlay then
self.texture_mods = "^" .. overlay
if self.saddle then
self.texture_mods = self.texture_mods
.. "^tiddem.png"
end
self.object:set_texture_mod(self.texture_mods)
end
-- show horse speed and jump stats with shoes fitted
minetest.chat_send_player(player_name,
S("Horse shoes fitted -")
.. S(" speed: ") .. speed
.. S(" , jump height: ") .. jump
.. S(" , stop speed: ") .. reverse)
tool:take_item()
clicker:set_wielded_item(tool)
return
end
end
-- used to capture horse with magic lasso
if mobs:capture_mob(self, clicker, nil, nil, 100, false, nil) then return end
-- ride horse if saddled
if self.saddle and self.owner == player_name then
mobs.attach(self, clicker)
end
local item = clicker:get_wielded_item()
-- Check if the item exists and is "default:stick"
if item and item:get_name() == "default:stick" then
-- Toggle between follow and stand orders
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
-- Send feedback to the player
minetest.chat_send_player(clicker:get_player_name(), "mob will " .. self.order .. ".")
end
end
})
- Attachments
-
- Screenshot_20251116-113715_Luanti.png (77.38 KiB) Viewed 243 times
Last edited by Nininik on Mon Nov 17, 2025 03:36, edited 1 time in total.
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯
↯T.T.S.↯
Re: [Mod] Mobs Redo [1.62] [mobs]
This function call in your do_custom function:
...does not match the function signature in mobs/mount.lua:
'true' is being passed as the speed, which causes the crash shortly after. That is what "attempt to perform arithmetic on local 'speed' (a boolean value)" means. It is basically trying to do something like '2 * true' which does not make sense in Lua.
On another note, the Riding Mobs section in api.txt needs corrections because it is using the colon syntax sugar when that's not the case in mount.lua itself. In other words, the text file says "mobs:fly" when the actual function should be called as "mobs.fly" since passing the mobs global table as the entity parameter almost certainly will make the game crash.
Code: Select all
mobs.fly(self, fly, true, dtime, can_shoot, arrow_entity, can_fly)Code: Select all
function mobs.fly(entity, _, speed, shoots, arrow, moving_anim, stand_anim)On another note, the Riding Mobs section in api.txt needs corrections because it is using the colon syntax sugar when that's not the case in mount.lua itself. In other words, the text file says "mobs:fly" when the actual function should be called as "mobs.fly" since passing the mobs global table as the entity parameter almost certainly will make the game crash.
cdb_16a9468970bf
- Nininik
- Member
- Posts: 945
- Joined: Thu Apr 06, 2023 01:55
- GitHub: nininik0
- IRC: nininik
- In-game: nininik
- Location: CA, Team thunderstrike headquarters
- Contact:
Re: [Mod] Mobs Redo [1.62] [mobs]
So that fixed the crashing i replaced true with 27 but now it js goes up when you PRESS w or UP, and it us goes up, when releasing it will go down slowly but it isn't flying back or forthjara25 wrote: ↑Sun Nov 16, 2025 21:52This function call in your do_custom function:...does not match the function signature in mobs/mount.lua:Code: Select all
mobs.fly(self, fly, true, dtime, can_shoot, arrow_entity, can_fly)'true' is being passed as the speed, which causes the crash shortly after. That is what "attempt to perform arithmetic on local 'speed' (a boolean value)" means. It is basically trying to do something like '2 * true' which does not make sense in Lua.Code: Select all
function mobs.fly(entity, _, speed, shoots, arrow, moving_anim, stand_anim)
On another note, the Riding Mobs section in api.txt needs corrections because it is using the colon syntax sugar when that's not the case in mount.lua itself. In other words, the text file says "mobs:fly" when the actual function should be called as "mobs.fly" since passing the mobs global table as the entity parameter almost certainly will make the game crash.
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯
↯T.T.S.↯
- Nininik
- Member
- Posts: 945
- Joined: Thu Apr 06, 2023 01:55
- GitHub: nininik0
- IRC: nininik
- In-game: nininik
- Location: CA, Team thunderstrike headquarters
- Contact:
Re: [Mod] Mobs Redo [1.62] [mobs]
On another note, if i use the format you provided I get this error: (I modified the code and replaced the blanks with needed stuff): this is on the line function mobs.fly(self, 27, speed, shoots, arrow)
speed = 27
can_shoot = true,
arrow_entity = "mobs_monster:arrow"
can_fly = true
speed = 27
can_shoot = true,
arrow_entity = "mobs_monster:arrow"
can_fly = true
- Attachments
-
- Screenshot_20251116-201343_Luanti.png (61.5 KiB) Viewed 204 times
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯
↯T.T.S.↯
Re: [Mod] Mobs Redo [1.62] [mobs]
It might not be your fault.
I'm bad at 3D math but I took a look here and:
Code: Select all
if ctrl.up then
entity.object:set_velocity(
{x = dir.x * speed, y = dir.y * speed + 2, z = dir.z * speed})
elseif ctrl.down then
entity.object:set_velocity(
{x = -dir.x * speed, y = dir.y * speed + 2, z = -dir.z * speed})
Edit: sorry, didn't see your next post lol
For the function call, you probably want something like:
Code: Select all
mobs.fly(self, dtime, self.speed, true, "mobs_monster:arrow", "fly", "stand")Note how that lines up with what the function expects according to the api.txt file.
cdb_16a9468970bf
- Nininik
- Member
- Posts: 945
- Joined: Thu Apr 06, 2023 01:55
- GitHub: nininik0
- IRC: nininik
- In-game: nininik
- Location: CA, Team thunderstrike headquarters
- Contact:
Re: [Mod] Mobs Redo [1.62] [mobs]
Hmmm now it js drives like a normal vehicle jara25 wrote: ↑Mon Nov 17, 2025 04:33It might not be your fault.
I'm bad at 3D math but I took a look here and:Is the +2 supposed to be there for the value of y in both cases?Code: Select all
if ctrl.up then entity.object:set_velocity( {x = dir.x * speed, y = dir.y * speed + 2, z = dir.z * speed}) elseif ctrl.down then entity.object:set_velocity( {x = -dir.x * speed, y = dir.y * speed + 2, z = -dir.z * speed})
Edit: sorry, didn't see your next post lol
For the function call, you probably want something like:...and remove everything before the 'return true' line because those lines do nothing. I'm not sure if that's correct since I never made a flying mob that can be mounted, but tenplus1 or someone else can correct me if I'm wrong.Code: Select all
mobs.fly(self, dtime, self.speed, true, "mobs_monster:arrow", "fly", "stand")
Note how that lines up with what the function expects according to the api.txt file.
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯
↯T.T.S.↯
Re: [Mod] Mobs Redo [1.62] [mobs]
Now that I look at the code more, the part of the API that is about riding mobs is a bit odd.
mobs.drive allows the player to use the jump and sneak buttons to change elevation if can_fly is true, but the mob will not be able to shoot anything.
mobs.fly seems to make the mob fly upwards when it is moving and slowly go downwards when it is not, but it allows the mob to shoot projectiles with sneak + left click.
Did you remove the +2 that I pointed out in your local copy? If so, that's why it's basically like a car now.
I'm assuming that calling both of them in the same server step is a terrible idea. Maybe tenplus1 can improve the API to combine the best parts of both functions.
If you do not need the mob to shoot anything, maybe mobs.drive is enough. Otherwise, you may have to experiment in your mob's do_custom function.
mobs.drive allows the player to use the jump and sneak buttons to change elevation if can_fly is true, but the mob will not be able to shoot anything.
mobs.fly seems to make the mob fly upwards when it is moving and slowly go downwards when it is not, but it allows the mob to shoot projectiles with sneak + left click.
Did you remove the +2 that I pointed out in your local copy? If so, that's why it's basically like a car now.
I'm assuming that calling both of them in the same server step is a terrible idea. Maybe tenplus1 can improve the API to combine the best parts of both functions.
If you do not need the mob to shoot anything, maybe mobs.drive is enough. Otherwise, you may have to experiment in your mob's do_custom function.
cdb_16a9468970bf
- Nininik
- Member
- Posts: 945
- Joined: Thu Apr 06, 2023 01:55
- GitHub: nininik0
- IRC: nininik
- In-game: nininik
- Location: CA, Team thunderstrike headquarters
- Contact:
Re: [Mod] Mobs Redo [1.62] [mobs]
Yeah I dont rly need it to shoot since I can js code an item that when used does that, so is it similar but with can_fly set to true?jara25 wrote: ↑Mon Nov 17, 2025 05:56Now that I look at the code more, the part of the API that is about riding mobs is a bit odd.
mobs.drive allows the player to use the jump and sneak buttons to change elevation if can_fly is true, but the mob will not be able to shoot anything.
mobs.fly seems to make the mob fly upwards when it is moving and slowly go downwards when it is not, but it allows the mob to shoot projectiles with sneak + left click.
Did you remove the +2 that I pointed out in your local copy? If so, that's why it's basically like a car now.
I'm assuming that calling both of them in the same server step is a terrible idea. Maybe tenplus1 can improve the API to combine the best parts of both functions.
If you do not need the mob to shoot anything, maybe mobs.drive is enough. Otherwise, you may have to experiment in your mob's do_custom function.
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯
↯T.T.S.↯
Re: [Mod] Mobs Redo [1.62] [mobs]
Well, the function signature is this:
...so I think this should work:
This should replace the mobs.fly call entirely. It's untested, but let me know if it works out.
Code: Select all
mobs.drive(self, move_animation, stand_animation, can_fly, dtime)Code: Select all
mobs.drive(self, "fly", "stand", true, dtime)cdb_16a9468970bf
Update:
- Add Spanish translation to Mob_Horse.
- Set animation to "stand" when dismounting.
@Nininik - If you need further examples to ride a mob check out Mob Horse.
https://codeberg.org/tenplus1/mob_horse ... r/init.lua
- Set animation to "stand" when dismounting.
@Nininik - If you need further examples to ride a mob check out Mob Horse.
https://codeberg.org/tenplus1/mob_horse ... r/init.lua
Re: [Mod] Mobs Redo [1.62] [mobs]
TenPlus1:
Can you please add the ability to set the dogfight timer per entity?
So, we can have, for example, mobs which does small damage but very often, or very big damage, but once in a long time.
Some per-entity multiplier used over time and timer will also be great.
It allows adding the effect of a slow reaction to an entity. For example, as some poisoning effect.
I also see no easy way for arrow to apply effects to arrow speed.
Can be arrow_override callback be moved after the velocity is set?
Can you please add the ability to set the dogfight timer per entity?
So, we can have, for example, mobs which does small damage but very often, or very big damage, but once in a long time.
Some per-entity multiplier used over time and timer will also be great.
It allows adding the effect of a slow reaction to an entity. For example, as some poisoning effect.
I also see no easy way for arrow to apply effects to arrow speed.
Can be arrow_override callback be moved after the velocity is set?
cdb_3P0AYqjEIn68
Re: [Mod] Mobs Redo [1.62] [mobs]
@SFENCE - So effectively randomizing the attack time, speed and damage ?
The self.arrow_override() is checked for every single arrow so that if the function inside the mob is changed, the arrows change too e.g.
https://codeberg.org/tenplus1/mobs_mons ... onster.lua
The self.arrow_override() is checked for every single arrow so that if the function inside the mob is changed, the arrows change too e.g.
https://codeberg.org/tenplus1/mobs_mons ... onster.lua
Update:
- Added 'punch_interval' setting to mob definition.
- Pass (self, mob_ent) to arrow_override function.
- Pass (self, mob_ent) to arrow_override function.
Who is online
Users browsing this forum: No registered users and 0 guests