Page 1 of 1

help for mod![solved]

PostPosted: Mon Apr 11, 2016 10:27
by azekill_DIABLO
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
snapper:register_mob("snapper:snapper", {
   type = "monster",
   passive = false,
   attack_type = "dogfight",
   reach = 2,
   damage = 500,
   hp_min = 30,
   hp_max = 30,
   armor = 100,
   collisionbox = {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4},
   visual = "mesh",
   mesh = "snap.obj",
   textures = {
      {"snap.png"},
   },
   blood_texture = "default_mese_crystal.png",
   makes_footstep_sound = true,
   sounds = {
      random = "snap",
   },
   view_range = 25,
   walk_velocity = 3,
   run_velocity = 3,
   jump = true,
   drops = {
      {name = "default:mese_block",
      chance = 1, min = 5, max = 5},
   },
   water_damage = 0,
   lava_damage = 5,
   light_damage = 0,
   fear_height = 0,
})


when i start the game it says:
Image

what is the problem?

Re: help for mod!

PostPosted: Mon Apr 11, 2016 14:55
by Dragonop
You are using mobs_redo, right? Replace "snapper:register_mob" with "mobs:register_mob". Also check if it has mobs_redo added to depends.txt

Re: help for mod!

PostPosted: Mon Apr 11, 2016 16:48
by azekill_DIABLO
i'm not using mobs redo, i'm in a folder i called snappers

Re: help for mod!

PostPosted: Mon Apr 11, 2016 19:22
by Dragonop
Then from where are you getting that function (snapper:register_mob) ?

Re: help for mod!

PostPosted: Tue Apr 12, 2016 09:45
by azekill_DIABLO
me = noob!
i don't really know wat it is

Re: help for mod!

PostPosted: Tue Apr 12, 2016 14:25
by oleastre
Only predefined minetest functions are available to all mods.
The list and documentation is here :
https://github.com/minetest/minetest/bl ... ua_api.txt

The register_mob is a specific function defined by the mobs redo mod (and maybe other mobs mod).
So, to use it, you need to depend on that mod.

Re: help for mod!

PostPosted: Wed Apr 13, 2016 09:12
by azekill_DIABLO
i changed something but it won't work:
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
function snappers:register_entity("snappers:snapper",{
   type = "monster",
   passive = false,
   attack_type = "dogfight",
   reach = 2,
   damage = 500,
   hp_min = 30,
   hp_max = 30,
   armor = 100,
   collisionbox = {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4},
   visual = "mesh",
   mesh = "snap.obj",
   textures = {
      {"snap.png"},
   },
   blood_texture = "default_mese_crystal.png",
   makes_footstep_sound = true,
   sounds = {
      random = "snap",
   },
   view_range = 25,
   walk_velocity = 3,
   run_velocity = 3,
   jump = true,
   drops = {
      {name = "default:mese_block",
      chance = 1, min = 5, max = 5},
   },
   water_damage = 0,
   lava_damage = 5,
   light_damage = 0,
   fear_height = 0,
})

mobs:register_spawn("snappers:snapper", {"default:dirt_with_grass"}, 7, 0, 7000, 1, 31000)

mobs:register_egg("snappers:snapper", "The Big Snap", "default_mese_crystal.png", 1)


It says:
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
2016-04-13 11:20:42: ERROR[main]: ========== ERROR FROM LUA ===========
2016-04-13 11:20:42: ERROR[main]: Failed to load and run script from
2016-04-13 11:20:42: ERROR[main]: C:\Games\Minetest\bin\..\mods\snappers\init.lua:
2016-04-13 11:20:42: ERROR[main]: C:\Games\Minetest\bin\..\mods\snappers\init.lua:1: <name> or '...' expected near '"snappers:snapper"'
2016-04-13 11:20:42: ERROR[main]: ======= END OF ERROR FROM LUA ========
2016-04-13 11:20:42: ERROR[main]: Server: Failed to load and run C:\Games\Minetest\bin\..\mods\snappers\init.lua
2016-04-13 11:20:42: ERROR[main]: ModError: ModError: Failed to load and run C:\Games\Minetest\bin\..\mods\snappers\init.lua
2016-04-13 11:20:42: ERROR[main]: Error from Lua:
2016-04-13 11:20:42: ERROR[main]: C:\Games\Minetest\bin\..\mods\snappers\init.lua:1: <name> or '...' expected near '"snappers:snapper"'

Re: help for mod!

PostPosted: Wed Apr 13, 2016 10:48
by Dragonop
That funcion doesn't exists, where did you got it from?
Probably from mobs_redo. Mobs_redo is an API, that provides an easy way to add mobs to the game. Btw the code you added last is wrong, use the old one instead. Add depends.txt to your mod folder, then write "mobs" in it, save and close. Then download the "mobs" mod (mobs_redo), and enable it when starting a world with your mod.
When done, use this 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
mobs:register_mob("snapper:snapper", {
       type = "monster",
       passive = false,
       attack_type = "dogfight",
       reach = 2,
       damage = 500,
       hp_min = 30,
       hp_max = 30,
       armor = 100,
       collisionbox = {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4},
       visual = "mesh",
       mesh = "snap.obj",
       textures = {
          {"snap.png"},
       },
       blood_texture = "default_mese_crystal.png",
       makes_footstep_sound = true,
       sounds = {
          random = "snap",
       },
       view_range = 25,
       walk_velocity = 3,
       run_velocity = 3,
       jump = true,
       drops = {
          {name = "default:mese_block",
          chance = 1, min = 5, max = 5},
       },
       water_damage = 0,
       lava_damage = 5,
       light_damage = 0,
       fear_height = 0,
    })

"mobs:register_mob" is a mobs_redo specific function, that you can't use if you don't depend on that mod.

Re: help for mod!

PostPosted: Thu Apr 14, 2016 08:59
by azekill_DIABLO
ok thanks :)

Re: help for mod!

PostPosted: Thu Apr 14, 2016 10:47
by azekill_DIABLO
i've done everything you said it always says:

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
2016-04-14 12:40:56: ERROR[main]: mod "snappers" has unsatisfied dependencies:  "mobs"


but i have put the mod"MOBS_redo" in the same folder!(and i renamed it to mobs)
why it won't work??!

Re: help for mod!

PostPosted: Thu Apr 14, 2016 20:20
by Krock
azekill_DIABLO wrote:why it won't work??!

I'm not sure if the mobs redo is 1:1 compatible with the needed mobs mod.

Check your directory structure again, it must look like this:
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
    └── mods
         ├── snapper
               ├── init.lua
               ├── depends.txt
               └── <further files/directories>
         ├── mobs
               ├── init.lua
               ├── depends.txt
               └── <further files/directories>
         └── <any other mod..>

Re: help for mod!

PostPosted: Thu Apr 14, 2016 23:39
by Dragonop
azekill_DIABLO wrote:but i have put the mod"MOBS_redo" in the same folder!(and i renamed it to mobs)
why it won't work??!

Not in the same folder... in the mods folder.

Re: help for mod!

PostPosted: Fri Apr 15, 2016 10:37
by azekill_DIABLO
it's wat i've done but it was off :)


SOLVed