Jump to content
  • 0

Please help on this script regarding event trigger on monster


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

hello can anybody help me with this script?
 

 
	//--- Guardian Hunter 1.1.2 --------------------------------------//
//----------------------------------------------------------------//
//    ttt              000000000
//    ttt              000   000
// ttttttttt rrrrrrrrr 000   000 nnnnnnnnn
//    ttt    rrr       000   000 nnn   nnn
//    ttt    rrr       000   000 nnn   nnn
//    ttt    rrr       000   000 nnn   nnn
//    ttttt  rrr       000000000 nnn   nnn
//----------------------------------------------------------------//
//--- Changelogs: ------------------------------------------------//
// 1.0.0 Release
// 1.0.1 Fixed first monster spawn
// 1.1.1 Added '@currentroom$' into monsterspawn to prevent
//       spawning mobs outside guardian rooms after fast relog
// 1.1.1 Added 'x Guardians left' notification after every kill
// 1.1.1 Changed '(0/1)' & '(1/1)' into '(Free)' & '(Full)'
// 1.1.2 Added autowarp after death
//----------------------------------------------------------------//
//--- Main Script ------------------------------------------------//
prontera,144,168,5    script    Guardian Hunter    852,{
	    //Guardian Hunter Rooms
    setarray .hunterrooms$[0], "06guild_01", "06guild_02", "06guild_03", "06guild_04", "06guild_05";
    
    //Guardian Hunter Monsters
    setarray .guardianmobs[0], 1286, 1285, 1287;
    
    //Reward for every kill (Zeny)
    set .guardianreward, 125000;
	    mes "[^FF7700Guardian Hunter^000000]";
    mes "Welcome ^0000ff"+strcharinfo(0)+"^000000,";
    mes "How can i help you?";
    next;
    switch(select("Select Rooms:View Top 10:Exit"))
    {
    
case 1:
    mes "^FF7700[Guardian Hunter]^000000";
    mes "Please select a room.";
    
    set .@guardianmenu$, "";
    for(set .@i, 0; .@i < getarraysize(.hunterrooms$); set .@i, .@i + 1)
    {
        if (.@i) set .@guardianmenu$, .@guardianmenu$+":";
        if (getd(".room_"+.@i)==1) { set .@guardianmenu$, .@guardianmenu$ + "Room "+(.@i+1)+ " ^FF0000(Full)^000000"; }
        else { set .@guardianmenu$, .@guardianmenu$ + "Room "+(.@i+1)+ " ^00BB00(Free)^000000"; }
    }
    set @selection,select(.@guardianmenu$)-1;
    if(getd(".room_"+@selection)==1)
    {
        next;
        mes "^FF7700[Guardian Hunter]^000000";
        mes "I'm sorry, but this room is full.";
        close;
    }
    else
    {
        setd(".room_"+@selection), 1;
        set @currentroom$, .hunterrooms$[@selection];
        set @monstercount, 1;
        killmonsterall .hunterrooms$[@selection];
        monster .hunterrooms$[@selection],0,0,"--ja--",.guardianmobs[rand(0,(getarraysize(.guardianmobs)-1))],1;
        warp .hunterrooms$[@selection],0,0;
        end;
    }
    
case 2:
    close2;
    dispbottom "[TOP 10]";
    dispbottom "--------------------------------";
    query_sql "SELECT `username`, `rounds` FROM `guardian_toplist` ORDER BY `rounds` DESC LIMIT 10", .@guardnames$, .@guardrounds;
    for(set .@i, 1; .@i < 11; set .@i, .@i+1)
    {
        dispbottom (.@guardnames$[.@i-1]=="")?"["+.@i+".] - empty":"["+.@i+".] - "+.@guardnames$[.@i-1]+" - "+.@guardrounds[.@i-1]+" rounds";
    }
    end;
    
case 3:
    mes "^FF7700[Guardian Hunter]^000000";
    mes "Have a nice day.";
    close;
    }
    
OnNPCKillEvent:
    for(set @i, 0; @i < getarraysize(.hunterrooms$); set @i, @i + 1)
    {
        if(strcharinfo(3)==.hunterrooms$[@i])
        {
            set Zeny,Zeny+.guardianreward;
            if(mobcount(.hunterrooms$[@i],"all")==0)
            {
                set @guardianrounds, @guardianrounds + 1;
                dispbottom "[Guardian Hunter] : Round "+@guardianrounds+" finished.";
                sleep2 3000;
                dispbottom "[Guardian Hunter] : Next round starts!";
                goto OnSpawnGuardians;
            }
            set @guardiankill, @guardiankill+1;
            dispbottom "[Guardian Hunter] : " + (@monstercount-@guardiankill) + " Guardian(s) left.";
            end;
        }
    }
    end;
    
OnSpawnGuardians:
    set @monstercount, @monstercount + 1;
    set @guardiankill, 0;
    for(set @i, 0; @i < @monstercount; set @i,@i+1)
    {
        monster @currentroom$,0,0,"--ja--",.guardianmobs[rand(0,(getarraysize(.guardianmobs)-1))],1";
    }
    end;
    
OnPCDieEvent:
    for(set @i, 0; @i < getarraysize(.hunterrooms$); set @i, @i + 1)
    {
        if(strcharinfo(3)==.hunterrooms$[@i])
        {
            query_sql "SELECT `rounds` FROM `guardian_toplist` WHERE `username`='"+strcharinfo(0)+"'", @myrounds;
            if(@guardianrounds>@myrounds) query_sql "REPLACE INTO `guardian_toplist` (`username`, `rounds`) VALUES ('"+strcharinfo(0)+"', "+@guardianrounds+")";
            setd(".room_"+@i), 0;
            dispbottom "[Guardian Hunter] : You died and won "+@guardianrounds+" rounds!";
            set @guardianrounds, 0;
            set @guardiankill, 0;
            killmonsterall .hunterrooms$[@i];
            warp "SavePoint",0,0;
        }
    }
    end;
	OnPCLogoutEvent:
    getmapxy(@map$,@x,@y,0);
    for(set @i, 0; @i < getarraysize(.hunterrooms$); set @i, @i + 1)
    {
        if(@map$==.hunterrooms$[@i])
        {
            query_sql "SELECT `rounds` FROM `guardian_toplist` WHERE `username`='"+strcharinfo(0)+"'", @myrounds;
            if(@guardianrounds>@myrounds) query_sql "REPLACE INTO `guardian_toplist` (`username`, `rounds`) VALUES ('"+strcharinfo(0)+"', "+@guardianrounds+")";
            killmonsterall .hunterrooms$[@i];
            setd(".room_"+@i), 0;
        }
    }
    end;
    
OnInit:
    query_sql "CREATE TABLE IF NOT EXISTS `guardian_toplist` (`username` CHAR(50) NOT NULL, `rounds` INT NOT NULL, PRIMARY KEY (`username`))";
    end;
}
06guild_01    mapflag    nocommand
06guild_02    mapflag    nocommand
06guild_03    mapflag    nocommand
06guild_04    mapflag    nocommand
06guild_05    mapflag    nocommand
06guild_01    mapflag    nosave    SavePoint
06guild_02    mapflag    nosave    SavePoint
06guild_03    mapflag    nosave    SavePoint
06guild_04    mapflag    nosave    SavePoint
06guild_05    mapflag    nosave    SavePoint
06guild_01    mapflag    nomemo
06guild_02    mapflag    nomemo
06guild_03    mapflag    nomemo
06guild_04    mapflag    nomemo
06guild_05    mapflag    nomemo
06guild_01    mapflag    noexp
06guild_02    mapflag    noexp
06guild_03    mapflag    noexp
06guild_04    mapflag    noexp
06guild_05    mapflag    noexp
06guild_01    mapflag    noreturn
06guild_02    mapflag    noreturn
06guild_03    mapflag    noreturn
06guild_04    mapflag    noreturn
06guild_05    mapflag    noreturn
06guild_01    mapflag    nodrop
06guild_02    mapflag    nodrop
06guild_03    mapflag    nodrop
06guild_04    mapflag    nodrop
06guild_05    mapflag    nodrop



everytime i kill the monster it says NPCNAME::OnEVENT instead of 'ALL'

Edited by caspa
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

Please explain what you need more , I didn't understand what  is the issue and what intended to be

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   35
  • Joined:  07/04/19
  • Last Seen:  

i think you're getting the error message because you accidentally added an on-kill event for your monsters

just edit the code at line 110

from

monster @currentroom$,0,0,"--ja--",.guardianmobs[rand(0,(getarraysize(.guardianmobs)-1))],1";

to

monster @currentroom$,0,0,"--ja--",.guardianmobs[rand(0,(getarraysize(.guardianmobs)-1))],1;

(remove the " at the end)

and the problem should disappear

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...