Jump to content
  • 0

[Solve] Quest - NPC spawn-disapear


Maxlam

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

/bo

Hello everyone

I'm working on a quest and I need a final NPC for my goal...I searched on the forum and on the scripting ressources without any solution that I can understand.

There is what I want :

- A NPC is alone in a room, when the player talk to him, the NPC speak and disapear, then spawn a Monster.

- If no player are in the room anymore, the monster die (no-drop) and the npc re-apear.

- If the monster die (by players), the player(s) are teleported, then the NPC re-apear.

- So, Players CANNOT spawn more than 1 monster in same time/room.

Thanks alot and have a great day

/ok

Maxlam

Edited by Maxlam
Link to comment
Share on other sites

15 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Use these script commands:

mes "Monster has summoned, see ya!";
set .GameOn, 1;
hideonnpc;

monster "special_map",150,150,"Special Poring",1002,1,"OnThisMobDeath";

OnThisMobDeath:
hideoffnpc;
set .GameOn, 0;

// To check player's in room
// Infinite check:
while (.GameOn == 1) {
sleep 5000; // 5 secs per check
if (getmapusers("special_map") < 1) {
 killmonsterall "special_map";
 hideoffnpc;
 end;
}
end;
}

This is not complete, just use these elements.

Edited by darristan
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

@Darristan :

I'm not sure how to warp people after. I like the script, but will try after the one of Emistry. Thanks alot to help me.

@Emistry :

I'm just trying this one and editing some stuff...I will edit the post if it is working, thanks !

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

You have a PN.^^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

I just tried the script from Emistry ! All is working perfectly EXCEPT one thing : When I kill the monster, I'm not teleported...why so ?

Nexus6,75,63,2 script Esprit Tourmente 802,{
if( mobcount( strcharinfo(3),strnpcinfo(0)+"::OnKilled" ) ){
npctalk "Vous ne pouvez pas vaincre mon corps !";
}else{
mes "[Esprit Tourmente]";
mes "M'y voilà enfin !";
mes "Cet étage va me permettre de me transformer.";
close2;
hideonnpc strnpcinfo(0);
monster strnpcinfo(4),-1,-1,"Esprit Tourmenté",2353,1,strnpcinfo(0)+"::OnKilled";
initnpctimer;
}
end;

OnKilled:
mapwarp strnpcinfo(4),"Zaz_Fild4",106,56;
OnTimer5000:
initnpctimer;
if( !mobcount( strnpcinfo(4),strnpcinfo(0)+"::OnKilled" ) || !getmapusers( strnpcinfo(4) ) ){
killmonster strnpcinfo(4),"All";
hideoffnpc strnpcinfo(0);
stopnpctimer;
}
end;
}

[EDIT] : Thanks @WhiteEagle, I got it too late ! But I don't need any item/count/announce and the script from Emistry is really good. But, a great thanks to you too. I'm waiting help for this one...

Edited by Maxlam
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

OnKilled:
mapwarp "Nexus6","Zaz_Fild4",106,56;
end;

If you ask, of course strnpcinfo(4) works too but you can always try in different way to avoid conflicts and there's a missing End; after warp.

Edited by darristan
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

I'm not how different are the "strnpcinfo(4)" and the "strnpcinfo(0)"...but players aren't teleport with the "OnKilled" right now. And now, when no player are in the room, the Monster don't die (He was yesterday Ôo).

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

the script work fine when i test in my test server ...

are you using rAthena ?? if i am not mistaken....Strnpcinfo with value 4 isnt added in eA .....

if you are not using rAthena...then change all

strnpcinfo(4)

to

the map name where the NPC is located.

If you ask, of course strnpcinfo(4) works too but you can always try in different way to avoid conflicts and there's a missing End; after warp.

it's not a missing end problem...i script it in that way purposely.....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Oops pardon me :P but wouldn't it will led into OnTimer5000 label and re-initialize timer?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

I'm not sure to understand : there is a "strcharinfo(3)" and many (4), do I have to change them all for "Nexus6" ? Thats look risky lol

Yes, I'm using "eAthena-SQL-15074[Trunk]"

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Only change strnpcinfo(4) to "Nexus6". Example:

mapwarp strnpcinfo(4),"Zaz_Fild4",106,56;
to
mapwarp "Nexus6","Zaz_Fild4",106,56;

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

I'm not sure to understand : there is a "strcharinfo(3)" and many (4), do I have to change them all for "Nexus6" ? Thats look risky lol

read the post again ...

are you using rAthena ?? if i am not mistaken....Strnpcinfo with value 4 isnt added in eA .....

if you are not using rAthena..then change All

strnpcinfo(4)

to

the map name where the NPC is located.


Oops pardon me :P but wouldn't it will led into OnTimer5000 label and re-initialize timer?

the timer will still stopped when there is no player inside the map...or the monster is killed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

Not working :(

Nexus6,75,63,2 script Esprit Tourmente 802,{
if( mobcount( strcharinfo(3),strnpcinfo(0)+"::OnKilled" ) ){
npctalk "Vous ne pouvez pas vaincre mon corps !";
}else{
mes "[Esprit Tourmente]";
mes "M'y voilà enfin !";
mes "Cet étage va me permettre de me transformer.";
close2;
hideonnpc strnpcinfo(0);
monster "Nexus6",-1,-1,"Esprit Tourmenté",2353,1,strnpcinfo(0)+"::OnKilled";
initnpctimer;
}
end;
OnKilled:
mapwarp "Nexus6","Zaz_Fild4",106,56;
OnTimer5000:
initnpctimer;
if( !mobcount( "Nexus6",strnpcinfo(0)+"::OnKilled" ) || !getmapusers( "Nexus6" ) ){
killmonster "Nexus6","All";
hideoffnpc strnpcinfo(0);
stopnpctimer;
}
end;
}

Edited by Maxlam
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

if it's not working please specify what is not working ..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

Same thing...I showed you the script : When I kill the Monster, I'm not warped :s (Everything work except that)

Nexus6,75,63,2 script Esprit Tourmente 802,{
if( mobcount( strcharinfo(3),strnpcinfo(0)+"::OnKilled" ) ){
npctalk "Vous ne pouvez pas vaincre mon corps !";
}else{
mes "[Esprit Tourmente]";
mes "M'y voilà enfin !";
mes "Cet étage va me permettre de me transformer.";
close2;
hideonnpc strnpcinfo(0);
monster "Nexus6",-1,-1,"Esprit Tourmenté",2353,1,strnpcinfo(0)+"::OnKilled";
initnpctimer;
}
end;
OnKilled:
mapwarp "Nexus6","Zaz_Fild4",106,56;
OnTimer5000:
initnpctimer;
if( !mobcount( "Nexus6",strnpcinfo(0)+"::OnKilled" ) || !getmapusers( "Nexus6" ) ){
killmonster "Nexus6","All";
hideoffnpc strnpcinfo(0);
stopnpctimer;
}
end;
}

I tried to change "mapwarp" for "warp", nothing.

I tried to change "strcharinfo(3)" for "Nexus6", nothing.

The map is really "Nexus6" and the other one "Zaz_Fild4" without error.

[EDIT]

I change the stuff and if the player got the 100% item on monster, he will be teleported...Thanks alot !

Edited by Maxlam
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...