Hello,
you could do it something like this.
prontera,150,150,0 script Entrance Guard 112,{
mes "[Entrance Guard]";
if (agitcheck() || agitcheck2() || agitcheck3()) {
mes "Woe is currently active you can't enter right now";
close;
}
.@gid = getcastledata("prtg_cas01", CD_GUILD_ID);
if (getcharid(2) != .@gid) {
mes "[Entrance Guard]";
mes "Your Guild did not conquer Krimhild Castle!";
dispbottom "[Guild Message]: Only the Guild that owns Kriemhild Castle can enter here!";
close;
}
mes "You will be warped to Lost Midgard";
next;
warp .map$, 0, 0;
dispbottom "[Guild Message]: Welcome to Lost Midgard";
end;
OnGuildpointmobDeath:
if ( .rate > rand( 10 ) ) {
.@point = rand( .guild_amount[0], .guild_amount[1] );
#GUILDPOINTS += .@point;
dispbottom "Gained " + .@point + " Point. You got "+F_InsertComma( #GUILDPOINTS ) + " Points now.";
}
callsub MobSpawn, strcharinfo(3), .respawnGPmobs;
end;
OnGoldmobDeath:
.@r = rand(100);
if ( .@r < 3 )
getitem 969, 50;
else if ( .@r < 5 )
getitem 969, 20;
else if ( .@r < 25 )
getitem 969, 5;
else if ( .@r < 50 )
getitem 969, 3;
else
getitem 969, 1;
callsub MobSpawn, strcharinfo(3), .respawnGoldmobs;
end;
MobSpawn:
.@map$ = getarg(0);
for(.@i = 0; .@i < getarraysize(getarg(1)); .@i += 3) {
.@mobId = getelementofarray(getarg(1), .@i);
.@mobType = getelementofarray(getarg(1), .@i + 1);
.@mobAmt = getelementofarray(getarg(1), .@i + 2);
.@mobTypeName$ = .mobTypeNames$[.@mobType];
.@mobLabel$ =.labels$[.@mobType];
monster .@map$, 0,0, .@mobTypeName$, .@mobId, .@mobAmt, strnpcinfo(0) + "::" + .@mobLabel$;
}
return;
OnInit:
//Castle Maps
setarray .maps$[0], "prt_fild07", "prt_fild08";
// Guildpoints random amount
setarray .guild_amount, 1, 3;
// Rate to get Guildpoints
.rate = 100;
// Mob Spawn
// ID, Type (0 = Gold, 1 = Guildpoints), Amount
setarray .mobs[0],
1369, 0, 100,
1840, 0, 100,
1934, 1, 50,
1935, 1, 50;
// Respawn Mobs Gold
// ID, Type (0 = Gold, 1 = Guildpoints), Amount
setarray .respawnGoldmobs[0],
1369, 0, 1,
1840, 0, 1;
// Respawn Mobs Guildpoints
// ID, Type (0 = Gold, 1 = Guildpoints), Amount
setarray .respawnGPmobs[0],
1934, 1, 1,
1935, 1, 1;
setarray .mobTypeNames$[0], "[DG]Gold", "[DG]Flower";
setarray .labels$[0], "OnGoldmobDeath", "OnGuildpointmobDeath";
for(.@i = 0; .@i < getarraysize(.maps$); .@i++) {
setmapflag .maps$[.@i], MF_LOADEVENT;
callsub MobSpawn, .maps$[.@i], .mobs;
}
// fallthrough as first check upon script loaded
OnTimer5000: // next timer after ini will run on 5 seconds after
.@gid = getcastledata("prtg_cas01", CD_GUILD_ID);
.@num = getmapunits(BL_PC, .map$, .@name$[0]);
freeloop(1);
for (.@i = 0; .@i < .@num;.@i++) {
if (getcharid(2, .@name$[.@i]) == .@gid) // still on the guild? skip it.
continue;
message .@name$[.@i], "YOU ARE NO LONGER WELCOME HERE, YOU WILL BE WARPED TO WHERE YOU BELONG!!!!";
warp "SavePoint", 0, 0, getcharid(0, .@name$[.@i]);
}
freeloop(0);
initnpctimer; // reinit the timer tick
end;
OnAgitStart:
OnAgitStart2:
OnAgitStart3:
.@num = getmapunits(BL_PC, .map$, .@name$[0]);
freeloop(1);
for (.@i = 0; .@i < .@num; .@i++) {
message .@name$[.@i], "Agit event has been started, You will be warped to Save Point";
warp "SavePoint", 0, 0, getcharid(0, .@name$[.@i]);
}
freeloop(0);
end;
OnPCLoadMapEvent:
if (strcharinfo(3) != .map$)
end;
if (agitcheck() || agitcheck2() || agitcheck3()) {
message strcharinfo(0), "Agit event is on going, You will be warped to Save Point";
warp "SavePoint", 0, 0;
end;
}
.@gid = getcastledata("prtg_cas01", CD_GUILD_ID);
if (getcharid(2) != .@gid) {
mes "YOU ARE NOT ALLOWED HERE, GO BACK!!!!";
next;
warp "SavePoint", 0, 0;
}
}