[Mod] Mobs Redo [1.34] [mobs]

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mobs Redo [1.34] [mobs]

by Wuzzy » Thu Mar 02, 2017 13:33

How can I create a mob which walks around water when chasing the player?
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Thu Mar 02, 2017 20:29

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.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mobs Redo [1.34] [mobs]

by Wuzzy » Fri Mar 03, 2017 00:32

OK, thanks. This solved my problems.
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: [Mod] Mobs Redo [1.34] [mobs]

by D00Med » Fri Mar 03, 2017 21:00

Is there a way to make mobs go to a specific place? (like the inside of a building if it is night-time)
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Sat Mar 04, 2017 10:38

you could use do_custom to check time and have a pathfind function to move mob towards a pos.
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: [Mod] Mobs Redo [1.34] [mobs]

by ExeterDad » Sat Mar 04, 2017 11:54

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.
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

Insurrection
New member
 
Posts: 1
Joined: Sun Mar 05, 2017 02:13
In-game: Insurrection

Re: [Mod] Mobs Redo [1.34] [mobs]

by Insurrection » Sun Mar 05, 2017 02:59

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_scared

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
--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.
Code: Select all
mob_scared(self)


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?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Sun Mar 05, 2017 09:42

ExeterDad - I've fixed that problem now, lava flan should swim around happily inside lava for now.
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: [Mod] Mobs Redo [1.34] [mobs]

by ExeterDad » Sun Mar 05, 2017 15:32

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. :)
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Mon Mar 06, 2017 14:23

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 :)
 

User avatar
Andrey01
Member
 
Posts: 431
Joined: Wed Oct 19, 2016 15:18
In-game: Andrey01

Re: [Mod] Mobs Redo [1.34] [mobs]

by Andrey01 » Sun Mar 19, 2017 14:53

TenPlus1, I am suggesting to you to add these new mobs:
https://drive.google.com/file/d/0B4HNak ... sp=sharing
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Mobs Redo [1.33] [mobs]

by azekill_DIABLO » Sun Mar 19, 2017 15:52

FreeLikeGNU wrote:
Image


wut?
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Sun Mar 19, 2017 20:21

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 :)
 

User avatar
Andrey01
Member
 
Posts: 431
Joined: Wed Oct 19, 2016 15:18
In-game: Andrey01

Re: [Mod] Mobs Redo [1.34] [mobs]

by Andrey01 » Mon Mar 20, 2017 18:35

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
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Mon Mar 20, 2017 20:40

Sandworm and Bacteriophage should both me in the nssm mod.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Tue Mar 21, 2017 11:36

Update:

- New setting added for "dogshoot" attack mode which adds a new timer between shooting and dogfighting.
- Code tweaked, tidied and bugs fixed
 

User avatar
Andrey01
Member
 
Posts: 431
Joined: Wed Oct 19, 2016 15:18
In-game: Andrey01

Re: [Mod] Mobs Redo [1.34] [mobs]

by Andrey01 » Tue Mar 21, 2017 17:12

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)
 

zorman2000
Member
 
Posts: 19
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Mobs Redo [1.34] [mobs]

by zorman2000 » Thu Mar 23, 2017 23:04

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!
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Fri Mar 24, 2017 08:16

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.
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: [Mod] Mobs Redo [1.34] [mobs]

by D00Med » Sat Mar 25, 2017 00:21

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?
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Sat Mar 25, 2017 20:25

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 :)
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: [Mod] Mobs Redo [1.34] [mobs]

by D00Med » Sat Mar 25, 2017 20:42

Oh ok, thanks.
I did have a look at that, but I don't really understand it.
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

zorman2000
Member
 
Posts: 19
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Mobs Redo [1.34] [mobs]

by zorman2000 » Tue Mar 28, 2017 21:28

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"?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Wed Mar 29, 2017 07:20

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 :)
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Wed Mar 29, 2017 10:52

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)
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Thu Mar 30, 2017 16:02

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,
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Mobs Redo [1.34] [mobs]

by burli » Thu Mar 30, 2017 17:59

Can you tell me why mobs jump when they start to follow a path?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Thu Mar 30, 2017 18:36

They do ? which mod, what's it standing on at the time ?
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Mobs Redo [1.34] [mobs]

by burli » Thu Mar 30, 2017 18:53

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)
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.34] [mobs]

by TenPlus1 » Fri Mar 31, 2017 07:14

I think the hops are the pathfinders way of making the mob unstuck if it gets stuck at some point.
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 12 guests

cron