Hi. I'm having trouble with this script. It's really cool though, it does not work properly, I just modified the summoned monsters, it's practically the original script of the author. The problems are:
When you kill all the monsters, the event does not end.
When killing the winning monsters, the item configured(7711) in the NPC is not being received.
@edit
No errors presented in the map-server
/*=========================================================
Hercules Invasion Prized
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$ = "Mapa sofisticado"; // Invasion map name
.map$ = "guild_vs2"; // Invasion map
.reward = 7711; // Event Ticket
.tiers = 3; // Amount of tiers //Níveis de monstros, como se fosse andares..
.limit = 22; // Kill limit
.delay = 5; // Announcement delay in seconds
.auth = 60; // GM level to access staff panel
// Normal mob IDs
setarray .normal[0], 1916, 1918, 1919, 1920, 1921;
// Normal mob amounts
setarray .n_mobs[0], 1, 3, 3, 3, 3;
// Prized mob IDs
setarray .prized[0], 1916, 1918, 1919, 1920, 1921;
// Prized mob amounts
setarray .p_mobs[0], 0, 1, 1, 1, 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], 1918;
// Tier 2
setarray .@tier2[0], 1919;
// Tier 3
setarray .@tier3[0], 1920;
// Tier 4
setarray .@tier4[0], 1921;
// Tier 5
setarray .@tier5[0], 1916;
// 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;
}
@edit
No errors presented in the map-server
Share this post
Link to post
Share on other sites