Jump to content
  • 0

Random Castle Drop in SE castle


Jade

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/27/18
  • Last Seen:  

how to randomize castle drop on SE castle
i have copied my TE castle main script..
but it seems that it is not working on SE castle...
it only drops treasure box without any castle drops on it

original script

OnClock0001:
	// Spawn Treasure Chests based on castle economy.
	if (strnpcinfo(2) == "template") end;
	if (!getcastledata(strnpcinfo(2),1)) end;
	killmonster strnpcinfo(2),strnpcinfo(0)+"::OnTreasureDied";
	if (getcastledata(strnpcinfo(2),4)) {
		set .@Economy,getcastledata(strnpcinfo(2),2);
		setcastledata strnpcinfo(2),2,.@Economy+getcastledata(strnpcinfo(2),4)+(rand(2) && getgdskilllv(getcastledata(strnpcinfo(2),1),10014));
		if (getcastledata(strnpcinfo(2),2) > 100) setcastledata strnpcinfo(2),2,100;
		setcastledata strnpcinfo(2),4,0;
	}
	if (getcastledata(strnpcinfo(2),5)) {
		set .@Defence,getcastledata(strnpcinfo(2),3);
		setcastledata strnpcinfo(2),3,.@Defence+getcastledata(strnpcinfo(2),5);
		if (getcastledata(strnpcinfo(2),3) > 100) setcastledata strnpcinfo(2),3,100;
		setcastledata strnpcinfo(2),5,0;
	}
	set .@Treasure,getcastledata(strnpcinfo(2),2)/5+4;
	if (!.@Treasure) end;
	freeloop(1);
	if (compare(strnpcinfo(2),"arug")) {
		if (strnpcinfo(2) == "arug_cas01") { 
			set .@treasurebox,1943;
			setarray .@treasurex[0],251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258;
			setarray .@treasurey[0],369,369,369,369,368,368,368,368,367,367,367,367,366,366,366,366,365,365,365,365,364,364,364,364;
		}
		else if (strnpcinfo(2) == "arug_cas02") { 
			set .@treasurebox,1944;
			setarray .@treasurex[0],382,383,384,385,386,387,384,385,386,387,388,389,382,383,384,385,386,387,384,385,386,387,388,389;
			setarray .@treasurey[0],231,231,231,231,231,231,230,230,230,230,230,230,225,225,225,225,225,225,224,224,224,224,224,224;
		}
		else { 	// Castles 3,4,5 are identical, except 4's treasure.
			set .@treasurebox,(strnpcinfo(2) == "arug_cas04")?1946:1945;
			setarray .@treasurex[0],291,292,293,294,295,296,293,294,295,296,297,298,291,292,293,294,295,296,293,294,295,296,297,298;
			setarray .@treasurey[0],276,276,276,276,276,276,274,274,274,274,274,274,272,272,272,272,272,272,269,269,269,269,269,269;
		}
	}
	else {
		if (strnpcinfo(2) == "schg_cas02") { 
			set .@treasurebox,1939;
			setarray .@treasurex[0],249,250,251,252,253,246,247,248,249,250,250,251,252,253,246,247,248,249,250,249,250,251,252,253;
			setarray .@treasurey[0],378,378,378,378,378,376,376,376,376,376,374,374,374,374,372,372,372,372,372,370,370,370,370,370;
		}
		else if (strnpcinfo(2) == "schg_cas03") { 
			set .@treasurebox,1940;
			setarray .@treasurex[0],189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194;
			setarray .@treasurey[0], 21, 21, 21, 21, 21, 21, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 15, 15, 15, 15, 15, 15;
		}
		else {	// Castles 1,4,5 are identical, except treasures.
			if (strnpcinfo(2) == "schg_cas01") set .@treasurebox,1938;
			else if (strnpcinfo(2) == "schg_cas04") set .@treasurebox,1941;
			else set .@treasurebox,1942;
			setarray .@treasurex[0],388,388,388,387,386,385,384,384,384,384,384,384,385,386,387,388,389,390,390,390,389,388,387,386;
			setarray .@treasurey[0],388,389,390,390,390,390,389,388,387,386,385,384,384,384,384,384,384,384,385,386,386,386,386,386;
		}
	}
	for(set .@i,0; .@i<4; set .@i,.@i+1)
		monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
	for(set .@i,4; .@i<24; set .@i,.@i+1) {
		if (.@Treasure < .@i+1) break;
		monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
	}
	freeloop(0);
	end;

OnTreasureDied:
	end;
}


my current script
 

OnClock1215:
	// Spawn Treasure Chests based on castle economy.
	if (strnpcinfo(2) == "template") end;
	if (!getcastledata(strnpcinfo(2),1)) end;
	killmonster strnpcinfo(2),strnpcinfo(0)+"::OnTreasureDied";
	if (getcastledata(strnpcinfo(2),4)) {
		set .@Economy,getcastledata(strnpcinfo(2),2);
		setcastledata strnpcinfo(2),2,.@Economy+getcastledata(strnpcinfo(2),4)+(rand(2) && getgdskilllv(getcastledata(strnpcinfo(2),1),10014));
		if (getcastledata(strnpcinfo(2),2) > 100) setcastledata strnpcinfo(2),2,100;
		setcastledata strnpcinfo(2),4,0;
	}
	if (getcastledata(strnpcinfo(2),5)) {
		set .@Defence,getcastledata(strnpcinfo(2),3);
		setcastledata strnpcinfo(2),3,.@Defence+getcastledata(strnpcinfo(2),5);
		if (getcastledata(strnpcinfo(2),3) > 100) setcastledata strnpcinfo(2),3,100;
		setcastledata strnpcinfo(2),5,0;
	}
	set .@Treasure,getcastledata(strnpcinfo(2),2)/5+4;
	if (!.@Treasure) end;
	freeloop(1);
	if (compare(strnpcinfo(2),"arug")) {
		if (strnpcinfo(2) == "arug_cas01") { 
			//set .@treasurebox,1943;
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			set .@treasurebox,.randTB[ .Random ];
			setarray .@treasurex[0],251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258;
			setarray .@treasurey[0],369,369,369,369,368,368,368,368,367,367,367,367,366,366,366,366,365,365,365,365,364,364,364,364;
		}
		else if (strnpcinfo(2) == "arug_cas02") {
			//set .@treasurebox,1944;
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			set .@treasurebox,.randTB[ .Random ];
			setarray .@treasurex[0],382,383,384,385,386,387,384,385,386,387,388,389,382,383,384,385,386,387,384,385,386,387,388,389;
			setarray .@treasurey[0],231,231,231,231,231,231,230,230,230,230,230,230,225,225,225,225,225,225,224,224,224,224,224,224;
		}
		else { 	// Castles 3,4,5 are identical, except 4's treasure.
			//set .@treasurebox,(strnpcinfo(2) == "arug_cas04")?1946:1945;
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			set .@treasurebox,(strnpcinfo(2) == "arug_cas04")?.randTB[ .Random ]:.randTB[ .Random ];
			setarray .@treasurex[0],291,292,293,294,295,296,293,294,295,296,297,298,291,292,293,294,295,296,293,294,295,296,297,298;
			setarray .@treasurey[0],276,276,276,276,276,276,274,274,274,274,274,274,272,272,272,272,272,272,269,269,269,269,269,269;
		}
	}
	else {
		if (strnpcinfo(2) == "schg_cas02") { 
			//set .@treasurebox,1939;
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			set .@treasurebox,.randTB[ .Random ];
			setarray .@treasurex[0],249,250,251,252,253,246,247,248,249,250,250,251,252,253,246,247,248,249,250,249,250,251,252,253;
			setarray .@treasurey[0],378,378,378,378,378,376,376,376,376,376,374,374,374,374,372,372,372,372,372,370,370,370,370,370;
		}
		else if (strnpcinfo(2) == "schg_cas03") { 
			//set .@treasurebox,1940;
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			set .@treasurebox,.randTB[ .Random ];
			setarray .@treasurex[0],189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194;
			setarray .@treasurey[0], 21, 21, 21, 21, 21, 21, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 15, 15, 15, 15, 15, 15;
		}
		else {	// Castles 1,4,5 are identical, except treasures.
			setarray .randTB[0],1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362;
			set .Random, rand( getarraysize( .randTB ) );
			//set .@treasurebox,.randTB[ .Random ];
			if (strnpcinfo(2) == "schg_cas01") set .@treasurebox,.randTB[ .Random ];
			else if (strnpcinfo(2) == "schg_cas04") set .@treasurebox,.randTB[ .Random ];
			else set .@treasurebox,.randTB[ .Random ];
			setarray .@treasurex[0],388,388,388,387,386,385,384,384,384,384,384,384,385,386,387,388,389,390,390,390,389,388,387,386;
			setarray .@treasurey[0],388,389,390,390,390,390,389,388,387,386,385,384,384,384,384,384,384,384,385,386,386,386,386,386;
		}
	}
	for(set .@i,0; .@i<4; set .@i,.@i+1)
		monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
	for(set .@i,4; .@i<24; set .@i,.@i+1) {
		if (.@Treasure < .@i+1) break;
		monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
	}
	freeloop(0);
	end;

OnTreasureDied:
	end;
}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...