Page 34 of 35
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 02, 2017 13:33
by Wuzzy
How can I create a mob which walks around water when chasing the player?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 02, 2017 20:29
by TenPlus1
wuzzy - use the 'pathfinding = 1,' setting in mobs registry to have it pathfind player and climb/avoid obstacles, also setting to 2 allows mob to break down doorways and build to find player. I have avoidance settings to add as yet also.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Fri Mar 03, 2017 00:32
by Wuzzy
OK, thanks. This solved my problems.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Fri Mar 03, 2017 21:00
by D00Med
Is there a way to make mobs go to a specific place? (like the inside of a building if it is night-time)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sat Mar 04, 2017 10:38
by TenPlus1
you could use do_custom to check time and have a pathfind function to move mob towards a pos.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sat Mar 04, 2017 11:54
by ExeterDad
TenPlus1 I've had several players question me about the lava flans. In their relentless quest to posses a Lava Pick they've been wanting to collect lava orbs that can only be gotten by the hunting of Lava Flan. They've been frustrated because after finally finding Flans, they've noted that are dying long before they can even get a selection box on them. It's true. I can watch them spawn in the lava as expected and then immediately I can watch their health start to fall. And then they died. Most cases, less than a second.
I'm pretty sure I haven't modified anything, nor have anything in my minetest.conf added to cause this. Has lava changed somehow in very recent Minetest-dev to cause this? I can't figure this out.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sun Mar 05, 2017 02:59
by Insurrection
Question about mob behaviors- I'm trying to make a new "skittish" tag for mobs (so to speak) that makes them run away from the player once they spot the player. I've tried copying and modifying some of the existing code in API.lua, but no luck. I'm a bit code-dumb, so any help would be appreciated. I'd imagine this would be a useful feature altogether for other modders, too.
I started by adding
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
skittish = def.skittish,
skittish_timer = 0,
to the
mobs:register_mob function.
Next, I added
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
-- skittish when player spotted
elseif self.state == "skittish" then
self.skittish_timer = self.skittish_timer + 1
-- stop after 5 seconds or when at cliff
if self.skittish_timer > 5
or is_at_cliff(self) then
self.skittish_timer = 0
set_velocity(self, 0)
self.state = "stand"
set_animation(self, "stand")
else
set_velocity(self, self.run_velocity)
set_animation(self, "walk")
end
by copying similar code for "runaway when punched" in the
do_states function.
Then I added
mob_scaredYour phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
--mob, find closest player to run away from
local mob_scared = function(self)
local s = self.object:getpos()
local min_dist = self.view_range + 1
local obj, min_player = nil, nil
local objs = minetest.get_objects_inside_radius(s, self.view_range)
for n = 1, #objs do
obj = objs[n]:get_luaentity()
if obj and obj.type == "player" then
p = obj.object:getpos()
dist = get_distance(p, s)
if dist < min_dist then
min_dist = dist
min_player = obj.object
end
end
end
if min_player then
do_scaredrun(self, min_player)
end
end
Added
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
to the
mob_step block
Copied "do_attack" function:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
do_scaredrun = function(self, player)
if self.state == "skittish" then
return
end
self.state = "skittish"
if random(0, 100) < 90 then
mob_sound(self, self.sounds.war_cry)
end
end
Lastly, I added "skittish = true," to the bunny.lua.
It doesn't crash, but it just... doesn't work. What am I doing wrong? Or is there already a way/a better way to achieve the same effect?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sun Mar 05, 2017 09:42
by TenPlus1
ExeterDad - I've fixed that problem now, lava flan should swim around happily inside lava for now.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sun Mar 05, 2017 15:32
by ExeterDad
TenPlus1 wrote:ExeterDad - I've fixed that problem now, lava flan should swim around happily inside lava for now.
Woot!! Thanks Man! Didn't expect you to go through the trouble of fixing. I was just hoping for a clue of what to do.
Now we can see just how fast they can tear the place up with the Lava Pick. :)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Mon Mar 06, 2017 14:23
by TenPlus1
Update:
- Added new animation function to handle built-in AND custom animations for mob e.g.
walk_start = 16, walk_end = 24, walk_speed = 15,
punch_start = 16, punch_end = 24, punch_speed = 20,
twerk_start = 25, twerk_end = 40, twerk_speed = 3000,
- New replace function added which can use tables e.g.
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5"},
replace_with = "air",
replace_rate = 10,
replace_offset = 0,
... now becomes:
replace_what = {{"group:grass", "air", 0}, {"default:dirt_with_grass", "default:dirt", -1}},
replace_rate = 10,
... and adds additional node checks with their own y_offset :)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sun Mar 19, 2017 14:53
by Andrey01
TenPlus1, I am suggesting to you to add these new mobs:
https://drive.google.com/file/d/0B4HNak ... sp=sharing
Re: [Mod] Mobs Redo [1.33] [mobs]
Posted:
Sun Mar 19, 2017 15:52
by azekill_DIABLO
FreeLikeGNU wrote:
wut?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sun Mar 19, 2017 20:21
by TenPlus1
Andrey01: most of those mobs already come as an addon-mod for mobs redo, no point making this mod any larger than it has to be :)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Mon Mar 20, 2017 18:35
by Andrey01
TenPlus1 wrote:Andrey01: most of those mobs already come as an addon-mod for mobs redo, no point making this mod any larger than it has to be :)
No, SandWorm and Bacteriophage don`t have in other mods for mobs redo because they were removed
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Mon Mar 20, 2017 20:40
by TenPlus1
Sandworm and Bacteriophage should both me in the nssm mod.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Tue Mar 21, 2017 11:36
by TenPlus1
Update:
- New setting added for "dogshoot" attack mode which adds a new timer between shooting and dogfighting.
- Code tweaked, tidied and bugs fixed
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Tue Mar 21, 2017 17:12
by Andrey01
TenPlus1 wrote:Sandworm and Bacteriophage should both me in the nssm mod.
Sand Worm and Bacteriophage were removed from NSSM and old versions of these mobs don`t return yet.
Also i suggest you to add huge Black Widow (see to link for download)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 23, 2017 23:04
by zorman2000
Hi Tenplus1,
I have an issue I'm not entirely sure it's related to mobs_redo, but I think it does. So far, I have been using "mobs:spawn()" an setting "on_spawn" to a rather large funcion that initializes a lot of variables for the mob. These variables reside on the same scope of the rest of the "self" variables, like "self.tamed".
However, I want to create a custom spawner method, and I have been doing so using the following code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if spawned_npc_count < npc_count then
-- Spawn a NPC
local npc = minetest.add_entity(pos, "advanced_npc:npc")
if npc and npc:get_luaentity() then
spawn(npc, pos)
-- Check some stuff ...
return true
else
npc:remove()
return false
end
Now, this works well when spawned initially. However, if I close the game and restart it, all the variables added in the "spawn(npc, pos)" function get lost! And actually, the ones added by the mobs_redo definition remain (like path, time_of_day, etc.). This didn't happened when I used the "mobs:spawn()" function, no matter how many times I restarted the game.
Any ideas? If you meed to look more at the code you can find it here:
https://github.com/hkzorman/advanced_npc/blob/master/spawner.lua. And sorry if it's not related and maybe a bug in Minetest.
Thanks in advance!
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Fri Mar 24, 2017 08:16
by TenPlus1
Mobs themselves only save variables beginning with self. and that's it, anything else you add has to be saved either in a file or setting.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sat Mar 25, 2017 00:21
by D00Med
I tried to make npc's return to a previously set postion.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if game_time <= 6000 or game_time >= 18000 and self.home ~= nil then
if self.home_object == nil then
self.home_object = minetest.add_entity(self.home, "mobs_npc:dummy")
end
self.following = self.home_object
end
This didn't seem to work at all. How can I make a mob go to a certain position? is there a better way to do this than trying to get it to follow an entity?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sat Mar 25, 2017 20:25
by TenPlus1
Sadly mobs aren't that smart but in the api we have a mob variable called self.path.way which contains the pathfinding data for a mob to find and get to the player when attacking, and this could possibly be modified to a HOME position instead if mob has pathfinding enabled :)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Sat Mar 25, 2017 20:42
by D00Med
Oh ok, thanks.
I did have a look at that, but I don't really understand it.
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Tue Mar 28, 2017 21:28
by zorman2000
TenPlus1 wrote:Mobs themselves only save variables beginning with self. and that's it, anything else you add has to be saved either in a file or setting.
Yes, I had them all there.
For some reason, it looks like my world was corrupted. I have deleted it and created a new one and it works perfectly.
Thanks!
TenPlus1 wrote:Sadly mobs aren't that smart but in the api we have a mob variable called self.path.way which contains the pathfinding data for a mob to find and get to the player when attacking, and this could possibly be modified to a HOME position instead if mob has pathfinding enabled :)
I also don't understand exactly how this works. Do you specify the ultimate position, or do you have to specify all the positions in the path to the point that you want? What would be the variable that represents the "goal position"?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Wed Mar 29, 2017 07:20
by TenPlus1
self.path.way holds the pathfinder table which is a result of the minetest.find_path() function that provides the mob with a list of positions to follow until it reaches the player it wishes to attack... I am looking into a way of overriding this feature so that a home position can be given and it will do the same until the mob/npc returns home, that and keep the api light :)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Wed Mar 29, 2017 10:52
by TenPlus1
Update:
Mob pathfinding level 2 has been tweaked so that they can break through walls and build up to get to player (not through hard nodes like obsidian etc)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 30, 2017 16:02
by TenPlus1
D00Med, maybe this will help, it's a small routine that sends the mob to a specific position at night time:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
do_custom = function(self, dtime)
self.home_timer = (self.home_timer or 0) + dtime
if self.home_timer < 1 then return end -- every 1 second
self.home_timer = 0
if self.time_of_day > 0.2 and self.time_of_day < 0.8 then
return -- return if not night time
end
local h = {x = 1, y = 8, z = 2} -- destination coords
local p = self.object:getpos() -- mob position
local x, y, z = p.x - h.x, p.y - h.y, p.z - h.z
local dist = math.floor(math.sqrt(x * x + y * y + z * z))
if dist <= 1 then
print ("--- home!")
self.homepath = nil
self.state = "stand"
return
end
if self.homepath == nil then
self.homepath = minetest.find_path(h, h, 16, 3, 6, "Dijkstra")
print ("--- finding route", self.homepath, dist)
end
if self.homepath then
print ("--- following path", dist, #self.homepath)
local np = self.homepath[1] ; if not np then return end
if math.abs(np.x - p.x) + math.abs(np.z - p.z) < 0.6 then
table.remove(self.homepath, 1) ; print ("-- removed entry")
end
np = {x = np.x, y = np.y, z = np.z}
local vec = {x = np.x - p.x, z = np.z - p.z}
local yaw = (math.atan(vec.z / vec.x) + math.pi / 2) - self.rotate
if np.x > p.x then yaw = yaw + math.pi end
self.object:setyaw(yaw)
set_velocity(self, self.walk_velocity)
end
end,
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 30, 2017 17:59
by burli
Can you tell me why mobs jump when they start to follow a path?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 30, 2017 18:36
by TenPlus1
They do ? which mod, what's it standing on at the time ?
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Thu Mar 30, 2017 18:53
by burli
TenPlus1 wrote:They do ? which mod, what's it standing on at the time ?
mobs redo and mobs monsters, relatively new versions. I'm tinker around with the oerkki for a new pathfinder. Every time he starts to follow a path he makes a little hop (not a normal jump)
Re: [Mod] Mobs Redo [1.34] [mobs]
Posted:
Fri Mar 31, 2017 07:14
by TenPlus1
I think the hops are the pathfinders way of making the mob unstuck if it gets stuck at some point.