Jump to content
llchrisll

Chris' Script Collection [Last Update: 11-06/2020]

Recommended Posts

is this still available? cause it requires password in github 😞

 

Share this post


Link to post
Share on other sites
On 11/1/2020 at 6:42 PM, scoresby said:

is this still available? cause it requires password in github 😞

 

What do you mean by that? I didn't make the repo private :O.

Share this post


Link to post
Share on other sites
1 hour ago, llchrisll said:

What do you mean by that? I didn't make the repo private :O.

maybe i'm doing sth wrong?

 

sorry i'm new at this, but i've been able to copy paste your scripts haha 😉

 

check this out

image.thumb.png.fb632bfe9166e07845ba862ad499b8d0.png

 

Share this post


Link to post
Share on other sites
On 8/2/2020 at 3:58 AM, kevinyrchua said:

Are you referring to john at prt_fild08?, I have spawned him already and can talk to him but no options available.. is there something i need to setup through the script or through the npc? 

Well just a small issue regarding getmapxy, since I didn't update it since they changed the it was handled, it errors ofc.
For a quick fix, just exchange the "1" at the end of every getmapxy to BL_NPC and you are fine.
 

Edit: Updated some scripts along with the fix of it.

Edited by llchrisll

Share this post


Link to post
Share on other sites

Hey Chris,

thank you for your amazing scripts.

I'm encountering a problem with your arena master script :

 

[Warning]: script:getelementofarray: index out of range (-4)
[Debug]: Data: variable name='[email protected]_names$' index=0
[Debug]: Source (NPC): Arena Master at prontera (164,163)

I also noticed that Kills aren't updated in sql db while everything else seem to work fine.

Thank you

Share this post


Link to post
Share on other sites
On 23/08/2019 at 11:20, Tiki59 said:

llchrisll ,

Testei sua Battle Ground Arena e ocorreu um erro ao usar o comando @startbgarena.

THX.

 

 

erreurbg1.png

erreurbg2.png

infelizmente estou com mesmo problema !

Share this post


Link to post
Share on other sites

I'm aware that it's erroring, but I'm too lazy atm trying to fix it.
Also english please next time ^^.
(I guessed from your map server console, btw what you wanna tell me)

Share this post


Link to post
Share on other sites

Hi Chris i have issue using your mob invasion

Setting is on Single map,item reward per kill using the npc,


my issues when i used it is.

1. mobs doesn't spawn in one go, seems like it is by batches .

2. it only announces mob remaining when it is only 5 (want it to announce it through all out of the event)

3. doesnt forcibly ends after 3600

4. need the event to be all normal attacks, skill will be disabled on the spam of the event.

i hope you can help me
 

//===== rAthena Script =======================================
//= Monster Invasion
//===== By ===================================================
//= llchrisll
//===== Version ==============================================
//= 1.0 - Initial Release
//  1.1 - Added custom Commands for GM's to start/end the invasion manually.
//      - Exchanged the Custom Variable Settings for the Reward NPC with
//        the forgotten Cash Points reward (ups..)
//      - Removed the idea about using an Invasion Shop
//      - Fixed reward announcer to display correct lines
//===== Tested With ==========================================
//= rAthena 04/26/2019 Revision
//= GIT Hash: 67e1583f9fec7ac95a954634f6b7600ebe428df0
//===== Description ==========================================
//= There are 2 Invasion Types:
//  - Single
//  - Multiply
//= Each can be seperatly customized, but can not be switched via ingame.
//= Changing settings means to restart/reload the server for them to become active
//= Also there is an "Invasion Rewarder" available after the Invasion,
//  which can be turned on or off
//  To change the reward itself, scroll down to the bottom of the file
//  where the NPC is located. There are extra settings.
//= See "OnInit:" for the main settings
//===== Comments =============================================
//= None yet... 
//===========================================================
-    script    MobInvaInit    -1,{
function    DELAY;

OnTimer1000: // Every Second
stopnpctimer;
set .s,.s + 1;
if(.debug) 
    // Showing Debug every minute only.
    if(.s%60 == 0) debugmes .n$+": Delay Timer: "+.s+" seconds (Minutes: "+(.s/60)+"), Delay Function returns: "+DELAY(.delay_type,.delay_pos,1)+", Invasion Re-/Starts: "+.time[.delay_pos]+" (in seconds), Force End: "+.inva_fend+" (in seconds)";
if(.delay == 1 && .s == DELAY(.delay_type,.delay_pos,1) ) 
    donpcevent strnpcinfo(0)+"::OnInvaInit";
else if( .s == .inva_fend && .inva_status) 
    donpcevent strnpcinfo(0)+"::OnInvaForceEnd";
initnpctimer;
end;


OnClock1300: // 1 p.m.
OnClock2000:
if(.delay == 1) // Delay Usage active
    end;
    
OnInvaInit:
if(.inva_status) end;

if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) 
    disablenpc "Invasion Rewarder";

switch(.inva_type) {
    
    // Single Town Invasion
    case 1:
    if(!.s_inva_spec) { // No Map Specification > Random
    
        if(rand(1,10) <= 5) { // 50% chance to use either a big city or a small one
            set .t,rand(getarraysize(.map_b$));
            set .map_use,1; // Use big Maps
        } else {
            set .t,rand(getarraysize(.map_s$));
            set .map_use,2; // Use small Maps
        }
    } else {
        set .map_use,.s_inva_spec;
        set .t,.s_inva_pos;
    }
    if(.map_use == 1) {
        for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[.t])); set [email protected],[email protected] + 1) {
            monster .map_b$[.t],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[.t]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[.t]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$),strnpcinfo(0)+"::OnMobSingleKilled";
            set .MobSKilled,.MobSKilled + getd(".mam_"+.map_post_b$);
        }
        announce .n$+": The town "+.map_b$[.t]+" is being invaded by "+.MobSKilled+" monsters, please help use to defend it.",0;
    
    } else if(.map_use == 2) {
        for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[.t])); set [email protected],[email protected] + 1) {
            monster .map_s$[.t],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[.t]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[.t]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$),strnpcinfo(0)+"::OnMobSingleKilled";
            set .MobSKilled,.MobSKilled + getd(".mam_"+.map_post_s$);
        }
        announce .n$+": The town "+.map_s$[.t]+" is being invaded by "+.MobSKilled+" monsters, please help use to defend it.",0;
    }
    break;
    
    // Multiply Town Invasion
    case 2:
    if( .inva_spawn == 1) {
        for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) {
            for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
            }
            announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
        }
        
        sleep 500;
        
        for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) {
            for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
            }
            announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
        }
    // * Spawn Option - Specific Maps
    } else if( .inva_spawn == 2) {
        
        set [email protected]_am,.inva_maps; // Copying Map Quantity
        
        if(.debug)
            debugmes .n$+": Map Quantity - .inva_maps: "+.inva_maps+" > [email protected]_am";
        // * Map Size - Big Maps 
        if( .inva_size == 1) {
        
            // - Checking if .map_am exceeds the size of the map array, or is 0
            if( [email protected]_am > getarraysize(.map_b$) || [email protected]_am == 0)
                set [email protected]_am,getarraysize(.map_b$);
                
            if(.debug) 
                debugmes .n$+": Map Quantity - Check: [email protected]_am: "[email protected]_am;
                
            // * Map Randomness - Yes
            if( .inva_rand == 1) {
            
                if(.debug) 
                    debugmes .n$+": Map Randomness: Yes";
                    
                while ( [email protected] < [email protected]_am ) {
                    if(.debug) 
                        debugmes .n$+": Big Maps - Counter: "[email protected]+", Map Index: "[email protected];
                
                    set [email protected],rand([email protected]_am);
                    set [email protected],0;
                        
                    for ( set [email protected],0; [email protected] < getarraysize([email protected]_c); set [email protected],[email protected] + 1) 
                        if(([email protected]+1) == [email protected]_c[[email protected]]) {
                            set [email protected],1;
                            break;
                        }
                        
                    if([email protected] == 1) continue;
                    
                    if(.debug) {
                        debugmes .n$+": Big Maps - Map Index: "[email protected]+", Map Name: "+.map_b$[[email protected]];
                        debugmes .n$+": Big Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_b$[[email protected]]));
                    }
                    
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Big Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_b$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_b$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                    setarray [email protected]_c[getarraysize([email protected]_c)],([email protected]+1); // Copying already use maps.
                    set [email protected],[email protected] + 1;
                }
                    
            // * Map Randomness - No
            } else if( .inva_rand == 0) {
            
                if(.debug) 
                    debugmes .n$+": Map Randomness: No";
                
                for ( set [email protected],0; [email protected] < [email protected]_am; set [email protected],[email protected] + 1) {
                    if(.debug) {
                        debugmes .n$+": Big Maps - Map Index: "[email protected]+", Map Name: "+.map_b$[[email protected]];
                        debugmes .n$+": Big Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_b$[[email protected]]));
                    }
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Big Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_b$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_b$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                }
            }
            
        // * Map Size - Small Maps 
        } else if( .inva_size == 2) {
        
            // - Checking if .map_am exceeds the size of the map array, or is 0
            if( [email protected]_am > getarraysize(.map_s$) || [email protected]_am == 0)
                set [email protected]_am,getarraysize(.map_s$);
            
            if(.debug) 
                debugmes .n$+": Map Quantity - Check: [email protected]_am: "[email protected]_am;
            
            // * Map Randomness - Yes
            if( .inva_rand == 1) {
                while ( [email protected] < [email protected]_am ) {
                    
                    set [email protected],rand([email protected]_am);
                    set [email protected],0;
                        
                    for ( set [email protected],0; [email protected] < getarraysize([email protected]_c); set [email protected],[email protected] + 1) 
                        if([email protected] == [email protected]_c[[email protected]]) {
                            set [email protected],1;
                            break;
                        }
                        
                    if([email protected] == 1) continue;
                    
                    if(.debug) {
                        debugmes .n$+": Small Maps - Map Index: "[email protected]+", Map Name: "+.map_s$[[email protected]];
                        debugmes .n$+": Small Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_s$[[email protected]]));
                    }
                    
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Small Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_s$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_s$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                    setarray [email protected]_c[getarraysize([email protected]_c)],[email protected]; // Copying already use maps.
                }
                    
            // * Map Randomness - No
            } else if( .inva_rand == 0) {
                
                if(.debug) 
                    debugmes .n$+": Map Randomness: No";
                
                for ( set [email protected],0; [email protected] < .map_am; set [email protected],[email protected] + 1) {
                    if(.debug) {
                        debugmes .n$+": Small Maps - Map Index: "[email protected]+", Map Name: "+.map_s$[[email protected]];
                        debugmes .n$+": Small Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_s$[[email protected]]));
                    }
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Small Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_s$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_s$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                }
            }
        }
    }
    break;
    
}
set .inva_status,1;
end;


OnMobSingleKilled:
if(!.inva_status) end; // Shouldn't be possible
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) 
    set InvaKill,InvaKill + 1; // Kill Counter for Reward
set .MobSKilled,.MobSKilled - 1;
switch(.MobSKilled) {
    case 0:
    announce .n$+": Congratulation to ["+strcharinfo(0)+"] who delivered the final blow!!! Nicely Done!!!",0;
    if(.inva_final) {
        announce .n$+": You also get an \"Final Kill Reward\", just take a look in the Chat Box. See ya next time *g*",bc_self;
        dispbottom .n$+": You have been rewarded with:";
        if(.inva_f_id == 1) {
            set Zeny,Zeny + .inva_f_am;
            dispbottom .n$+": "+.inva_f_am+" Zeny.";
        } else if(.inva_f_id == 2) {
            set #CASHPOINTS,#CASHPOINTS + .inva_f_am;
            dispbottom .n$+": "+.inva_f_am+" Cash Points. New Balance is "+#CASHPOINTS+".";
        } else if(.inva_f_id >= 512) {
            getitem .inva_f_id,.inva_f_am;
            dispbottom .n$+": "+.inva_f_am+"x "+getitemname(.inva_f_id)+".";
        }
    }
    sleep 10000;
    donpcevent strnpcinfo(0)+"::OnInvaEnd";
    break;
    
    case 1:
    mapannounce strcharinfo(3),.n$+": JUST "+.MobSKilled+" MONSTER is left!!!! FINAL BLOW, GO GO!!!",bc_yellow;
    break;
    
    case 2:
    case 3:
    case 4:
    mapannounce strcharinfo(3),.n$+": Only "+.MobSKilled+" monsters are left!!!! We can do it!!!",bc_yellow;
    break;

    case 5:
    mapannounce strcharinfo(3),.n$+": LAST "+.MobSKilled+"!!!! We can do it!!!",bc_yellow;
    break;
    
    default: break;
}
end;

OnMobMultiKilled:
if(!.inva_status) end; // Shouldn't be possible
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0)
    set InvaKill,InvaKill + 1; // Kill Counter for Reward
set @loc,0;
for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
    if(strcharinfo(3) == .map_b$[[email protected]]) {
        set @loc,1;
        set @map,[email protected];
        break;
    }
    
for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
    if(strcharinfo(3) == .map_s$[[email protected]]) {
        set @loc,2;
        set @map,[email protected];
        break;
    }

OnMMobKilled:
if(.debug) 
    debugmes .n$+": 2nd Loc Check: @Loc; "[email protected]+", @map: "[email protected];
switch( @loc ) {
    
    case 1: 
    setd(".Mob_"+.map_post_b$[@map]+"_Killed"),getd(".Mob_"+.map_post_b$[@map]+"_Killed") - 1; 
    if(.debug)
        debugmes .n$+": Mobs: "+mobcount(.map_b$[@map],strnpcinfo(0)+"::OnMobMultiKilled")+", Variable: "+getd(".Mob_"+.map_post_b$[@map]+"_Killed");
    if(getd(".Mob_"+.map_post_b$[@map]+"_Killed") > 0) 
        mapannounce strcharinfo(3),.n$+": The player ["+strcharinfo(0)+"] has killed another monster, "+getd(".Mob_"+.map_post_b$[@map]+"_Killed")+" monsters are left!!!! Good work !!!",0;
    else {
        announce .n$+": Every Monster in "+.map_s$[@map]+" has been defeated, thank you guys!!!",0;
        donpcevent strnpcinfo(0)+"::OnOtherTown";
    }
    break;
    
    case 2: 
    setd(".Mob_"+.map_post_s$[@map]+"_Killed"),getd(".Mob_"+.map_post_s$[@map]+"_Killed") - 1; 
    if(.debug) 
        debugmes .n$+": Mobs: "+mobcount(.map_s$[@map],strnpcinfo(0)+"::OnMobMultiKilled")+", Variable: "+getd(".Mob_"+.map_post_s$[@map]+"_Killed");
    if(getd(".Mob_"+.map_post_s$[@map]+"_Killed") > 0) 
        mapannounce strcharinfo(3),.n$+": The player ["+strcharinfo(0)+"] has killed another monster, "+getd(".Mob_"+.map_post_s$[@map]+"_Killed")+" monsters are left!!!! Good work !!!",0;
    else {
        announce .n$+": Every Monster in "+.map_s$[@map]+" has been defeated, thank you guys!!!",0;
        donpcevent strnpcinfo(0)+"::OnOtherTown";
    }
    break;
}
end;

OnOtherTown:
for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
    if(getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") > 0) 
        set [email protected]_left$,[email protected]_left$ + .map_b$[[email protected]]+ ( (.map_b$[[email protected]+1] != "")?", ":"");

for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
    if(getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") > 0) 
        set [email protected]_left$,[email protected]_left$ + .map_s$[[email protected]]+ ( (.map_s$[[email protected]+1] != "")?", ":"");

if([email protected]_left$ == "" && [email protected]_left$ == "")
    donpcevent strnpcinfo(0)+"::OnInvaEnd";

announce .n$+": In the "+ ( ([email protected]_left$ != "")?"big towns "[email protected]_left$+ ( ([email protected]_left$ != "")?" and small towns "[email protected]_left$:""):"small towns "[email protected]_left$)+" are still Monsters, please help use to defeat them!!!",0;
end;

OnInvaEnd:
announce .n$+": Thank you guys for your help in defeating the invaders, we will counting on you for the next time as well.",0;
donpcevent strnpcinfo(0)+"::OnInvaRestart";
end;

OnInvaForceEnd:
announce .n$+": NOOOOO!!! The monsters successfully invaded the towns, RETREAT GUARDS!!!",0;
sleep 10000;
announce .n$+": Brave Fighters, I thank you for your support, but we failed!!",0;
sleep 10000;
announce .n$+": Let's regroup and let's try again, I will inform you when we are ready!!",0;

OnInvaRestart:
DELAY(.delay_type,.delay_pos,2);
// Removing Mobs which kinda survived
if(.inva_type == 1) // Single Town
    if(.map_use == 1) killmonster .map_b$[.t],strnpcinfo(0)+"::OnMobSingleKilled";
    else killmonster .map_s$[.t],strnpcinfo(0)+"::OnMobSingleKilled";
    
else if(.inva_type == 2) { // Multi Town
    for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
        killmonster .map_b$[[email protected]],strnpcinfo(0)+"::OnMobMultiKilled";
        
    for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1)
        killmonster .map_s$[[email protected]],strnpcinfo(0)+"::OnMobMultiKilled";
    }
set .inva_status,0;
if(.delay == 1) set .s,0; // Reseting Delay Counter
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) {
    enablenpc "Invasion Rewarder";
    announce .n$+": Visit the \"Invasion Rewarder\" to recieve rewards for your kills. But hurry, he will disappear in "+getvariableofnpc(.rew_dis,"Invasion Rewarder")+" minutes.",0;
    donpcevent strnpcinfo(0)+"::OnRewardDisable";
}
end;

// Auto Disable Reward NPC
OnRewardDisable:
set .m,getvariableofnpc(.rew_dis,"Invasion Rewarder");
while( .m != 0 ) {
    switch(.m) {
        case 4: 
        case 3:
        case 2:
        announce .n$+": The \"Invasion Rewarder\" will disappear in "+.m+" minutes.",bc_all; break;
        case 1: announce .n$+": HURRY, the \"Invasion Rewarder\" will disappear in 1 minute.",bc_all; break;
    }
    set .m,.m - 1;
    sleep 60000;
}        
announce "Invasion Rewarder: Okay, I'm done here. See ya next time!!!",0;
set .m,0;
disablenpc "Invasion Rewarder";
end;

OnPCLoginEvent:
if(.inva_status == 0) end;
announce .n$+": The Monster Invasion Event is currently running, please hurry and help us!!",bc_self;
sleep2 2000;
if(.inva_type == 1) 
    set [email protected]_left$,( (.map_use == 1) ? .map_b$[.t]:.map_s$[.t]);
else if(.inva_type == 2) {
    for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
        if(getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") > 0) 
            set [email protected]_left$,[email protected]_left$ + .map_b$[[email protected]]+ ( (.map_b$[[email protected]+1] != "")?", ":"");
            
    for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
        if(getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") > 0) 
            set [email protected]_left$,[email protected]_left$ +" and "+ .map_s$[[email protected]]+ ( (.map_s$[[email protected]+1] != "")?", ":"");
}
announce .n$+": We are defending at "+ [email protected]_left$+"!!!",bc_self;
end;

OnInit:
set .n$,"[Ragnarok Guard]";
// Debug Mode - See Map Server Console for Debug messages
set .debug,0;
// ======= Invasion Type =======
// - 1: Single
// - 2: Multiply
set .inva_type,1;
// ====== Single Invasion Settings =========
if(.inva_type == 1) {
    // * Specific Map Usage
    // - 0 = Random
    // - 1 = Big Maps
    // - 2 = Small Maps
    set .s_inva_spec,0;

    if(.s_inva_spec > 0) {
        // * Map Index
        // X = Array Index of the Map Array
        set .s_inva_pos,0;
    }
// ======= Multiply Invasion Settings ========
} else if(.inva_type == 2) {
    // * Spawn Option
    // - 1: All Maps
    // - 2: Specific Maps
    set .inva_spawn,2;

    if(.inva_spawn == 2) {
        // * Map Usage:
        // - 1: Big Maps
        // - 2: Small Maps
        set .inva_size,1;
        
        // * Map Amount:
        // - 0: All Maps from .inva_size above
        // - 1+: ...
        // Note: If this value exceeds the size of the map array, 
        // then it will use all maps of .inva_size.
        set .inva_maps,0;
 
        if(.inva_maps > 0 && .inva_maps < ( (.inva_size == 1)?getarraysize(.map_b$):getarraysize(.map_s$) ) ) 
        // * Map Randoming:
        // - 0: No
        // - 1: Yes
        // Note: Map Randoming is only possible when not all maps are wanted
        // It would be ineffective to make map randoming when there are all maps active :I
        set .inva_rand,1;
    }
}
// * Invasion on Server Start
// - 0: No
// - 1: Yes
set .inva_statusinit,0;
// * Invasion Force End
// - 0: Not used
// - 1+: ...
// Note: The Event will automatically end after this value has passed (in seconds)
set .inva_fend,3600; // 1 Hour
// =======*======= DELAY SETTINGS =======*=======
// * Delay Usage
// - 0: Off - OnClockXXXX will be used
// - 1: On
set .delay,0;
// * Delay Type
// - 1: Random (Default)
// - 2: Fixed Delay
// - 3: Ranged Delay
set .delay_type,1;

// ---- Fixed Delay ----
// Array Position in ".time"
if(.delay_type == 2) 
    set .delay_pos,0;
// ---- Ranged Delay ----
// Array Position for start index
if(.delay_type == 3) 
    set .delay_pos,3;

// * Delay Times
setarray .time[0],
// In Seconds  -  is equal to  -  Array Position
        10800, // 3 Hours      -  0
        14400, // 4 Hours      -  1
        21600, // 6 Hours      -  2
        86400, // 1 Day        -  3
        172800, // 2 Days      -  4    
        259200; // 3 Days      -  5

// =======*======= MONSTER SETTINGS =======*=======
// * Mob Quantity Limit depending on the map size
// - Big Maps
set .m_limit_b,100;
// - Small Maps
set .m_limit_s,30;

// * Maps List
// - Big Maps 
setarray .map_b$[0],"prontera","geffen","payon","morocc","aldebaran","alberta";
// For every map you have to add an postfix in the same order,
// which has been put in the array for the Maps
// After this, just set an array with the Mob IDs where the
// array name contains the postfix you set-up, see the examples
setarray .map_post_b$[0],"pron","gef","pay","mor","alde","alb";
// - Small Maps
setarray .map_s$[0],"izlude";
setarray .map_post_s$[0],"izl";
// ======= Monster ID's =======
// ------ Big Maps ------
// * Prontera - Mantis, Thief Bug Male, Argos, Side Winder
setarray .mob_pron[0],1139,1054,1100,1037;
// * Geffen - Poison Spore, Ghoul, Jakk, High Orc
setarray .mob_gef[0],1855,1036,1130,1213;
// * Payon - Zombie, Elder Willow, Munak, Nine Tail, Drainliar
setarray .mob_pay[0],1015,1033,1026,1180,1111;
// * Morocc - Requiem, Isis, Mummy, Minorous
setarray .mob_mor[0],1164,1029,1041,1149;
// * Aldebaran - Cramp, Penomena, Punk, Orc Archer, Bathory
setarray .mob_alde[0],1209,1029,1199,1189,1102;
// * Alberta - Pirate Skeleton, Penomena, Poison Spore, Whisper, Mimic
setarray .mob_alb[0],1071,1029,1077,1179,1191;
// ------ Small Maps ------
// * Izlude - Obeaune, Merman, Swordfish, Strouf
setarray .mob_izl[0],1044,1264,1069,1065;

// ------ Mob Amount Calculation for Big Maps ------
for ( set [email protected],0; [email protected] < getarraysize(.map_post_b$); set [email protected],[email protected] + 1) 
    setd(".mam_"+.map_post_b$[[email protected]]),( .m_limit_b/getarraysize(getd(".mob_"+.map_post_b$)) );
    
// ------ Mob Amount Calculation for Small Maps ------
for ( set [email protected],0; [email protected] < getarraysize(.map_post_s$); set [email protected],[email protected] + 1)
    setd(".mam_"+.map_post_s$[[email protected]]),( .m_limit_s/getarraysize(getd(".mob_"+.map_post_s$)) );

// ======= Final Kill Settings =======
// * Will the player who gets the final kill be rewarded?
// Only working during a Single Invasion
// - 1: Yes
// - 0: No
set .inva_final,1;

if(.inva_final == 1) {
    // * Reward Type:
    // - 1: Zeny
    // - 2: Cash Points
    // - 512+: Item ID (the Value is already the Item ID)
    set .inva_f_id,40006;
    // * Reward Amount:
    set .inva_f_am,1;
}
// =======*======= END of SETTINGS =======*=======
// Even if .delay is 0, its required to start the timer for force ending the event :I
initnpctimer;
if(.debug) {
    debugmes .n$+": .inva_delay: "+.inva_delay;
    debugmes .n$+": gettimetick(2): "+gettimetick(2);
}
if(.delay == 1 && DELAY(.delay_type,.delay_pos,1) < 1) // If the delay value is empty, set it!!
    DELAY(.delay_type,.delay_pos,2);
    
if(.debug) 
    debugmes .n$+": .inva_delay: "+.inva_delay;

if(.inva_statusinit == 1) // Starting Invasion on Server Start
    donpcevent strnpcinfo(0)+"::OnInvaInit";
// Custom Commands for GM's
bindatcmd "invastart",strnpcinfo(0)+"::OnInvaInit",1,99;
bindatcmd "invaend",strnpcinfo(0)+"::OnInvaForceEnd",1,99;
end;

function    DELAY    {
// Format: DELAY(.delay_type,.delay_pos,1/2);
// getarg(0) = Delay Type
// * 1: Random
// * 2: Fixed Delay
// * 3: Ranged Delay
// getarg(1) = Array Position if getarg(0) == 2 || 3
// getarg(2): Read/Write
// * 1: Read
// * 2: Write
if(getarg(2) == 1) 
    return (.inva_delay - gettimetick(2));
    
switch(getarg(0)) {
    case 1:    set [email protected]_inva,.time[rand(getarraysize(.time))]; break;
    case 2: set [email protected]_inva,.time[getarg(1)]; break; 
    case 3: set [email protected]_inva,.time[rand(getarg(1),getarraysize(.time) - 1)]; break;
}
set .inva_delay,gettimetick(2) + [email protected]_inva;
return [email protected]_inva;    
}

}
prontera,150,175,4    script    Invasion Rewarder    110,{

mes .n$;
mes "Hello, "+strcharinfo(0)+"!";
mes "So you want to be rewarded from the Mob Invasion Event, huh?";
mes "Let me take a look at your battle record.";
next;
mes .n$;
if(!InvaKill) {
    mes "It seems like you didn't participated at all or you got your reward already.";
    mes "So I can't give you any kind of reward.";
    mes "Try your best next time.";
    close;
}
mes "You haved killed "+InvaKill+" monsters, good job there.";
next;
mes .n$;
set [email protected]_am,InvaKill*.rew_am;
set [email protected]_bonus, ( (.rew_bonus > 0)?(InvaKill*.rew_bonus):.rew_bonus);
set [email protected],[email protected]_am + [email protected]_bonus;

if(.rew_type == 1) {
    mes "You have recieved "[email protected]+"x "+( (.rew_bonus == 1)?"(Bonus: +"[email protected]_bonus+") ":"") + getitemname(.rew_id)+".";
    getitem .rew_id,[email protected];
} else if(.rew_type == 2) {
    mes "You have recieved "[email protected]+"x "+( (.rew_bonus == 1)?"(Bonus: +"[email protected]_bonus+") ":"") + "Cash Points.";
    set #CASHPOINTS,#CASHPOINTS + (.rew_am+.rew_bonus);
}
set InvaKill,0;
close;

OnInit:
set .n$,"["+strnpcinfo(0)+"]";
// =======*======= REWARD SETTINGS =======*=======
// * Reward Type:
// - 0: None
// - 1: Item
// - 2: Cash Points
set .rew_type,1;

// * Reward Bonus
// - 0: Off
// - 1 and higher: On
// = This bonus will be given to the kill additionally.
set .rew_bonus,0;
// ----- Item -----
if(.rew_type == 1) 
    set .rew_id,7929; // Item ID    
// ----- Reward Quantity -----
set .rew_am,10; // Amount per Kill
// ----- NPC Auto Disable -----
// After how many minutes will the NPC be disabled again:
set .rew_dis,3;
disablenpc strnpcinfo(0);
end;
}

 

Edited by Mael
Use a codebox

Share this post


Link to post
Share on other sites
On 2/2/2021 at 8:09 AM, iSnowFlakes said:

Hi Chris i have issue using your mob invasion

Setting is on Single map,item reward per kill using the npc,


my issues when i used it is.

1. mobs doesn't spawn in one go, seems like it is by batches .

2. it only announces mob remaining when it is only 5 (want it to announce it through all out of the event)

3. doesnt forcibly ends after 36004. need the event to be all normal attacks, skill will be disabled on the spam of the event.

i hope you can help me
 

//===== rAthena Script =======================================
//= Monster Invasion
//===== By ===================================================
//= llchrisll
//===== Version ==============================================
//= 1.0 - Initial Release
//  1.1 - Added custom Commands for GM's to start/end the invasion manually.
//      - Exchanged the Custom Variable Settings for the Reward NPC with
//        the forgotten Cash Points reward (ups..)
//      - Removed the idea about using an Invasion Shop
//      - Fixed reward announcer to display correct lines
//===== Tested With ==========================================
//= rAthena 04/26/2019 Revision
//= GIT Hash: 67e1583f9fec7ac95a954634f6b7600ebe428df0
//===== Description ==========================================
//= There are 2 Invasion Types:
//  - Single
//  - Multiply
//= Each can be seperatly customized, but can not be switched via ingame.
//= Changing settings means to restart/reload the server for them to become active
//= Also there is an "Invasion Rewarder" available after the Invasion,
//  which can be turned on or off
//  To change the reward itself, scroll down to the bottom of the file
//  where the NPC is located. There are extra settings.
//= See "OnInit:" for the main settings
//===== Comments =============================================
//= None yet... 
//===========================================================
-    script    MobInvaInit    -1,{
function    DELAY;

OnTimer1000: // Every Second
stopnpctimer;
set .s,.s + 1;
if(.debug) 
    // Showing Debug every minute only.
    if(.s%60 == 0) debugmes .n$+": Delay Timer: "+.s+" seconds (Minutes: "+(.s/60)+"), Delay Function returns: "+DELAY(.delay_type,.delay_pos,1)+", Invasion Re-/Starts: "+.time[.delay_pos]+" (in seconds), Force End: "+.inva_fend+" (in seconds)";
if(.delay == 1 && .s == DELAY(.delay_type,.delay_pos,1) ) 
    donpcevent strnpcinfo(0)+"::OnInvaInit";
else if( .s == .inva_fend && .inva_status) 
    donpcevent strnpcinfo(0)+"::OnInvaForceEnd";
initnpctimer;
end;


OnClock1300: // 1 p.m.
OnClock2000:
if(.delay == 1) // Delay Usage active
    end;
    
OnInvaInit:
if(.inva_status) end;

if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) 
    disablenpc "Invasion Rewarder";

switch(.inva_type) {
    
    // Single Town Invasion
    case 1:
    if(!.s_inva_spec) { // No Map Specification > Random
    
        if(rand(1,10) <= 5) { // 50% chance to use either a big city or a small one
            set .t,rand(getarraysize(.map_b$));
            set .map_use,1; // Use big Maps
        } else {
            set .t,rand(getarraysize(.map_s$));
            set .map_use,2; // Use small Maps
        }
    } else {
        set .map_use,.s_inva_spec;
        set .t,.s_inva_pos;
    }
    if(.map_use == 1) {
        for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[.t])); set [email protected],[email protected] + 1) {
            monster .map_b$[.t],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[.t]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[.t]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$),strnpcinfo(0)+"::OnMobSingleKilled";
            set .MobSKilled,.MobSKilled + getd(".mam_"+.map_post_b$);
        }
        announce .n$+": The town "+.map_b$[.t]+" is being invaded by "+.MobSKilled+" monsters, please help use to defend it.",0;
    
    } else if(.map_use == 2) {
        for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[.t])); set [email protected],[email protected] + 1) {
            monster .map_s$[.t],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[.t]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[.t]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$),strnpcinfo(0)+"::OnMobSingleKilled";
            set .MobSKilled,.MobSKilled + getd(".mam_"+.map_post_s$);
        }
        announce .n$+": The town "+.map_s$[.t]+" is being invaded by "+.MobSKilled+" monsters, please help use to defend it.",0;
    }
    break;
    
    // Multiply Town Invasion
    case 2:
    if( .inva_spawn == 1) {
        for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) {
            for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
            }
            announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
        }
        
        sleep 500;
        
        for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) {
            for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
            }
            announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
        }
    // * Spawn Option - Specific Maps
    } else if( .inva_spawn == 2) {
        
        set [email protected]_am,.inva_maps; // Copying Map Quantity
        
        if(.debug)
            debugmes .n$+": Map Quantity - .inva_maps: "+.inva_maps+" > [email protected]_am";
        // * Map Size - Big Maps 
        if( .inva_size == 1) {
        
            // - Checking if .map_am exceeds the size of the map array, or is 0
            if( [email protected]_am > getarraysize(.map_b$) || [email protected]_am == 0)
                set [email protected]_am,getarraysize(.map_b$);
                
            if(.debug) 
                debugmes .n$+": Map Quantity - Check: [email protected]_am: "[email protected]_am;
                
            // * Map Randomness - Yes
            if( .inva_rand == 1) {
            
                if(.debug) 
                    debugmes .n$+": Map Randomness: Yes";
                    
                while ( [email protected] < [email protected]_am ) {
                    if(.debug) 
                        debugmes .n$+": Big Maps - Counter: "[email protected]+", Map Index: "[email protected];
                
                    set [email protected],rand([email protected]_am);
                    set [email protected],0;
                        
                    for ( set [email protected],0; [email protected] < getarraysize([email protected]_c); set [email protected],[email protected] + 1) 
                        if(([email protected]+1) == [email protected]_c[[email protected]]) {
                            set [email protected],1;
                            break;
                        }
                        
                    if([email protected] == 1) continue;
                    
                    if(.debug) {
                        debugmes .n$+": Big Maps - Map Index: "[email protected]+", Map Name: "+.map_b$[[email protected]];
                        debugmes .n$+": Big Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_b$[[email protected]]));
                    }
                    
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Big Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_b$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_b$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                    setarray [email protected]_c[getarraysize([email protected]_c)],([email protected]+1); // Copying already use maps.
                    set [email protected],[email protected] + 1;
                }
                    
            // * Map Randomness - No
            } else if( .inva_rand == 0) {
            
                if(.debug) 
                    debugmes .n$+": Map Randomness: No";
                
                for ( set [email protected],0; [email protected] < [email protected]_am; set [email protected],[email protected] + 1) {
                    if(.debug) {
                        debugmes .n$+": Big Maps - Map Index: "[email protected]+", Map Name: "+.map_b$[[email protected]];
                        debugmes .n$+": Big Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_b$[[email protected]]));
                    }
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_b$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_b$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_b$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_b$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_b$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Big Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_b$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_b$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_b$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_b$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                }
            }
            
        // * Map Size - Small Maps 
        } else if( .inva_size == 2) {
        
            // - Checking if .map_am exceeds the size of the map array, or is 0
            if( [email protected]_am > getarraysize(.map_s$) || [email protected]_am == 0)
                set [email protected]_am,getarraysize(.map_s$);
            
            if(.debug) 
                debugmes .n$+": Map Quantity - Check: [email protected]_am: "[email protected]_am;
            
            // * Map Randomness - Yes
            if( .inva_rand == 1) {
                while ( [email protected] < [email protected]_am ) {
                    
                    set [email protected],rand([email protected]_am);
                    set [email protected],0;
                        
                    for ( set [email protected],0; [email protected] < getarraysize([email protected]_c); set [email protected],[email protected] + 1) 
                        if([email protected] == [email protected]_c[[email protected]]) {
                            set [email protected],1;
                            break;
                        }
                        
                    if([email protected] == 1) continue;
                    
                    if(.debug) {
                        debugmes .n$+": Small Maps - Map Index: "[email protected]+", Map Name: "+.map_s$[[email protected]];
                        debugmes .n$+": Small Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_s$[[email protected]]));
                    }
                    
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Small Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_s$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_s$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                    setarray [email protected]_c[getarraysize([email protected]_c)],[email protected]; // Copying already use maps.
                }
                    
            // * Map Randomness - No
            } else if( .inva_rand == 0) {
                
                if(.debug) 
                    debugmes .n$+": Map Randomness: No";
                
                for ( set [email protected],0; [email protected] < .map_am; set [email protected],[email protected] + 1) {
                    if(.debug) {
                        debugmes .n$+": Small Maps - Map Index: "[email protected]+", Map Name: "+.map_s$[[email protected]];
                        debugmes .n$+": Small Maps - Mob Array Size: "+getarraysize(getd(".mob_"+.map_post_s$[[email protected]]));
                    }
                    for ( set [email protected],0; [email protected] < getarraysize(getd(".mob_"+.map_post_s$[[email protected]])); set [email protected],[email protected] + 1) {
                        monster .map_s$[[email protected]],0,0,""+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0),getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),getd(".mam_"+.map_post_s$[[email protected]]),strnpcinfo(0)+"::OnMobMultiKilled";
                        setd(".Mob_"+.map_post_s$[[email protected]]+"_Killed"),getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") + getd(".mam_"+.map_post_s$[[email protected]]);
                        if(.debug) {
                            debugmes .n$+": Small Maps - Map Index: "[email protected]+", Mob Index: "[email protected]+", Map Name: "+.map_s$[[email protected]]+", Mob ID + Name: "+getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]")+"; "+getmonsterinfo(getd(".mob_"+.map_post_s$[[email protected]]+"["[email protected]+"]"),0);
                            debugmes .n$+": Total Mob Amount - Map Index: "[email protected]+": "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+", Spawn Amount per Mob: "+getd(".mam_"+.map_post_s$[[email protected]]);
                        }
                    }
                    announce .n$+": The town "+.map_s$[[email protected]]+" is being invaded by "+getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed")+" monsters, please help use to defend it.",0;
                }
            }
        }
    }
    break;
    
}
set .inva_status,1;
end;


OnMobSingleKilled:
if(!.inva_status) end; // Shouldn't be possible
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) 
    set InvaKill,InvaKill + 1; // Kill Counter for Reward
set .MobSKilled,.MobSKilled - 1;
switch(.MobSKilled) {
    case 0:
    announce .n$+": Congratulation to ["+strcharinfo(0)+"] who delivered the final blow!!! Nicely Done!!!",0;
    if(.inva_final) {
        announce .n$+": You also get an \"Final Kill Reward\", just take a look in the Chat Box. See ya next time *g*",bc_self;
        dispbottom .n$+": You have been rewarded with:";
        if(.inva_f_id == 1) {
            set Zeny,Zeny + .inva_f_am;
            dispbottom .n$+": "+.inva_f_am+" Zeny.";
        } else if(.inva_f_id == 2) {
            set #CASHPOINTS,#CASHPOINTS + .inva_f_am;
            dispbottom .n$+": "+.inva_f_am+" Cash Points. New Balance is "+#CASHPOINTS+".";
        } else if(.inva_f_id >= 512) {
            getitem .inva_f_id,.inva_f_am;
            dispbottom .n$+": "+.inva_f_am+"x "+getitemname(.inva_f_id)+".";
        }
    }
    sleep 10000;
    donpcevent strnpcinfo(0)+"::OnInvaEnd";
    break;
    
    case 1:
    mapannounce strcharinfo(3),.n$+": JUST "+.MobSKilled+" MONSTER is left!!!! FINAL BLOW, GO GO!!!",bc_yellow;
    break;
    
    case 2:
    case 3:
    case 4:
    mapannounce strcharinfo(3),.n$+": Only "+.MobSKilled+" monsters are left!!!! We can do it!!!",bc_yellow;
    break;

    case 5:
    mapannounce strcharinfo(3),.n$+": LAST "+.MobSKilled+"!!!! We can do it!!!",bc_yellow;
    break;
    
    default: break;
}
end;

OnMobMultiKilled:
if(!.inva_status) end; // Shouldn't be possible
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0)
    set InvaKill,InvaKill + 1; // Kill Counter for Reward
set @loc,0;
for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
    if(strcharinfo(3) == .map_b$[[email protected]]) {
        set @loc,1;
        set @map,[email protected];
        break;
    }
    
for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
    if(strcharinfo(3) == .map_s$[[email protected]]) {
        set @loc,2;
        set @map,[email protected];
        break;
    }

OnMMobKilled:
if(.debug) 
    debugmes .n$+": 2nd Loc Check: @Loc; "[email protected]+", @map: "[email protected];
switch( @loc ) {
    
    case 1: 
    setd(".Mob_"+.map_post_b$[@map]+"_Killed"),getd(".Mob_"+.map_post_b$[@map]+"_Killed") - 1; 
    if(.debug)
        debugmes .n$+": Mobs: "+mobcount(.map_b$[@map],strnpcinfo(0)+"::OnMobMultiKilled")+", Variable: "+getd(".Mob_"+.map_post_b$[@map]+"_Killed");
    if(getd(".Mob_"+.map_post_b$[@map]+"_Killed") > 0) 
        mapannounce strcharinfo(3),.n$+": The player ["+strcharinfo(0)+"] has killed another monster, "+getd(".Mob_"+.map_post_b$[@map]+"_Killed")+" monsters are left!!!! Good work !!!",0;
    else {
        announce .n$+": Every Monster in "+.map_s$[@map]+" has been defeated, thank you guys!!!",0;
        donpcevent strnpcinfo(0)+"::OnOtherTown";
    }
    break;
    
    case 2: 
    setd(".Mob_"+.map_post_s$[@map]+"_Killed"),getd(".Mob_"+.map_post_s$[@map]+"_Killed") - 1; 
    if(.debug) 
        debugmes .n$+": Mobs: "+mobcount(.map_s$[@map],strnpcinfo(0)+"::OnMobMultiKilled")+", Variable: "+getd(".Mob_"+.map_post_s$[@map]+"_Killed");
    if(getd(".Mob_"+.map_post_s$[@map]+"_Killed") > 0) 
        mapannounce strcharinfo(3),.n$+": The player ["+strcharinfo(0)+"] has killed another monster, "+getd(".Mob_"+.map_post_s$[@map]+"_Killed")+" monsters are left!!!! Good work !!!",0;
    else {
        announce .n$+": Every Monster in "+.map_s$[@map]+" has been defeated, thank you guys!!!",0;
        donpcevent strnpcinfo(0)+"::OnOtherTown";
    }
    break;
}
end;

OnOtherTown:
for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
    if(getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") > 0) 
        set [email protected]_left$,[email protected]_left$ + .map_b$[[email protected]]+ ( (.map_b$[[email protected]+1] != "")?", ":"");

for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
    if(getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") > 0) 
        set [email protected]_left$,[email protected]_left$ + .map_s$[[email protected]]+ ( (.map_s$[[email protected]+1] != "")?", ":"");

if([email protected]_left$ == "" && [email protected]_left$ == "")
    donpcevent strnpcinfo(0)+"::OnInvaEnd";

announce .n$+": In the "+ ( ([email protected]_left$ != "")?"big towns "[email protected]_left$+ ( ([email protected]_left$ != "")?" and small towns "[email protected]_left$:""):"small towns "[email protected]_left$)+" are still Monsters, please help use to defeat them!!!",0;
end;

OnInvaEnd:
announce .n$+": Thank you guys for your help in defeating the invaders, we will counting on you for the next time as well.",0;
donpcevent strnpcinfo(0)+"::OnInvaRestart";
end;

OnInvaForceEnd:
announce .n$+": NOOOOO!!! The monsters successfully invaded the towns, RETREAT GUARDS!!!",0;
sleep 10000;
announce .n$+": Brave Fighters, I thank you for your support, but we failed!!",0;
sleep 10000;
announce .n$+": Let's regroup and let's try again, I will inform you when we are ready!!",0;

OnInvaRestart:
DELAY(.delay_type,.delay_pos,2);
// Removing Mobs which kinda survived
if(.inva_type == 1) // Single Town
    if(.map_use == 1) killmonster .map_b$[.t],strnpcinfo(0)+"::OnMobSingleKilled";
    else killmonster .map_s$[.t],strnpcinfo(0)+"::OnMobSingleKilled";
    
else if(.inva_type == 2) { // Multi Town
    for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
        killmonster .map_b$[[email protected]],strnpcinfo(0)+"::OnMobMultiKilled";
        
    for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1)
        killmonster .map_s$[[email protected]],strnpcinfo(0)+"::OnMobMultiKilled";
    }
set .inva_status,0;
if(.delay == 1) set .s,0; // Reseting Delay Counter
if(getvariableofnpc(.rew_type,"Invasion Rewarder") > 0) {
    enablenpc "Invasion Rewarder";
    announce .n$+": Visit the \"Invasion Rewarder\" to recieve rewards for your kills. But hurry, he will disappear in "+getvariableofnpc(.rew_dis,"Invasion Rewarder")+" minutes.",0;
    donpcevent strnpcinfo(0)+"::OnRewardDisable";
}
end;

// Auto Disable Reward NPC
OnRewardDisable:
set .m,getvariableofnpc(.rew_dis,"Invasion Rewarder");
while( .m != 0 ) {
    switch(.m) {
        case 4: 
        case 3:
        case 2:
        announce .n$+": The \"Invasion Rewarder\" will disappear in "+.m+" minutes.",bc_all; break;
        case 1: announce .n$+": HURRY, the \"Invasion Rewarder\" will disappear in 1 minute.",bc_all; break;
    }
    set .m,.m - 1;
    sleep 60000;
}        
announce "Invasion Rewarder: Okay, I'm done here. See ya next time!!!",0;
set .m,0;
disablenpc "Invasion Rewarder";
end;

OnPCLoginEvent:
if(.inva_status == 0) end;
announce .n$+": The Monster Invasion Event is currently running, please hurry and help us!!",bc_self;
sleep2 2000;
if(.inva_type == 1) 
    set [email protected]_left$,( (.map_use == 1) ? .map_b$[.t]:.map_s$[.t]);
else if(.inva_type == 2) {
    for ( set [email protected],0; [email protected] < getarraysize(.map_b$); set [email protected],[email protected] + 1) 
        if(getd(".Mob_"+.map_post_b$[[email protected]]+"_Killed") > 0) 
            set [email protected]_left$,[email protected]_left$ + .map_b$[[email protected]]+ ( (.map_b$[[email protected]+1] != "")?", ":"");
            
    for ( set [email protected],0; [email protected] < getarraysize(.map_s$); set [email protected],[email protected] + 1) 
        if(getd(".Mob_"+.map_post_s$[[email protected]]+"_Killed") > 0) 
            set [email protected]_left$,[email protected]_left$ +" and "+ .map_s$[[email protected]]+ ( (.map_s$[[email protected]+1] != "")?", ":"");
}
announce .n$+": We are defending at "+ [email protected]_left$+"!!!",bc_self;
end;

OnInit:
set .n$,"[Ragnarok Guard]";
// Debug Mode - See Map Server Console for Debug messages
set .debug,0;
// ======= Invasion Type =======
// - 1: Single
// - 2: Multiply
set .inva_type,1;
// ====== Single Invasion Settings =========
if(.inva_type == 1) {
    // * Specific Map Usage
    // - 0 = Random
    // - 1 = Big Maps
    // - 2 = Small Maps
    set .s_inva_spec,0;

    if(.s_inva_spec > 0) {
        // * Map Index
        // X = Array Index of the Map Array
        set .s_inva_pos,0;
    }
// ======= Multiply Invasion Settings ========
} else if(.inva_type == 2) {
    // * Spawn Option
    // - 1: All Maps
    // - 2: Specific Maps
    set .inva_spawn,2;

    if(.inva_spawn == 2) {
        // * Map Usage:
        // - 1: Big Maps
        // - 2: Small Maps
        set .inva_size,1;
        
        // * Map Amount:
        // - 0: All Maps from .inva_size above
        // - 1+: ...
        // Note: If this value exceeds the size of the map array, 
        // then it will use all maps of .inva_size.
        set .inva_maps,0;
 
        if(.inva_maps > 0 && .inva_maps < ( (.inva_size == 1)?getarraysize(.map_b$):getarraysize(.map_s$) ) ) 
        // * Map Randoming:
        // - 0: No
        // - 1: Yes
        // Note: Map Randoming is only possible when not all maps are wanted
        // It would be ineffective to make map randoming when there are all maps active :I
        set .inva_rand,1;
    }
}
// * Invasion on Server Start
// - 0: No
// - 1: Yes
set .inva_statusinit,0;
// * Invasion Force End
// - 0: Not used
// - 1+: ...
// Note: The Event will automatically end after this value has passed (in seconds)
set .inva_fend,3600; // 1 Hour
// =======*======= DELAY SETTINGS =======*=======
// * Delay Usage
// - 0: Off - OnClockXXXX will be used
// - 1: On
set .delay,0;
// * Delay Type
// - 1: Random (Default)
// - 2: Fixed Delay
// - 3: Ranged Delay
set .delay_type,1;

// ---- Fixed Delay ----
// Array Position in ".time"
if(.delay_type == 2) 
    set .delay_pos,0;
// ---- Ranged Delay ----
// Array Position for start index
if(.delay_type == 3) 
    set .delay_pos,3;

// * Delay Times
setarray .time[0],
// In Seconds  -  is equal to  -  Array Position
        10800, // 3 Hours      -  0
        14400, // 4 Hours      -  1
        21600, // 6 Hours      -  2
        86400, // 1 Day        -  3
        172800, // 2 Days      -  4    
        259200; // 3 Days      -  5

// =======*======= MONSTER SETTINGS =======*=======
// * Mob Quantity Limit depending on the map size
// - Big Maps
set .m_limit_b,100;
// - Small Maps
set .m_limit_s,30;

// * Maps List
// - Big Maps 
setarray .map_b$[0],"prontera","geffen","payon","morocc","aldebaran","alberta";
// For every map you have to add an postfix in the same order,
// which has been put in the array for the Maps
// After this, just set an array with the Mob IDs where the
// array name contains the postfix you set-up, see the examples
setarray .map_post_b$[0],"pron","gef","pay","mor","alde","alb";
// - Small Maps
setarray .map_s$[0],"izlude";
setarray .map_post_s$[0],"izl";
// ======= Monster ID's =======
// ------ Big Maps ------
// * Prontera - Mantis, Thief Bug Male, Argos, Side Winder
setarray .mob_pron[0],1139,1054,1100,1037;
// * Geffen - Poison Spore, Ghoul, Jakk, High Orc
setarray .mob_gef[0],1855,1036,1130,1213;
// * Payon - Zombie, Elder Willow, Munak, Nine Tail, Drainliar
setarray .mob_pay[0],1015,1033,1026,1180,1111;
// * Morocc - Requiem, Isis, Mummy, Minorous
setarray .mob_mor[0],1164,1029,1041,1149;
// * Aldebaran - Cramp, Penomena, Punk, Orc Archer, Bathory
setarray .mob_alde[0],1209,1029,1199,1189,1102;
// * Alberta - Pirate Skeleton, Penomena, Poison Spore, Whisper, Mimic
setarray .mob_alb[0],1071,1029,1077,1179,1191;
// ------ Small Maps ------
// * Izlude - Obeaune, Merman, Swordfish, Strouf
setarray .mob_izl[0],1044,1264,1069,1065;

// ------ Mob Amount Calculation for Big Maps ------
for ( set [email protected],0; [email protected] < getarraysize(.map_post_b$); set [email protected],[email protected] + 1) 
    setd(".mam_"+.map_post_b$[[email protected]]),( .m_limit_b/getarraysize(getd(".mob_"+.map_post_b$)) );
    
// ------ Mob Amount Calculation for Small Maps ------
for ( set [email protected],0; [email protected] < getarraysize(.map_post_s$); set [email protected],[email protected] + 1)
    setd(".mam_"+.map_post_s$[[email protected]]),( .m_limit_s/getarraysize(getd(".mob_"+.map_post_s$)) );

// ======= Final Kill Settings =======
// * Will the player who gets the final kill be rewarded?
// Only working during a Single Invasion
// - 1: Yes
// - 0: No
set .inva_final,1;

if(.inva_final == 1) {
    // * Reward Type:
    // - 1: Zeny
    // - 2: Cash Points
    // - 512+: Item ID (the Value is already the Item ID)
    set .inva_f_id,40006;
    // * Reward Amount:
    set .inva_f_am,1;
}
// =======*======= END of SETTINGS =======*=======
// Even if .delay is 0, its required to start the timer for force ending the event :I
initnpctimer;
if(.debug) {
    debugmes .n$+": .inva_delay: "+.inva_delay;
    debugmes .n$+": gettimetick(2): "+gettimetick(2);
}
if(.delay == 1 && DELAY(.delay_type,.delay_pos,1) < 1) // If the delay value is empty, set it!!
    DELAY(.delay_type,.delay_pos,2);
    
if(.debug) 
    debugmes .n$+": .inva_delay: "+.inva_delay;

if(.inva_statusinit == 1) // Starting Invasion on Server Start
    donpcevent strnpcinfo(0)+"::OnInvaInit";
// Custom Commands for GM's
bindatcmd "invastart",strnpcinfo(0)+"::OnInvaInit",1,99;
bindatcmd "invaend",strnpcinfo(0)+"::OnInvaForceEnd",1,99;
end;

function    DELAY    {
// Format: DELAY(.delay_type,.delay_pos,1/2);
// getarg(0) = Delay Type
// * 1: Random
// * 2: Fixed Delay
// * 3: Ranged Delay
// getarg(1) = Array Position if getarg(0) == 2 || 3
// getarg(2): Read/Write
// * 1: Read
// * 2: Write
if(getarg(2) == 1) 
    return (.inva_delay - gettimetick(2));
    
switch(getarg(0)) {
    case 1:    set [email protected]_inva,.time[rand(getarraysize(.time))]; break;
    case 2: set [email protected]_inva,.time[getarg(1)]; break; 
    case 3: set [email protected]_inva,.time[rand(getarg(1),getarraysize(.time) - 1)]; break;
}
set .inva_delay,gettimetick(2) + [email protected]_inva;
return [email protected]_inva;    
}

}
prontera,150,175,4    script    Invasion Rewarder    110,{

mes .n$;
mes "Hello, "+strcharinfo(0)+"!";
mes "So you want to be rewarded from the Mob Invasion Event, huh?";
mes "Let me take a look at your battle record.";
next;
mes .n$;
if(!InvaKill) {
    mes "It seems like you didn't participated at all or you got your reward already.";
    mes "So I can't give you any kind of reward.";
    mes "Try your best next time.";
    close;
}
mes "You haved killed "+InvaKill+" monsters, good job there.";
next;
mes .n$;
set [email protected]_am,InvaKill*.rew_am;
set [email protected]_bonus, ( (.rew_bonus > 0)?(InvaKill*.rew_bonus):.rew_bonus);
set [email protected],[email protected]_am + [email protected]_bonus;

if(.rew_type == 1) {
    mes "You have recieved "[email protected]+"x "+( (.rew_bonus == 1)?"(Bonus: +"[email protected]_bonus+") ":"") + getitemname(.rew_id)+".";
    getitem .rew_id,[email protected];
} else if(.rew_type == 2) {
    mes "You have recieved "[email protected]+"x "+( (.rew_bonus == 1)?"(Bonus: +"[email protected]_bonus+") ":"") + "Cash Points.";
    set #CASHPOINTS,#CASHPOINTS + (.rew_am+.rew_bonus);
}
set InvaKill,0;
close;

OnInit:
set .n$,"["+strnpcinfo(0)+"]";
// =======*======= REWARD SETTINGS =======*=======
// * Reward Type:
// - 0: None
// - 1: Item
// - 2: Cash Points
set .rew_type,1;

// * Reward Bonus
// - 0: Off
// - 1 and higher: On
// = This bonus will be given to the kill additionally.
set .rew_bonus,0;
// ----- Item -----
if(.rew_type == 1) 
    set .rew_id,7929; // Item ID    
// ----- Reward Quantity -----
set .rew_am,10; // Amount per Kill
// ----- NPC Auto Disable -----
// After how many minutes will the NPC be disabled again:
set .rew_dis,3;
disablenpc strnpcinfo(0);
end;
}

 

Please use codebox next time, so it doesn't create any unnecessary lines.
Also I don't provide any script modifications anymore, as I stopped scripting since the Translation project take-over.
So as long they are no bugs, I won't do something to the scripts. Sorry.

Edited by llchrisll
Codeboxed the quote....
  • Like 2

Share this post


Link to post
Share on other sites

Hi Chris

It's really great to see, that you're still supporting your script.

May I know, the issue with Mass Seller.

 

If I choose "Sell item", then "continue" - nothing happens.

Even don't see CLOSE button in the dialogue.

Map servers says:

[Error]: run_script: infinity loop !
[Debug]: Source (NPC): Mass Seller at prontera (163,174)

 

Dont you know, what can it be? 

 

Thx. 

 

57154-clip-4kb.png

d0f3d-clip-28kb.jpg

Share this post


Link to post
Share on other sites
On 2/11/2021 at 1:31 AM, llchrisll said:

Please use codebox next time, so it doesn't create any unnecessary lines.
Also I don't provide any script modifications anymore, as I stopped scripting since the Translation project take-over.
So as long they are no bugs, I won't do something to the scripts. Sorry.

im so sorry for that kinda newbie here,

its kinda buggy ,

1. not announcing everytime it kills (only announces once reached 5 remaining)
2. mobs did not spawn all in one time, (there is a certain number will spawn as 1st batch then next batch will spawn)
3. its not force ending after the given force end time

Share this post


Link to post
Share on other sites
On 2/15/2021 at 2:41 AM, iSnowFlakes said:

im so sorry for that kinda newbie here,

its kinda buggy ,

1. not announcing everytime it kills (only announces once reached 5 remaining)
2. mobs did not spawn all in one time, (there is a certain number will spawn as 1st batch then next batch will spawn)
3. its not force ending after the given force end time

Well 1+2 are intentional, mostly.
Well gonna take a look at it again, when I have more time or rather motivation, still needs to fix other scripts, Battle Royale and Dynamic BG Arena >_>.
But the translation project takes time so I pretty much focus solely on that.
Sorry, that I can't fix my scripts ASAP.

 

On 2/13/2021 at 11:01 PM, Timokha said:

Hi Chris

It's really great to see, that you're still supporting your script.

May I know, the issue with Mass Seller.

 

If I choose "Sell item", then "continue" - nothing happens.

Even don't see CLOSE button in the dialogue.

Map servers says:

[Error]: run_script: infinity loop !
[Debug]: Source (NPC): Mass Seller at prontera (163,174)

 

Dont you know, what can it be? 

 

Thx. 

 

57154-clip-4kb.png

d0f3d-clip-28kb.jpg

infinite loop is that it needs a pause in between, gonna add it to my todo list regarding scripts to look at it further.

Share this post


Link to post
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
Reply to this topic...

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.