Hi, I've spent the past 2 hours trying to figure this out, basically I want to change the bc after breaking an emp to add the breaker's name instead of just showing the guild who conquered it.
WoE v1 does this perfectly fine using:
OnAgitBreak:
callfunc "CPEmp0";
set .@GID,getcharid(2);
set .@BREAKER$,strcharinfo(0);
// Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)
if (.@GID <= 0) {
set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium in Castle: "+strnpcinfo(2)+" while guildless. No data will be saved and Emperium respawned.";
logmes .@notice$; debugmes .@notice$;
donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
end;
}
// Adjust Economy Invest Level for Castle
set .@Economy,GetCastleData(strnpcinfo(2),2) - 5;
if (.@Economy < 0) set .@Economy, 0;
SetCastleData strnpcinfo(2), 2, .@Economy;
// Adjust Defense Invest Level for Castle
set .@Defence,GetCastleData(strnpcinfo(2),3) - 5;
if (.@Defence < 0) set .@Defence, 0;
SetCastleData strnpcinfo(2), 3, .@Defence;
// Set new Castle Occupant
SetCastleData strnpcinfo(2),1, .@GID;
// Announce that the Emperium is destroyed, and respawn all but new castle-occupants.
mapannounce strnpcinfo(2),"The emperium has been destroyed.",bc_map|bc_woe,"0x00CCFF",FW_NORMAL,12;
MapRespawnGuildID strnpcinfo(2),.@GID,2;
// Refresh castle data, disable Kafra and reset Invest information.
GetCastleData strnpcinfo(2),0,strnpcinfo(0)+"::OnRecvCastle";
disablenpc "Kafra Staff#"+strnpcinfo(2);
for( set .@i, 4; .@i <= 9; set .@i, .@i+1 ) {
SetCastleData strnpcinfo(2), .@i, 0;
}
// Erase Guardian Database information if the new owners do not have Guardian Research.
if( getgdskilllv(.@GID,10002) == 0 ) {
for( set .@i, 10; .@i <= 17; set .@i, .@i+1 ) {
SetCastleData strnpcinfo(2), .@i, 0;
}
}
// Respawn the Emperium, and display new owners.
sleep 500; // Slow down script execution slightly.
if( agitcheck() )
donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
sleep getbattleflag("gvg_eliminate_time");
announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by [" + .@BREAKER$ + "] of the [" + getguildName(.@GID) + "] guild.",bc_all|bc_npc;
end;
But it just won't work for WoE v2 castles. -____- I keep getting:
[Error]: npc_event: event not found [steward#aru01::OnStartArena]
This is the latest I've tried, and it's still erroring:
OnStartArena:
callfunc "CPEmp0";
set .@GID,getcharid(2);
set .@breakername$, strcharinfo(0);
// Lower castle Economy
set .@Economy,GetCastleData("arug_cas01",2) - 5;
if (.@Economy < 0) set .@Economy, 0;
SetCastleData "arug_cas01", 2, .@Economy;
// Lower Castle Defence
set .@Defence,GetCastleData("arug_cas01",3) - 5;
if (.@Defence < 0) set .@Defence, 0;
SetCastleData "arug_cas01", 3, .@Defence;
// Set new owner
SetCastleData "arug_cas01",1, .@GID;
// Clear castle's data.
for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
SetCastleData "arug_cas01", .@i, 0;
// Disable Kafra
disablenpc "Kafra Employee#aru01";
set .msg,2;;
if (.msg == 1) {
announce "Fortress [" + GetCastleName("arug_cas01") + "]'s 'Valfreyja' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all|bc_woe;
donpcevent "Manager#aru01_02::Onstart";
}
else if (.msg == 2) {
announce "The [Valfreyja 1] stronghold of " + GetCastleName("arug_cas01") has been conquered by "+ .@breakername$ +" of the [" + getguildname(.@gid) + "] ,bc_all|bc_woe;
mapannounce "arug_cas01","The emperium has been shattered!",bc_map,"0x00FF00",FW_NORMAL,20,0,40;
if (agitcheck2()) {
sleep 500;
donpcevent "Manager#aru01_02::Onreset";
initnpctimer;
}
else {
donpcevent "Manager#aru01_02::Onreset";
stopnpctimer;
}
}
else if (.msg == 0) {
announce "Fortress [" + GetCastleName("arug_cas01") + "]'s 'Valfreyja' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all|bc_woe;
donpcevent "Manager#aru01_02::Onreset";
stopnpctimer;
end;
}
MapRespawnGuildID "arug_cas01",GetCastleData("arug_cas01",1),2;
GetCastleData "arug_cas01",0,"::OnRecvCastleAr01";
end;
Question
rqueen
Hi, I've spent the past 2 hours trying to figure this out, basically I want to change the bc after breaking an emp to add the breaker's name instead of just showing the guild who conquered it.
WoE v1 does this perfectly fine using:
But it just won't work for WoE v2 castles. -____- I keep getting:
I'm really running out of ideas. D:
Edited by rqueen2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.