[Mod] Creatures [git] [minetest_mods_creatures]

Weslei
Member
Posts: 14
Joined: Sat Jun 21, 2014 20:57
Location: Brasil : Paraná é Noix euheuheuhe

Re: [Mod] Creatures [minetest_mods_creatures]

by Weslei » Post

"""Important: For the mod to work properly, you must first disable the default player script. To do that, open minetest_game/mods/default/init.lua and comment out the dofile line for player.lua."""

"""-- Load files
dofile(minetest.get_modpath("creatures").."/api_mobs.lua")
dofile(minetest.get_modpath("creatures").."/api_players.lua")
dofile(minetest.get_modpath("creatures").."/races.lua")"""

What should I do? I do not speak English
--------------- Brazil 5 world championships --------------------

============My Vote for an api in Python==================

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Change:

Code: Select all

dofile(minetest.get_modpath("default").."/player.lua")
To:

Code: Select all

--dofile(minetest.get_modpath("default").."/player.lua")

Weslei
Member
Posts: 14
Joined: Sat Jun 21, 2014 20:57
Location: Brasil : Paraná é Noix euheuheuhe

Re: [Mod] Creatures [minetest_mods_creatures]

by Weslei » Post

Code: Select all

creatures = {}

-- Determines whether two players or mobs are allies
function creatures:alliance(creature1, creature2)
	local creature1_teams = {}
	if creature1:get_luaentity() then
		creature1_teams = creature1:get_luaentity().teams
	elseif creature1:is_player() then
		local race = creatures:player_get(creature1)
		creature1_teams = creatures.player_def[race].teams
	end

	local creature2_teams = {}
	if creature2:get_luaentity() then
		creature2_teams = creature2:get_luaentity().teams
	elseif creature2:is_player() then
		local race = creatures:player_get(creature2)
		creature2_teams = creatures.player_def[race].teams
	end

	local common = 0
	for i, element1 in pairs(creature1_teams) do
		local element2 = creature2_teams[i]
		if element2 then
			common = common + (element1 * element2)
		end
	end
	common = math.min(1, math.max(-1, common))

	return common
end

-- Pipe the creature registration function into the player and mob api
function creatures:register_creature(name, def)
	creatures:register_mob(name, def)
	creatures:register_player(name, def)
end

-- Load files
dofile(minetest.get_modpath("creatures").."/api_mobs.lua")
dofile(minetest.get_modpath("creatures").."/api_players.lua")
dofile(minetest.get_modpath("creatures").."/races.lua")

-- Log mod
if minetest.setting_get("log_mods") then
	minetest.log("action", "creatures loaded")
end

Code: Select all

13:24:03: ERROR[main]: ========== ERROR FROM LUA ===========
13:24:03: ERROR[main]: Failed to load and run script from 
13:24:03: ERROR[main]: C:\Users\Weslei\Downloads\Java Development Kit 1.18\minetest\Minetest-0.4.9-dev3drpv2-PT_BR\Minetest 0.4.9\bin\..\mods\monter\init.lua:
13:24:03: ERROR[main]: ...v3drpv2-PT_BR\Minetest 0.4.9\bin\..\mods\monter\init.lua:40: attempt to concatenate a nil value
13:24:03: ERROR[main]: stack traceback:
13:24:03: ERROR[main]: 	...v3drpv2-PT_BR\Minetest 0.4.9\bin\..\mods\monter\init.lua:40: in main chunk
13:24:03: ERROR[main]: ======= END OF ERROR FROM LUA ========
13:24:03: ERROR[main]: Server: Failed to load and run C:\Users\Weslei\Downloads\Java Development Kit 1.18\minetest\Minetest-0.4.9-dev3drpv2-PT_BR\Minetest 0.4.9\bin\..\mods\monter\init.lua
13:24:03: ERROR[main]: ModError: ModError: Failed to load and run C:\Users\Weslei\Downloads\Java Development Kit 1.18\minetest\Minetest-0.4.9-dev3drpv2-PT_BR\Minetest 0.4.9\bin\..\mods\monter\init.lua
--------------- Brazil 5 world championships --------------------

============My Vote for an api in Python==================

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

I think you're commenting out code from my mod. I meant disabling the default player script in minetest_game. Don't comment out anything in the mod itself, just the specified line in minetest_game/mods/default/init.lua.

Weslei
Member
Posts: 14
Joined: Sat Jun 21, 2014 20:57
Location: Brasil : Paraná é Noix euheuheuhe

Re: [Mod] Creatures [minetest_mods_creatures]

by Weslei » Post

Screenshot http://prntscr.com/3x48g6

I do not speak English. Sorry for the inconvenience. I did what you said and it did not work.
--------------- Brazil 5 world championships --------------------

============My Vote for an api in Python==================

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Ok. That's weird then, this doesn't happen to me. I shall note to look more into it later. Maybe someone else can try, and also explain better what the issue is?

Weslei
Member
Posts: 14
Joined: Sat Jun 21, 2014 20:57
Location: Brasil : Paraná é Noix euheuheuhe

Re: [Mod] Creatures [minetest_mods_creatures]

by Weslei » Post

I will wait answers thanks for everything
--------------- Brazil 5 world championships --------------------

============My Vote for an api in Python==================

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Creatures [minetest_mods_creatures]

by prestidigitator » Post

Hmm. Just cloned from Git. Running with Minetest 0.4.9 with the the loading of 'player.lua' commented out, and a new world with only this mod enabled. Upon entering the world, I get the following error:

Code: Select all

ERROR: ...home/prestidigitator/.minetest/mods/creatures/api_players.lua:196:
attempt to index local 'race_settings' (a nil value)
EDIT: This mod doesn't appear to work in the 0.4.9 release in any case (see below). However, looking at the code I suspect this will not go away with a Minetest version change. I think it slipped in because the mod has continued to be tested against old worlds which already had a "races.txt" file in the world directory, using players which had already had settings saved by previous versions of the mod. For a completely general solution which doesn't depend on the order of events, I suggest having the creatures:player_get() method check whether there is an entry in creatures.player_settings for the player being queried, and if not return creatures.player_default. For example:

Code: Select all

if not creatures.player_settings[pname] then
   return creatures.player_default;
end
Last edited by prestidigitator on Mon Jun 30, 2014 02:27, edited 5 times in total.

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Creatures [minetest_mods_creatures]

by prestidigitator » Post

Also, it appears this mod will not work in release 0.4.9 because it calls the set_eye_offset(...) method of the player object, which was added after 0.4.9. It would be nice if version requirements were added to the top post of the thread.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Thank you for reporting that issue prestidigitator, I attempted a fix in GIT. That function executing before player settings are present was probably low probability, which is why I didn't notice it. That code should not execute if race settings don't exist, since we don't want it to apply the settings of another creature either (even default).

As for set_eye_offset, it's a fundamental feature of this mod. Maybe I could add a version check behind it, but I'm not sure if I'd even want the mod to be able to run without it. I will consider this.

What is the exact check I should add however, to know a specific player's client version? I only run the latest GIT and cannot test it myself. Also, shouldn't the engine simply ignore Lua functions that don't exist for an older client? If I remember correctly, that's what protocol versions are for, so this shouldn't cause a crash.

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Creatures [minetest_mods_creatures]

by prestidigitator » Post

Sure thing. Hmm. It would probably be difficult to figure out what methods are stored on player objects when loading the mod, so you could possibly check for a certain API function that's been added since 0.4.9 being non-nil at the beginning of the init.lua. But I was more just thinking it would be good to say it requires the latest dev version and won't work in 0.4.9 here at the top of the thread, where you'd normally list required dependencies and all that. Once 0.4.10 comes out you could say it requires that release version or later.

Great idea for a mod, by the way! I should've said that first off.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Okay, so it's been a few days since I fixed the last reported bug. This mod is very relevant to future plans I have for Minetest, so I'd like to hear even more feedback. If anyone likes its ideas enough, please make a public server with this and mention it here! Possibly one where at least 5 players are online at once for several hours.

First of all I wish to catch all potential bugs of any sort, which requires even more extensive testing. Especially since as far as I know, this was never tested in multiplayer! I'd also like to hear more opinions on functionality that can be changed or things that might not be working as intended, or simply what others would like to see added.

As mentioned, I am open to pull request if anyone wishes to correct something. Any bugfix will likely be accepted (if you solve something before me) but I might not add functionality changes unless I agree with them.

Also, while it's possible and easy to design your own creatures, I advice everyone to wait and stick with the default mobs, as I might make changes to the API. If you want to see new mobs, I advice just sending me the textured model (note down animation ranges too) which I will gladly add if license compatible, of quality, and artistically fitting.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Didn't have much to do today, so I made a few more changes. The biggest one is that I moved the mob AI and player logics to different files, while allowing each creature to define the functions. This makes mobs / players fully scriptable without changes to the mod! You can add your own AI and disable the SimpleMobs logics, or execute code before / after it. Previously, only on_rightclick was customizable... whereas now on_step / on_punch / on_activate / on_rightclick are all configurable for mobs, while player_join / player_step / player_die / player_respawn can also be scripted for player versions of creatures. Only the base system remains hard-coded, such as application and persistence of player settings and the basic entity definitions for mobs.

Note that you now possess mobs by right-clicking them, as this has become the default on_rightclick action. No more punching random creatures and getting in trouble for hitting a mob that wasn't willing to be possessed.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Creatures [minetest_mods_creatures]

by paramat » Post

I haven't tried this yet, but i think the whole concept is excellent.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

paramat wrote:I haven't tried this yet, but i think the whole concept is excellent.
Thank you, glad you like! I know I'm being repetitive, but right now I'm waiting for anyone willing to make a public server with this. I need to test the mod online with multiple players at least a bit, before I can make an initial release version. If anyone wishes to help and makes one, please mention it here.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Creatures [minetest_mods_creatures]

by Sokomine » Post

Good luck with finding a server! It'd be very intresting to test this out on one.
A list of my mods can be found here.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Sokomine wrote:Good luck with finding a server! It'd be very intresting to test this out on one.
Well, I'm not expecting servers running this mod to grow on trees, so being lucky to find one isn't the problem as much as being lucky to find someone both willing to host a server and who likes this mod. I asked VanessaE but don't think she's interested in this mod, so I'm looking for other server admins who might be.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

I separated the code and default creature set into two different mods (the repository is now a mod pack). This will allow people to add their own mini-mods on top of Creatures, as well as easily disable the default creature set if they wish to add their own (without editing the mod, just server settings). Note that entity definitions have once again changed, so you will need to create a new world or do another object wipe.

Oh, and did I mention the new snow monster added yesterday? Snow monsters will spawn in snowy biomes, for people who are using this together with a Mapgen V7 mod that adds those biomes.

Image

Image

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

celeron55 added the Creatures mod to his testing server. We gave it a test spin for a few minutes, and everything seems to work very nicely! If anyone else wants to join in and see it in action, the server is minetest.8dromeda.net (default port).

This has already resulted the first change based on experience from another server. I noticed that I couldn't run, and realized that servers doesn't normally give users the "fast" privilege which I always offer to myself in singleplayer. Mobs could however use fast, making it impossible for the player to escape them and also illogical. Therefore, mobs can no longer run by default. To change this, add "fast_mobs = true" in minetest.conf. You should do this if your server or game offers players the "fast" privilege by default, to guarantee that mobs and players have the same abilities.

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

I just committed the last step in making the Creatures system a fully customizable platform, on top of which other developers can create their own mods. A custom field can now be defined for creatures, which lets you add your own player / mob properties of any type to be used in such mods, in the following format:

Code: Select all

custom = {mymod = {param1 = "test", param2 = 0, ...} ...}
On top of that, I've made sure that the builtin functions and personality traits can also contain custom properties. So if you make a sub-mod that requires new mob personalities, you can add those extra personalities in the existing traits field. Also, you can add your own per-creature functions easily, by defining those functions in your mod then including them in on_step / player_step / etc. For example, you can add a mymod_player_die after the logic_player_die line. See the api.txt file for more info.

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: [Mod] Creatures [minetest_mods_creatures]

by philipbenr » Post

I like how you are a ghost at the beginning, but here is another thing I would suggest; Pick some nicer looking skins off the MT skin database: http://minetest.fensta.bplaced.net/ Some are a bit too plain.

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: [Mod] Creatures [minetest_mods_creatures]

by HeroOfTheWinds » Post

Any chance of ever being able to possess Dungeon Masters? :3 If so, +1000. Having unlimited fireballs would be massive...
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

HeroOfTheWinds wrote:Any chance of ever being able to possess Dungeon Masters? :3 If so, +1000. Having unlimited fireballs would be massive...
I believe this is already possible. But unlikely, since DM's have a low loyalty and are therefore unlikely to follow a ghost.

Also, even if you possess one, it won't be possible to throw fireballs as a player. Attacks are one thing that remains mob specific, because players use tools instead. This will be fixed when I'll allow mobs to use items and tools, and disable coded mob attacks. In the case of the DM, the fireball thrower shall become an item (like the bow mod).

bbaez
Member
Posts: 51
Joined: Wed Jul 09, 2014 15:24

Re: [Mod] Creatures [minetest_mods_creatures]

by bbaez » Post

Hi everyone,

I need some clarification on this creatures mod. I just installed [Mod] Creatures [1.1.3 beta] [creatures] by BlockMen because my 8 year old and younger children want to get wool and didn't like the zombies from Zombie Waves. So is this creatures mod different than BlockMen's (sure looks like it)? Also, I found this mod from the post "Inocudom » Sat May 10, 2014 14:09" in New Mobs when searching to add horses and bees that my daughters want. I have BlockMen's creatures mod installed at the game server I am hosting on fw01.treslagos.org:30000. I set up MineTest so that I can have a place for my kids (and now the kids from school are joining in) that is better suited for young-ins that just want to build for the most part.

I have the following mods installed in addition to what comes with minetest_game. I just compiled and migrated to 0.4.10 last night.
  • animals_modpack
    cannons
    factions
    moreblocks
    snow
    weather
    beds
    carts
    inventory_plus
    moreores
    snowdrift
    zombies
    boats
    creatures
    skins
    torches
Also, here is my world.mt

Code: Select all

gameid = minetest
#backend = sqlite3
redis_address = localhost
redis_port = 6379
redis_hash = minetest
load_mod_animal_big_red = true
load_mod_animal_chicken = true
load_mod_animal_clownfish = true
load_mod_animal_cow = true
load_mod_animal_creeper = true
load_mod_animal_deer = true
load_mod_animal_dm = false
load_mod_animal_fish_blue_white = true
load_mod_animal_gull = true
load_mod_animal_rat = true
load_mod_animal_sheep = false
load_mod_animal_vombie = true
load_mod_animal_wolf = false
load_mod_animalmaterials = true
load_mod_barn = true
load_mod_factions = true
load_mod_mob_archer = false
load_mod_mob_guard = true
load_mod_mob_npc = true
load_mod_mob_oerkki = true
load_mod_mob_ostrich = true
load_mod_mob_shark = true
load_mod_mob_slime = false
load_mod_mobf = true
load_mod_mobf_settings = true
load_mod_trap = false
load_mod_zombies = false
load_mod_beds = true
load_mod_cannons = true
load_mod_moreores = true
load_mod_carts = true
load_mod_boats = true
load_mod_inventory_plus = true
load_mod_skins = true
load_mod_weather = false
load_mod_moreblocks = false
load_mod_snow = true
load_mod_snowdrift = true
load_mod_creatures = true
I will add this creatures to my server so we can all test, but need guidance if there will be conflicts if this is different than BlockMen's. I have been constantly "developing" our MineTest server for the past week with GitHub releases and memory/CPU upgrades to the point I had a rebellion with my kids at hand (they were upset with home IT and server crashes :) Don't want to bring them down today since I promised it should not crash.

Thanks for MineTest and all the mods!

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Creatures [minetest_mods_creatures]

by prestidigitator » Post

MirceaKitsune wrote:
HeroOfTheWinds wrote:...it won't be possible to throw fireballs as a player. Attacks are one thing that remains mob specific, because players use tools instead. This will be fixed when I'll allow mobs to use items and tools, and disable coded mob attacks. In the case of the DM, the fireball thrower shall become an item (like the bow mod).
Have to tried overriding the default hand item (":") to give an on_use callback (or maybe after_use or on_place so the default dig/damage functionality isn't messed with) that checks your creature type? Not SURE it will work, but it might be worth a try.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests