viewing paste Unknown #19572 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
/*=========================================================
Hercules Invasion
by Mumbles
===========================================================
Description:
A completely revamped and optimised variation of the widely
popular "Poring Invasion" event.
 
Configuration settings are dynamic and easily modifiable.
Customizable parameters include normal monsters, "prized"
monsters, each respective monster amounts, monster tiers,
invasion map,NPC name, and server name.
 
NPC can be triggered by staff using the command @invasion.
===========================================================
Compatibility:
Optimised for Hercules emulators.
===========================================================
Changelog:
v1.0 - First version.
    v1.0.1 - Removed support for backwards compatibility.
    v1.0.2 - Optimised announcements.
=========================================================*/
 
-   script  invasion    -1,{
 
    OnInit:
        // Configuration
        .npc_name$ = "[^0000FFHercules Invasion^000000]";
        .server_name$ = "Hercules"; // Server name
        .map_name$ = "Geffen";      // Invasion map name
        .map$ = "geffen";   // Invasion map
        .reward = 7711; // Event Ticket
        .tiers = 3;     // Amount of tiers
        .limit = 22;    // Kill limit
        .delay = 5;     // Announcement delay in seconds
        .auth = 60;     // GM level to access staff panel
        
        // Normal mob IDs
        setarray .normal[0],    1002,   1031,   1113,   1242,   1613,   1784,
                                1388,   1582,   1120,   1062,   1090,   1096;
        
        // Normal mob amounts
        setarray .n_mobs[0],     300,    300,    300,    300,    300,    300,
                                  10,     40,     40,    300,     40,     40;
        
        // Prized mob IDs
        setarray .prized[0],    1002,   1031,   1113,   1242,   1613,   1784,
                                1582,   1120,   1062,   1096;
                    
        // Prized mob amounts           
        setarray .p_mobs[0],       3,      2,      3,      3,      3,      3,
                                   1,      1,      3,      1;
        
        // Define announcements
        setarray .announce$[0],
            "Porings of the world seem to have started an uprising because they continue to be hunted...",
            "It appears that they plan to raid the city of "+ .map_name$ +" today!",
            "They've feared "+ .map_name$ +" for ages, and are sick of it!",
            "Prepare yourself, Warriors of "+ .server_name$ +"!",
            "They're approaching...",
            "The "+ .map_name$ +" Soldiers are unable to fight!",
            "They need assistance!";
        
        // Create @invasion command
        bindatcmd "invasion", strnpcinfo(3) +"::OnInvasion", .auth, .auth;
        
        end;
    
    
    OnInvasion:
        mes .npc_name$;
        mes "Hey there, "+ strcharinfo(0) +"!";
        mes "What would you like to do?";
        mes " ";
        
        while (true) {
            switch(select("Start invasion:Stop invasion")) {
                case 1:
                    // Check invasion status
                    if(.state) {
                        mes "^FF0000The invasion is already in progress!^000000";
                        break;
                    }
                    
                    close2;
                    
                    OnEnable:
                        // Set invasion status
                        .state++;
                        .wave++;
            
                        // Announcements
                        for (.@i = 0; .@i < getarraysize(.announce$); .@i++) {
                            announce .announce$[.@i], bc_all;
                            sleep .delay * 1000;
                        }
                        
                        announce "Wave "+ .wave +" of the Poring forces presses onward!", bc_all;
            
                        // Normal mobs
                        for (.@i = 0; .@i < getarraysize(.normal); .@i++) {
                            monster .map$, 0, 0, getmonsterinfo(.normal[.@i], 0), .normal[.@i], .n_mobs[.@i], "";
                        }
                            
                        // Prized mobs
                        for (.@i = 0; .@i < getarraysize(.prized); .@i++) {
                            monster .map$, 0, 0, getmonsterinfo(.prized[.@i], 0), .prized[.@i], .p_mobs[.@i], strnpcinfo(3) +"::OnMobKilled";
                        }
                            
                        setmapflag .map$, mf_nomobloot;
                        initnpctimer;
                        .state++;
                    
                    end;
 
                case 2:
                    // Check invasion status
                    if(.state < 2) {
                        mes "^FF0000There is no invasion in progress!^000000";
                        break;
                    }
                    
                    // End invasion
                    donpcevent strnpcinfo(3) +"::OnTimer3600000";
                    close;
            }
        }
        
        
    OnClock0100:
    OnClock2100:
        // Start invasion
        donpcevent strnpcinfo(3) +"::OnEnable";
        end;
        
        
    OnMobKilled:
        // Tier 1
        setarray .@tier1[0], 1002, 1031, 1062, 1113, 1242, 1613, 1784;
        
        // Tier 2
        setarray .@tier2[0], 1582;
        
        // Tier 3
        setarray .@tier3[0], 1096, 1120;
        
        // Check if monster killed is listed in tiers
        for (.@t = 0; .@t < .@tiers; .@t++) {
            for (.@i = 0; .@i < getarraysize(getd(".@tier"+ (.@t + 1))); .@i++) {
                if (.state && killedrid == .@tier1[.@i]) {
                    .@amount = .@t + 1;
                    .@winner++;
                }
            }
        }
        
        // Reward and announce winner; increment count
        if (.@winner) {
            announce .@tier +" "+ getitemname(.reward) +" won by "+ strcharinfo(0) + ".", bc_map | bc_blue;
            getitem .reward, .@amount;
            .count++;
        }
        
        if (.count > .limit) {
            OnTimer3600000:
                // Kill all monsters and reset invasion status
                killmonster .map$,"All";
                announce "Poring forces have been overcome. They're retreating!",0;
                removemapflag .map$, mf_nomobloot;
                stopnpctimer;
                .count = 0;
                .state = 0;
        }
        
        end;
 
}
Viewed 619 times, submitted by Guest.