How to spawn an entity with lua?


#1

hi there :slight_smile:

i am making an addon for pmobs. there are some enemy guard and archer, who can fight against your troops. i am making a commander for my warriors. there are the same commands, as a normal guard, archer or healer. but, if i give a command, all the troops who belong to that commander, will do that what i said (clicked) . and i need to know that how to spawn troops, so the commander can be the “baaracks” (he will train troops)… -in hungary the “barack” word mean “peach”- … anyways, so if you know how, please paste it from a lua, or just tell me :wink:

i have cheked the api.lua, the spawner from mobs mod, and wiki of course. i need more information :stuck_out_tongue:

have a great day!


#2

The mobs mod provides a documented api you can follow / look how the other mobs are spawned / look how spawners spawn the mobs / look at the minetest dev wiki / look at the minetest api documentation / …


#3

yes that is where i shearched, but i didnt understand, or didnt find. the best is the spawner, but it is not good becoulse it is a block, the commander is an entyty. wont work. if you find it pls tell me :slight_smile:


#4

This sounds awesome! I am really excited to see this :thumbsup:


#5

I want to help jakab with this. One question: the spawner just uses minetest code to spawn units, or is the spawn procedure entirelly coded in lua? So, do I search for just a minetest api call, or an entire spawn section written in lua?


#6

do you mean the spawner uses api ? yes. it is coded in “mobs redo” mod. the mobs redo have all the “entity” thing. the default minetest dont know anything abaut entity’s if i right, we need an api call.
good idea thanks dad :smiley:


#7

You can use control+f in your browser to open the search function - makes it easier to find stuff like

…or look how the mobs_animals are spawned… example:

There are also wiki pages and stuff…


#8

thank you Milan :slight_smile:
nice if we have a “right” hand :smiley:


#9

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.