Then some wood or plastic for the tree, and wool, plastic or leather for the other big parts?davidthecreator wrote:Why not wool?untiltoday wrote:Is it possible to add the ability to make saddles from something else (like plastic or whatever they are made from), to get saddles without killing mobs? Previously mentioned by Sokomine for Petz.
[Mod] Mobs Redo [1.61] [mobs]
-
- Member
- Posts: 20
- Joined: Wed Aug 07, 2019 22:50
- In-game: ParalyzeEntertain
Re: [Mod] Mobs Redo [1.50] [mobs]
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: [Mod] Mobs Redo [1.50] [mobs]
I've been trying to fix the issue with the mobiles being stuck against obstacles, but I haven't been able to apply the following solution; I don't know where to look in your API for the correct places where to add this code.
In other words I don't know where to put my hands, else I would have tried myself.
Thus I'm posting it here, hoping that it will be useful to improve Mobs Redo.
The solution's underlying idea is simple: if the given mob is not in the "stand" state, its velocity should be > than 0; if velocity == 0 then the mob is moonwalking against something.
If you have ever seen one of those old toys that when bump against a wall turn back, you've got the general idea. It is less than optimal - not Artificial Intelligence - but it works.
Of course this requires a timer which performs the check - I have used 5secs - to prevent letting the mobile moonwalking against a wall for more than e.g. 5secs.
If the check is not passed - state ~= "standing" AND velocity == 0 - then apply a random direction "try going somewhere else" AND lower the stuck-check-timer to an half: if the newly chosen direction is blocked, it will take 2.5secs to choose a different one, and so on.
If the check is passed, it's all right. If the timer's value was set to 2.5 then reset it to 5.0.
All of the following (pseudo)code is CC0, i.e. Public Domain
Main API routine on step:
-- Check whether if the mobile is stuck.
Movement management - If Action == "moving" AND Speed == 0 then Stuck == True
Timer management - If timer == 0 then do check, etc.
I hope this somewhat helps, I've spawned a dozen of dwarves in a cave and they all ended up moonwalking against the walls while being slain by Dungeon Masters' fireballs... lol.
In other words I don't know where to put my hands, else I would have tried myself.
Thus I'm posting it here, hoping that it will be useful to improve Mobs Redo.
The solution's underlying idea is simple: if the given mob is not in the "stand" state, its velocity should be > than 0; if velocity == 0 then the mob is moonwalking against something.
If you have ever seen one of those old toys that when bump against a wall turn back, you've got the general idea. It is less than optimal - not Artificial Intelligence - but it works.
Of course this requires a timer which performs the check - I have used 5secs - to prevent letting the mobile moonwalking against a wall for more than e.g. 5secs.
If the check is not passed - state ~= "standing" AND velocity == 0 - then apply a random direction "try going somewhere else" AND lower the stuck-check-timer to an half: if the newly chosen direction is blocked, it will take 2.5secs to choose a different one, and so on.
If the check is passed, it's all right. If the timer's value was set to 2.5 then reset it to 5.0.
All of the following (pseudo)code is CC0, i.e. Public Domain
Main API routine on step:
-- Check whether if the mobile is stuck.
Code: Select all
TimerStuckCheck(self, dtime)
Movement management - If Action == "moving" AND Speed == 0 then Stuck == True
Code: Select all
-- Returns TRUE if stuck, FALSE if not.
CheckIfStuck = function(self)
if (self.state == "moving")
or (self.state == "attacking")
or (self.state ~= "standing")
or etc.
or etc.
then
local velocity = self.object:get_velocity()
if (velocity.x == 0)
and (velocity.y == 0)
and (velocity.z == 0)
then
--print("I am stuck.")
return true
else
-- print("I am not stuck.")
return false
end
end
end
Timer management - If timer == 0 then do check, etc.
Code: Select all
-- Used to check if mobiles are stuck.
TimerStuckCheck = function(self, dtime)
if (self.counter_stuck_check <= 0) then
local mobile_is_stuck = CheckIfStuck(self)
if (mobile_is_stuck ~= nil)
and (mobile_is_stuck ~= false)
then
ApplyRandomDirection() -- I.e. try moving somewhere else.
self.counter_change_direction = 2.5
end
-- If the mob isn't stuck apply the default value.
self.counter_stuck_check = 5.0
else
-- Let the countdown work
self.counter_stuck_check = (self.counter_stuck_check - dtime)
end
end
My repositories: Codeberg.org | My ContentDB's page
Re: [Mod] Mobs Redo [1.50] [mobs]
Hamlet - I've done something a little similar where if the mob is stuck against a wall, it will turn 90 degrees if it cannot jump up or move forward.
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L1064
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L1064
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: [Mod] Mobs Redo [1.50] [mobs]
I see, never mind then.TenPlus1 wrote:Hamlet - I've done something a little similar where if the mob is stuck against a wall, it will turn 90 degrees if it cannot jump up or move forward.
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L1064
My repositories: Codeberg.org | My ContentDB's page
-
- New member
- Posts: 7
- Joined: Fri May 31, 2019 21:32
- GitHub: MisterPrintf
Re: [Mod] Mobs Redo [1.50] [mobs]
Can someone direct me to a wiki or tutorial for using Mobs redo? I've done a little magpen modding and I'd like to get into mobs if possible.
Re: [Mod] Mobs Redo [1.50] [mobs]
Ender3Guy: the git page has the mods itself and the readme and api.txt files for usage: https://notabug.org/tenplus1/mobs_redo
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: [Mod] Mobs Redo [1.50] [mobs]
Mobs ignore fear_height if walk_speed > than 1.
Steps to reproduce:
- Build a pile of dirt 5 nodes tall.
- Spawn a test mob on it. The mob stays there until you add another node, then it jumps down even if fear_height = 3 (see code below).
Screenshots:
Test code used:
Steps to reproduce:
- Build a pile of dirt 5 nodes tall.
- Spawn a test mob on it. The mob stays there until you add another node, then it jumps down even if fear_height = 3 (see code below).
Screenshots:
Test code used:
Code: Select all
--[[
Test Mob - Registers a test mob.
Licensed under the CC0, Version 1.0 or later.
This sofware is distributed on an 'AS IS' basis,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
--]]
--
-- Mob entity
--
mobs:register_mob('test_mob:test', {
nametag = 'Test Mob',
type = 'npc',
hp_min = 20,
hp_max = 20,
armor = 100,
walk_velocity = 4,
run_velocity = 4,
stand_chance = 50,
walk_chance = 50,
jump = true,
jump_height = 1.1,
stepheight = 1.1,
pushable = false,
view_range = 14,
damage = 1,
knock_back = true,
fear_height = 3,
fall_damage = true,
suffocation = true,
floats = true,
reach = 4,
attack_monsters = true,
group_attack = true,
attack_type = 'dogfight',
makes_footstep_sound = true,
visual = 'mesh',
visual_size = {x = 1, y = 1},
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
selectionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
textures = {'character.png'},
mesh = 'character.b3d',
animation = {
stand_start = 0,
stand_end = 79,
stand_speed = 30,
walk_start = 168,
walk_end = 187,
walk_speed = 30,
run_start = 168,
run_end = 187,
run_speed = 30,
punch_start = 189,
punch_end = 198,
punch_speed = 30,
die_start = 162,
die_end = 166,
die_speed = 0.8
}
})
--
-- Mobile spawner
--
mobs:spawn({
name = 'test_mob:test',
nodes = {
'group:cracky',
'group:stone',
'group:crumbly',
'group:sand',
'group:snowy'
},
neighbors = {'air'},
interval = 60,
chance = 7500,
active_object_count = 2,
min_height = -30912,
max_height = 31000
})
-- Spawn Egg
mobs:register_egg('test_mob:test', 'Test Mob', 'default_grass.png', 1)
--
-- Alias for '/spawnentity' command
--
mobs:alias_mob('mobs:test', 'test_mob:test')
--
-- Minetest engine debug logging
--
local log_level = minetest.settings:get('debug_log_level')
if (log_level == nil)
or (log_level == 'action')
or (log_level == 'info')
or (log_level == 'verbose')
then
log_level = nil
minetest.log('action', '[Mod] Test Mob [v0.1.0] loaded.')
end
- Attachments
-
- test2.png (467.18 KiB) Viewed 944 times
-
- test1.png (533.17 KiB) Viewed 944 times
My repositories: Codeberg.org | My ContentDB's page
Update:
The mob core works on a 1 second delay so by the time it walks to the end of the placed node it hasn't checked for fear height just yet... I'll look into this and reduce the delay :) Sadly server lag also affects these checks.
- Changed fear height check to every 1/4 second instead of 1 second, should help.
- Changed fear height check to every 1/4 second instead of 1 second, should help.
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: Update:
I've just tested it: passed! :)TenPlus1 wrote:The mob core works on a 1 second delay so by the time it walks to the end of the placed node it hasn't checked for fear height just yet... I'll look into this and reduce the delay :) Sadly server lag also affects these checks.
- Changed fear height check to every 1/4 second instead of 1 second, should help.
Only a couple of issues:
- the walking animation doesn't stop, making it looking weird.
- the mob sticks where it stopped, doesn't move elsewhere - since 40 minutes and counting.
While we are at it, it could be worth adding to the drop-check also lava/water checks if the mob has those flaws.
Keeping lag and memory saving in mind, it could be Off by default - to be toggled via Settings.
This way servers would not be affected, while Local Game players could easily turn it on.
Quick (pseudo)code examples (License: CC-0 v1.0 or later.)
Lava check
Code: Select all
-- Checks if the node is lava.
local b_LavaDangerCheck = function(pos)
local s_NodeName = minetest.get_node(pos).name
local b_DangerousNode = false
local t_LavaNodes = {
'default:lava_source',
'default:lava_flowing'
}
for i = 1, 2 do
if (b_DangerousNode == false) then
if (s_NodeName == t_LavaNodes[i]) then
b_DangerousNode == true
end
end
end
return b_DangerousNode
end
Code: Select all
-- Checks if the node is water.
local b_WaterDangerCheck = function(pos)
local s_NodeName = minetest.get_node(pos).name
local b_DangerousNode = false
local t_WaterNodes = {
'default:water_source',
'default:water_flowing',
'default:river_water_source',
'default:river_water_flowing'
}
for i = 1, 4 do
if (b_DangerousNode == false) then
if (s_NodeName == t_WaterNodes[i]) then
b_DangerousNode == true
end
end
end
return b_DangerousNode
end
Code: Select all
local b_CheckForDangerousNodes = minetest.settings:get_bool("mobs_dangerous_nodes_check")
local i_WaterDamage = self.water_damage -- Fetch the value just once, outside the cycle.
local i_LavaDamage = self.lava_damage
-- To be used when scanning the surrounding nodes.
if (b_CheckForDangerousNodes == true) then
if (i_LavaDamage ~= nil) then
if (b_LavaDangerCheck(pos) == true) then
<function_that_stops_the_mob>
<function_that_tries_another_direction>
end
end
if (i_WaterDamage ~= nil) then
if (b_WaterDangerCheck(pos) == true) then
<function_that_stops_the_mob>
<function_that_tries_another_direction>
end
end
end
My repositories: Codeberg.org | My ContentDB's page
Re: [Mod] Mobs Redo [1.50] [mobs]
@Hamlet - The node that the mob is standing in is within the 1/4 second loop (self.standing_in) and the water/lava check is part of the walk cycle of checks and if found the mob usually turns around or if they fall in, escapes onto the closest land block.
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L2032
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L2032
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: [Mod] Mobs Redo [1.50] [mobs]
Good to know, thank you.TenPlus1 wrote:@Hamlet - The node that the mob is standing in is within the 1/4 second loop (self.standing_in) and the water/lava check is part of the walk cycle of checks and if found the mob usually turns around or if they fall in, escapes onto the closest land block.
https://notabug.org/TenPlus1/mobs_redo/ ... .lua#L2032
My repositories: Codeberg.org | My ContentDB's page
- Hamlet
- Member
- Posts: 766
- Joined: Sat Jul 29, 2017 21:09
- IRC: H4mlet
- In-game: Hamlet
- Location: Lombardy, Italy
Re: [Mod] Mobs Redo [1.50] [mobs]
@TenPlus1
I'm having an issue with textures that I can't solve: mobs become full white on punch, for about 1sec.
This does not happen if the mob's contains just an entry, i.e. a simple skin. - Mobs Humans-dev basic mode -
This happens when it contains a table of textures, which is my case due the fact I'm using StuJones' character model that allows displaying swords, shields, etc. i.e. 3D Armor's model. - Mobs Humans-dev dynamic mode -
Yesterday I thought that I had eventually solved the issue by explicitly setting the mob's, the 'full white effect' was gone. Today I'm experiencing it again.
It must be said that mobs in 'dynamic mode' change textures, that is draw/sheath swords if they are attacking or not.
The fact that explicitly setting the blood texture had temporarily solved it really baffles me.
Any hints on what could be possibly causing this? Here's the function I'm using to swap between armed/unarmed modes: link.
I'm having an issue with textures that I can't solve: mobs become full white on punch, for about 1sec.
This does not happen if the mob's
Code: Select all
textures
This happens when it contains a table of textures, which is my case due the fact I'm using StuJones' character model that allows displaying swords, shields, etc. i.e. 3D Armor's model. - Mobs Humans-dev dynamic mode -
Yesterday I thought that I had eventually solved the issue by explicitly setting the mob's
Code: Select all
blood_texture = 'mobs_blood.png'
It must be said that mobs in 'dynamic mode' change textures, that is draw/sheath swords if they are attacking or not.
The fact that explicitly setting the blood texture had temporarily solved it really baffles me.
Any hints on what could be possibly causing this? Here's the function I'm using to swap between armed/unarmed modes: link.
My repositories: Codeberg.org | My ContentDB's page
- FreeGamers
- Member
- Posts: 650
- Joined: Sat May 25, 2019 00:15
- GitHub: is proprietary I use NotABug
- Location: United States
- Contact:
Re: [Mod] Mobs Redo [1.50] [mobs]
I'm trying to make a mob float in lava.
I can do this two ways, I've tried enabling floats = 1, but this parameter seems to only apply to water. Could it be extended to lava?
Otherwise, I could try to use the "fly" and "fly_in" parameters and set what nodes it can fly in. However, I would like the mob to walk on land and other nods instead flying. But when fly_in and fly are enabled, the mob cannot walk.
Also, I had an additional question: can a set of nodes be given as "fly_in" definitions? I tried this but it crashed the api due to it being a table instead of the expected string.
I can do this two ways, I've tried enabling floats = 1, but this parameter seems to only apply to water. Could it be extended to lava?
Otherwise, I could try to use the "fly" and "fly_in" parameters and set what nodes it can fly in. However, I would like the mob to walk on land and other nods instead flying. But when fly_in and fly are enabled, the mob cannot walk.
Also, I had an additional question: can a set of nodes be given as "fly_in" definitions? I tried this but it crashed the api due to it being a table instead of the expected string.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft
Re: [Mod] Mobs Redo [1.50] [mobs]
Never paid much attention to them. Don't lava slimes float?
- FreeGamers
- Member
- Posts: 650
- Joined: Sat May 25, 2019 00:15
- GitHub: is proprietary I use NotABug
- Location: United States
- Contact:
Re: [Mod] Mobs Redo [1.50] [mobs]
I thought so but the ones in tmw_slimes dont seem to. I went to check.ThorfinnS wrote:Never paid much attention to them. Don't lava slimes float?
I'll double check the lava flan too.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft
- FreeGamers
- Member
- Posts: 650
- Joined: Sat May 25, 2019 00:15
- GitHub: is proprietary I use NotABug
- Location: United States
- Contact:
Re: [Mod] Mobs Redo [1.50] [mobs]
I think the way I'll end up handling this is maybe some sort of variable change of the spawn like if its in lava, it can fly without any parameters. I did a lot of mob work this week and found some work by ElCeejo that handles mobs that can swim and walk on land by changing variables depending on what type of nodes they're in. It seems like a good workaround.
I had another questions for Mr. 10+1
I've been working on adding halloween content packs to my game. They are handled by adding mobs during certain times of the year. I am currently using a function that controls spawning that looks like this:
This is pretty good and handles things efficently but requires the game to restart during the time frame in order to register the spawn.
I was wondering if Mr. 10+1 could think of a better way for me to handle this?
I was thinking perhaps registering the spawn function and using something in the spawn_specific
could be used to control this instead. But the only way I could think of would be to spawn mobs anyways and then run a check for the date and remove self if the date is not in the holiday date range. Its probably quite a bit less efficient to run these register these spawn functions year round, but would automate the game more and remove the need to reboot the minetest server during holiday periods.
I had another questions for Mr. 10+1
I've been working on adding halloween content packs to my game. They are handled by adding mobs during certain times of the year. I am currently using a function that controls spawning that looks like this:
Code: Select all
local date = os.date("*t")
if (date.month == 10 and date.day >= 20) or (date.month == 11 and date.day <= 3) then
--Spawn Functions
mobs:spawn_specific("mobs_creatures:halloween_zombie", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air"}, 0, 6, 30, 10000, 6, -30912, 30912, false)
else
return
end
I was wondering if Mr. 10+1 could think of a better way for me to handle this?
I was thinking perhaps registering the spawn function and using something in the spawn_specific
Code: Select all
'on_spawn' is a custom function which runs after mob has spawned
and gives self and pos values.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft
Re: [Mod] Mobs Redo [1.50] [mobs]
You could easily create an on_spawn function either within the mob definition or the mobs:spawn() itself and check for a specific date, if found then return true to spawn the halloween zombie, failing that self.object:remove() or do something else.
- FreeGamers
- Member
- Posts: 650
- Joined: Sat May 25, 2019 00:15
- GitHub: is proprietary I use NotABug
- Location: United States
- Contact:
Re: [Mod] Mobs Redo [1.50] [mobs]
Do you think a simple if statement would work for this or do I need to use something that ticks and checks periodically to update what is registered?
In other words, this won't work right?
In other words, this won't work right?
Code: Select all
local date = os.date("*t")
if (date.month == 10 and date.day >= 20) or (date.month == 11 and date.day <= 3) then
--Spawn Functions
mobs:spawn_specific("mobs_creatures:halloween_zombie", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air"}, 0, 6, 30, 10000, 6, -30912, 30912, false)
else
return
end
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft
Re: [Mod] Mobs Redo [1.50] [mobs]
A simple IF statement should work fine inside of the on_spawn function each time the mob is spawned, keep or remove, and the mobs:spawn will be registered as normal as if it were a normal mob.
- FreeGamers
- Member
- Posts: 650
- Joined: Sat May 25, 2019 00:15
- GitHub: is proprietary I use NotABug
- Location: United States
- Contact:
Re: [Mod] Mobs Redo [1.50] [mobs]
OK, I think that is the best way to handle it. I was thinking about this yesterday while driving somewhere.
I think that was the easiest way for me handle it and write it. However, if the mob is spawned with a spawn egg by an admin, the mob will get removed by the on_spawn check.
I could try writing a separate check to see if the mob has an eggplacer.
monsters do not have an owner string set so checking that will not work. https://notabug.org/TenPlus1/mobs_redo/ ... 3825-L3829
OK, i think I will try to store the variable with something like
keep the mob
I think that was the easiest way for me handle it and write it. However, if the mob is spawned with a spawn egg by an admin, the mob will get removed by the on_spawn check.
I could try writing a separate check to see if the mob has an eggplacer.
monsters do not have an owner string set so checking that will not work. https://notabug.org/TenPlus1/mobs_redo/ ... 3825-L3829
OK, i think I will try to store the variable with something like
Code: Select all
local eggplacer = placer:get_player_name()
if eggplacer ~= nil then
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft
Re: [Mod] Mobs Redo [1.50] [mobs]
Is there a way, that you could push the animals (sheep, cows etc.), because it sucks, that I get stuck between my farm animals when I'm as an example sheering sheep. With that I could also get to the wool more easily.
- davidthecreator
- Member
- Posts: 452
- Joined: Mon Aug 18, 2014 19:48
- GitHub: daviddoesminetest
- In-game: DavidDoesMinetest
- Location: Lithuania
Re: [Mod] Mobs Redo [1.50] [mobs]
Best you can do is. Slap them away... I think...oddguy117 wrote:Is there a way, that you could push the animals (sheep, cows etc.), because it sucks, that I get stuck between my farm animals when I'm as an example sheering sheep. With that I could also get to the wool more easily.
Re: [Mod] Mobs Redo [1.50] [mobs]
animals can be pushed, there's a setting for it.
Re: [Mod] Mobs Redo [1.50] [mobs]
Where is the setting? I can't find it in the settings menu
Who is online
Users browsing this forum: No registered users and 15 guests