Created
October 12, 2017 07:18
-
-
Save akiyamamio16/921f268aa0609ca6572ac3b0b64b6917 to your computer and use it in GitHub Desktop.
Party Random Warp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prontera,155,181,4 scrip Warper 811,{ | |
set .@leaderID,getpartyleader(getcharid(1),2); //get party leader id | |
getpartymember getcharid(1),0; //get party members | |
.@count = $@partymembercount; //transfer temporary to character | |
copyarray .@plid[0], $@partymembercid[0], $@partymembercount; //transfer temporary to character | |
if(getcharid(0)==.@leaderID){ | |
switch(select("Warp:Cancel")){ | |
case 1: | |
goto checkParty; | |
case 2: | |
end; | |
} | |
}else{ | |
npctalk "Only party leader can talk to me"; | |
} | |
end; | |
checkParty: | |
if(.@count>getarraysize(.LocationX)){ | |
mes "You cannot warp because"; | |
mes "your party is more than"; | |
mes getarraysize(.LocationX)+" members"; | |
end; | |
}else{ | |
goto warpParty; | |
} | |
end; | |
warpParty: | |
for(.@i=0;.@i<.@count;.@i++){ | |
set .@rand,rand(0,getarraysize(.LocationX)); | |
set .@warpX[.@i],.LocationX[.@rand]; | |
set .@warpY[.@i],.LocationY[.@rand]; | |
for(set .@j=0; .@j<getarraysize(.@count);set .@j,.@j+1){ | |
if(.@warpX[.@i]==.@warpedX[.@j]){ | |
set .@rand,rand(0,getarraysize(.LocationX)); | |
set .@warpX[.@i],.LocationX[.@rand]; | |
set .@warpY[.@i],.LocationY[.@rand]; | |
set .@j,.@j-.@j-1; | |
} | |
set .@warpedX[.@i],.@warpX[.@j]; | |
set .@warpedY[.@i],.@warpY[.@j]; | |
} | |
warp .@map$,.LocationX[.@warpedX[.@i]],.LocationY[.@warpedY[.@i]],.@plid[.@i] | |
} | |
end; | |
OnInit: | |
set .map$,"prontera"; | |
setarray .LocationX[0],262,244,155,115,74,86,139,195,155; | |
setarray .LocationY[0],205,291,322,302,226,142,120,130,182; | |
end; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment