[Mobs Api Question] How to make a Mob inmune to a weapon?

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

[Mobs Api Question] How to make a Mob inmune to a weapon?

by MineYoshi » Mon Mar 07, 2016 23:23

Yes i am working in a mod, an add-on to Pilz Adam Mobs, so i need help, how i make a mob inmune to a weapon?

I mean i hit test:potato_mob with a wooden sword , when i hit it my sword doesn't harm the potato_mob!

How i do that?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by maikerumine » Tue Mar 08, 2016 13:51

armor =0,
this will make it invincible.
 

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by maikerumine » Tue Mar 08, 2016 15:02

Sorry! I should explain better:

here is code for monster:
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
-- Sand Monster by PilzAdam
mobs:register_mob("esmobs:sand_monster", {
   type = "monster",
   passive = false,
   attack_type = "dogfight",
   reach = 2,
   damage = 3,
   hp_min = 34,
   hp_max = 60,
   armor = 100,
   collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
   visual = "mesh",
   mesh = "mobs_sand_monster.b3d",
   textures = {
      "mobs_3.png"
   },
   makes_footstep_sound = true,
   sounds = {
      random = "mobs_sandmonster",
   },
   walk_velocity = 3.5,
   run_velocity = 4.5,
   view_range = 15,
   jump = true,
   floats = 0,
   drops = {
      {name = "default:desert_sand",
      chance = 1, min = 3, max = 5},
   },
   water_damage = 3,
   lava_damage = 4,
   light_damage = 0,
   fear_height = 3,
   group_attack = true,
   animation = {
      speed_normal = 15,
      speed_run = 15,
      stand_start = 0,
      stand_end = 39,
      walk_start = 41,
      walk_end = 72,
      run_start = 74,
      run_end = 105,
      punch_start = 74,
      punch_end = 105,
   },
})




See the part: armor = 100,
This is confusing, 100 means just a punch can hurt monster and something like armor = 85, you would need a strong sword to hurt, etc.

I hope this helps!
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Tue Mar 08, 2016 20:57

I mean i can harm the mob with a wooden sword, but if i do the same with a golden sword don't works!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by maikerumine » Tue Mar 08, 2016 21:14

MineYoshi wrote:I mean i can harm the mob with a wooden sword, but if i do the same with a golden sword don't works!

Short answer: not easily.

Here is basic wood sword:
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
minetest.register_tool("default:sword_wood", {
   description = "Wooden Sword",
   inventory_image = "default_tool_woodsword.png",
   tool_capabilities = {
      full_punch_interval = 1,
      max_drop_level=0,
      groupcaps={
         snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
      },
      damage_groups = {fleshy=2},
   }
})


And diamond:
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
minetest.register_tool("default:sword_diamond", {
   description = "Diamond Sword",
   inventory_image = "default_tool_diamondsword.png",
   tool_capabilities = {
      full_punch_interval = 0.7,
      max_drop_level=1,
      groupcaps={
         snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
      },
      damage_groups = {fleshy=8},
   }
})

See the part about damage_groups = {fleshy=8},

That is the amount of damage each weapon does to all fleshy groups.

If you want only one mob to be invincible to a gold sword, you may need to look into advanced coding.
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Tue Mar 08, 2016 23:32

.....

Oh man, i don't know anything about that!


How i can do that, any website that contains info about that, the situation is that Tails said me he wanted a mob for ethereal
of mobs, and he said me some info about everyone of the mobs, and one of that is:
-This mob is inmune to golden and iron sword.


I don't know what to do...
Anyways THX for your help!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
qwertymine3
Member
 
Posts: 194
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by qwertymine3 » Wed Mar 09, 2016 00:23

There is no easy mechanism in the game to do this.
I think you can do this by somehow disabling the default damage system (immortal?) and applying it yourself if the tool is not blacklisted, or by doing a reverse calculation of the damage and healing the entity when on_punch is called if the tool isn't supposed to do damage.

Sorry, can't help much - but here is a relevant lua_api.txt link (Entity Damage System)

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1254
Avatar by :devnko-ennekappao:
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Wed Mar 09, 2016 00:42

I think this is more about the mobs api!

not about default Minetest api!

in my opinion that is a good point,
but i think is better blacklist the weapon when you hit it with a tool!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by stu » Wed Mar 09, 2016 15:11

MineYoshi wrote:I think this is more about the mobs api!

not about default Minetest api!

in my opinion that is a good point,
but i think is better blacklist the weapon when you hit it with a tool!

There is nothing in mobs api that can make the default gold sword less powerful towards a specific mob, sorry. I see two ways you can do it, either make the gold sword less powerful toward everything or you catch the mob's on_punch callback and process the damage yourself (as previously suggested) Neither the minetest nor any of the mob api's are capable of handling such obscure use cases. (afaik)
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Wed Mar 09, 2016 21:38

oh man....

i better say to PilzAdam if he can add the feature to the api!...

....
I can use the on_punch_callback i think that can work, but anyways i don't want that....
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

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

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by TenPlus1 » Thu Mar 10, 2016 09:02

So wait, you want certain mobs to be immune to specific tool types ? Like golden swords cannot damage dungeon masters for instance ???

Update: Mobs Redo 1.28 has new damage system added where mobs can be immune to certain weapons or healed by them (check out oerkki.lua file to see how)

viewtopic.php?f=11&t=9917
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Thu Mar 10, 2016 20:20

OK i will see now i have to replace some code....

THX a lot!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

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

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by TenPlus1 » Thu Mar 10, 2016 20:48

MineYoshi: if it helps remember that Mobs Redo is backwards compatible with SimpleMobs mobs.
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mobs Api Question] How to make a Mob inmune to a weapon

by MineYoshi » Thu Mar 10, 2016 23:13

OK, anyways i need to update some things too!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron