Automatic Bloody Branch Spawn

simhr

New member
Messages
16
Points
0
Hello,

currently i'm trying to develop a script that automatically spawns one random boss monster (out of bloody branch) on a given map. As soon as it gets killed it should wait for one hour to respawn another random boss monster.

Does anyone know why:

1. I'm not able to use the 'strnpcinfo'-commands below. I get an error that no player is attached, but i don't understand why there should be one, since i'm just querying the map of the npc and its unique name?

2. As soon as a boss monster is killed there should also spawn a tomb at the position where the monster was killed. It should disappear as soon as another boss monster spawns on the map. Is there a command to spawn a tomb? (Or to spawn and to remove a random self-scriped npc? I only found a code snippet for spawning a tomb in the map.c source file)

Here's my script:

- script SpawnPvE FAKE_NPC,{
OnInit:
// init map
callfunc("mobspawn", 0, strnpcinfo(NPC_MAP), strnpcinfo(NPC_NAME_UNIQUE));
end;

// when a player kills a monster
OnMonsterDead:
callfunc("mobspawn", 3600000, strnpcinfo(NPC_MAP), strnpcinfo(NPC_NAME_UNIQUE));
end;
}

function script mobspawn {
.@timeout = getarg(0);
.@map$ = getarg(1);
.@npcname$ = getarg(2);

if (mobcount(.@map$, "all") < 1) {
sleep(.@timeout);
// bloody branch spawn
monster(.@map$,0,0,--en--,-3,1,.@npcname$+"::OnMonsterDead");
}
}

pvp_n_3-1,0,0,0 duplicate(SpawnPvE) SpawnPvE#1 FAKE_NPC
pvp_n_3-2,0,0,0 duplicate(SpawnPvE) SpawnPvE#2 FAKE_NPC
pvp_n_3-3,0,0,0 duplicate(SpawnPvE) SpawnPvE#3 FAKE_NPC
pvp_n_3-4,0,0,0 duplicate(SpawnPvE) SpawnPvE#4 FAKE_NPC
pvp_n_3-5,0,0,0 duplicate(SpawnPvE) SpawnPvE#5 FAKE_NPC



Thanks for your help!

-simh

 
You just forget to put some "
default_smile.png


--ja--, is suppose to be a string, here you're trying to access the --ja-- player variable. That's why it throw you a "no player is attached"
default_smile.png


Juste change --ja-- to "--ja--" and it will be ok

 
You just forget to put some "
default_smile.png


--ja--, is suppose to be a string, here you're trying to access the --ja-- player variable. That's why it throw you a "no player is attached"
default_smile.png


Juste change --ja-- to "--ja--" and it will be ok
Thanks for your reply, but i still get an error. In the meantime i replaced NPC_MAP with 4 and NPC_NAME_UNIQUE with 3. Now i don't get the error that a character is not attached. Instead i get the error that the map "" can't be found.

There must still be some issue with the strnpcinfo()-command in my script, but i don't know which.

 
Last edited by a moderator:
You should go back to NPC_MAP and NPC_NAME_UNIQUE, this is recommended way of scripting.

Your error is just because of your main npc, the one which is duplicate. He also hit the OnInit label, so as you didn't set a map for this one you're getting your error
default_smile.png


Just put something like this:

if(strnpcinfo(NPC_MAP) == "") end;

Just after the OnInit label.

 
You should go back to NPC_MAP and NPC_NAME_UNIQUE, this is recommended way of scripting.

Your error is just because of your main npc, the one which is duplicate. He also hit the OnInit label, so as you didn't set a map for this one you're getting your error
default_smile.png


Just put something like this:

if(strnpcinfo(NPC_MAP) == "") end;

Just after the OnInit label.
Thank you
default_smile.png
Now i put the following line in my OnInit-Event and it works.

if(strnpcinfo(3) == "" || strnpcinfo(4) == "") end;

If i put one of the values NPC_MAP, NPC_NAME_UNIQUE or "NPC_MAP" and "NPC_NAME_UNIQUE" it throws the error that no character is attached.

Do you know a way to spawn a tomb? I couldn't find a different "monster" command to spawn an MvP. (Since permanent mvp spawns are marked as bossmonsters, i think this is the reason why no tomb is spawned upon death of my spawned mvp)

 
Last edited by a moderator:
You should update your emulator, if using constant like NPC_MAP throw a "no character is attached" it may be because they are not defined (because you don't have an updated version of the emulator
default_smile.png
) and so it tries to get a player variable with the name NPC_MAP (and so it throw an error).

You can't have a tomb with a monster spawn with the *monster command, because of they way its coded in the emulator. You need to make a permanent monster spawn using boss_monster, unless you specify this boss_monster, you won't have your tomb.

I looked to see if you could spawn it with a permanent monster spawn, but here the problem would be to spawn a "Bloody Dead Branch" mob since you can't put a "-3"

 id for a permanent monster spawn.

 
You should update your emulator, if using constant like NPC_MAP throw a "no character is attached" it may be because they are not defined (because you don't have an updated version of the emulator
default_smile.png
) and so it tries to get a player variable with the name NPC_MAP (and so it throw an error).
Thanks, i think that will fix it! (I can't try it though, because i have merge conflicts and don't know how to solve them yet without losing most of my changes)
You can't have a tomb with a monster spawn with the *monster command, because of they way its coded in the emulator. You need to make a permanent monster spawn using boss_monster, unless you specify this boss_monster, you won't have your tomb.
Yes.. I feared that :/
I looked to see if you could spawn it with a permanent monster spawn, but here the problem would be to spawn a "Bloody Dead Branch" mob since you can't put a "-3"

 id for a permanent monster spawn.
I thought about that, but came to the same solution
default_sad.png

So the only thing i could do is to customize the *monster-command so that i can choose to summon a monster as boss_monster. Or to spawn tomb-npcs by hand (if this is possible).

Thank you very much for your help!
default_smile.png


 
Last edited by a moderator:
Daaaaaamn, never tough about spawning tomb npc xD Don't know why ^^'

So yeah you can do this, i checked in src and it appears that you can use MOB_TOMB as sprite id for your npc
default_smile.png


So you can build and customize your own tomb
default_smile.png


 
Daaaaaamn, never tough about spawning tomb npc xD Don't know why ^^'

So yeah you can do this, i checked in src and it appears that you can use MOB_TOMB as sprite id for your npc
default_smile.png


So you can build and customize your own tomb
default_smile.png
No problem
default_biggrin.png
Thanks again! I'm still at the beginning of learning how to create some custom scripts, so i just threw some random ideas in
default_biggrin.png


Do you know the commands for spawning and removing a npc from the map?

 
You just need to write your npc as a normal npc, then you disable it with *disablenpc, and you can enable it with *enablenpc
default_smile.png


You can also look for Dastgir duplicate-npc plugins

 
You just need to write your npc as a normal npc, then you disable it with *disablenpc, and you can enable it with *enablenpc
default_smile.png


You can also look for Dastgir duplicate-npc plugins
Ahh thank you, so i can only enable and disable it :/

I think i will better try to change the monster command in the source-file. Because my 'extended' requirement was to be able to spawn a random MVP on a random map. If i do this with the enablenpc and disablenpc commands i'd have to write a duplicate-npc for every map (though only one npc is active at the same time) and move that npc to the coordinates of the defeated mvp. That would make my script way more complicated..

Thank you so much for your help!

 
No problem
default_smile.png


By the way here is a little gift, give a try to this: http://pastebin.com/WLVXSjRe

You'll need to change the constant to number if you didn't update your emulator yet
default_smile.png


NPC_NAME = 0

NPC_NAME_HIDDEN = 2

NPC_MAP = 4

PC_NAME = 0
Thanks again
default_biggrin.png
I guess you saved me hours of time. I will try it and give you feedback as soon as possible (I'm currently on a business trip).

 
Back
Top