npc Spawner

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

npc Spawner

by jojoa1997 » Sat Dec 15, 2012 18:38

Can someone make a spawner for npc's. this might help. http://minetest.net/forum/viewtopic.php?id=2764
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sat Dec 15, 2012 19:15

I already made one a while back, i'll make one again in a bit
If you can think it, you can make it.
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sat Dec 15, 2012 19:24

i was able to make it by changing the names from animal_vombie:vombie to npc:npc but i could not hit the blocks or the game would crash
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sat Dec 15, 2012 20:24

jojoa1997 wrote:i was able to make it by changing the names from animal_vombie:vombie to npc:npc but i could not hit the blocks or the game would crash

Here's a simple one
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
use_mesecons = false

function npc_spawner(pos)
    minetest.env:add_entity({x=pos.x+math.random(-1,1),y=pos.y+math.random(2,3),z=pos.z+math.random(-1,1)}, "npc:npc")
end
if use_mesecons == true then
    minetest.register_node("npc:npc_spawner", {
        description = "Box 'O NPCs",
        drawtype = "glasslike",
        groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
        sounds = default.node_sound_wood_defaults(),
        tiles = {"default_glass.png"},
        sunlight_propagates = true,
        param2 = "light",
        mesecons = {effector = {
            action_on = npc_spawner
        }}       
    })
end

if use_mesecons == false then
    minetest.register_node("npc:npc_spawner", {
        description = "Box 'O NPCs",
        drawtype = "glasslike",
        groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
        sounds = default.node_sound_wood_defaults(),
        tiles = {"default_glass.png"},   
        sunlight_propagates = true,
        param2 = "light",
    })
    minetest.register_abm({
        nodenames = {"npc:npc_spawner"},
        interval = 1.0,
        chance = 20,
        action = function(pos)
            npc_spawner(pos)
        end,
    })
end
If you can think it, you can make it.
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sat Dec 15, 2012 21:46

what is with the mesecons
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sat Dec 15, 2012 21:47

and where do i put this
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sat Dec 15, 2012 22:43

jojoa1997 wrote:and where do i put this

at the end of the npc init.lua
If you can think it, you can make it.
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sun Dec 16, 2012 01:09

it works great thank you
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
cornellius
Member
 
Posts: 82
Joined: Sat Dec 01, 2012 05:08

by cornellius » Fri Dec 21, 2012 02:39

how about the textures of the spawner??
All Humans Need Is Forgiveness, God Is The First One Who Forgive All Humans So Humans Must Forgive Other Humans
 

tinoesroho
Member
 
Posts: 570
Joined: Fri Feb 17, 2012 21:55

by tinoesroho » Fri Dec 21, 2012 21:40

It appears that the texture is the same as default_glass. I personally use the nyancat texture - with fun results on my home server - but....
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

by jojoa1997 » Sat Dec 22, 2012 01:44

i have a texture but i cant get it to be clear the clear spots are white.
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

tinoesroho
Member
 
Posts: 570
Joined: Fri Feb 17, 2012 21:55

by tinoesroho » Mon Dec 24, 2012 20:36

Use GIMP or another program that can handle PNG transparency (not Paint), select those spots and hit the delete key.

@jordan4ibanez: Thanks!
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 84 guests

cron