- script sample_castle_swap -1,{
OnInit:
bindatcmd "swapcastle",strnpcinfo(3)+"::OnAtcommand";
end;
OnAtcommand:
if ( .@atcmd_numparameters != 2 ) {
dispbottom "Enter 2 caslte map.";
dispbottom .@atcmd_command$+" <map1> <map2>";
}
else if ( getmapflag( .@atcmd_parameters$[0],mf_castle_gvg ) ) {
dispbottom "Map : "+.@atcmd_parameters$[0]+" isnt a castle.";
}
else if ( getmapflag( .@atcmd_parameters$[1],mf_castle_gvg ) ) {
dispbottom "Map : "+.@atcmd_parameters$[1]+" isnt a castle.";
}
else {
callsub( OnSwap,.@atcmd_parameters$[0],.@atcmd_parameters$[1] );
}
end;
OnSwap:
.@castle_1$ = getarg(0);
.@castle_2$ = getarg(2);
for ( .@i = 1; .@i <= 17; .@i++ ) {
.@arg_1[.@i] = getcastledata( .@castle_1$,.@i );
.@arg_2[.@i] = getcastledata( .@castle_2$,.@i );
setcastledata( .@castle_1$,.@i,.@arg_2[.@i] );
setcastledata( .@castle_2$,.@i,.@arg_1[.@i] );
}
dispbottom "Done swap to castle ( "+.@castle_1$+" <-> "+.@castle_2$+" ).";
end;
}
}