Jump to content
  • 0
Sign in to follow this  
utofaery

donpcevent and slaveclone trouble

Question

1. I was trying to make this work by
                                        donpcevent "Guardian#"+.RTaken$[.@i]+"::OnSpawnGuardians";

but it's not working how do I fix this?


			deletearray (.RTaken$);
			.@menu$ = "";
			.@c = 0;
			for ( .@i = 0 ; .@i < getarraysize(.castle$); ++.@i ) {
				if ( getcastledata( .castle$[.@i], 1 ) == getcharid(CHAR_ID_GUILD) && (.RTaken$[.@i] == .castle$[.@i]) == false ) { // CD_GUILD_ID
					++.@c;
					dispbottom ( .@c + " " + getcastlename(.castle$[.@i]) + " is currently controlled by " + strcharinfo(PC_GUILD) + " " + .RTaken$[.@i] ) ;
					setarray .RTaken$[getarraysize(.RTaken$)],.castle$[.@i];
					.@menu$ = .@menu$ + getcastlename( .castle$[.@i] );
					.@menu$ = .@menu$ + ":";
				}
			}
			if (.@c < 1) {
				mes ( ".@c < 1 You have to work harder to obtain glory, chief!");
				close;
			} else {
				mes ( ".@c == " + .@c);
				mes ( " Select a Castle." );
				.@i = select( .@menu$ ) - 1;
				mes "You selected menu : "+ .@menu$[.@i];
				while(true) {
						switch ( select ( 
							"Maximize Castle Economy & Defense", //xsa//2, 3
							"Enable Kafra", //xsa//9
							"Disable Kafra", //xsa//9
							"Enable All Guardian", // 10 11 12 13 14 15 16 17
							"Check Guild Status",
							"Exit"
						)) {
								case 1:
										setcastledata(.RTaken$[.@i], 2, 100 );
										setcastledata(.RTaken$[.@i], 3, 100 );
										break;
								case 2:
										setcastledata(.RTaken$[.@i], 9, 1 );
										enablenpc "Kafra Staff#"+.RTaken$[.@i];
										break;
								case 3:
										setcastledata(.RTaken$[.@i], 9, 0 );
										disablenpc "Kafra Staff#"+.RTaken$[.@i];
										break;
								case 4:
										setcastledata(.RTaken$[.@i], 10, 1 );
										setcastledata(.RTaken$[.@i], 11, 1 );
										setcastledata(.RTaken$[.@i], 12, 1 );
										setcastledata(.RTaken$[.@i], 13, 1 );
										setcastledata(.RTaken$[.@i], 14, 1 );
										setcastledata(.RTaken$[.@i], 15, 1 );
										setcastledata(.RTaken$[.@i], 16, 1 );
										setcastledata(.RTaken$[.@i], 17, 1 );
										donpcevent "Guardian#"+.RTaken$[.@i]+"::OnSpawnGuardians";
										break;
								case 5:
		 								dispbottom ( "Guld Name :: " + getcastledata(.RTaken$[.@i], 1) ) ;
										dispbottom ( "Guild Economy Level :: " + getcastledata(.RTaken$[.@i], 2) ) ;
										dispbottom ( "Guild Defense Level :: " + getcastledata(.RTaken$[.@i], 3) ) ;
										dispbottom ( "Guild Kafra :: " + getcastledata(.RTaken$[.@i], 9) ) ;
										dispbottom ( "Guild 1st Guardian Soldier :: " + getcastledata(.RTaken$[.@i], 10) ) ;
										dispbottom ( "Guild 2nd Guardian Soldier :: " + getcastledata(.RTaken$[.@i], 11) ) ;
										dispbottom ( "Guild 3rd Guardian Soldier :: " + getcastledata(.RTaken$[.@i], 12) ) ;
										dispbottom ( "Guild 4th Guardian Archer :: " + getcastledata(.RTaken$[.@i], 13) ) ;
										dispbottom ( "Guild 5th Guardian Archer :: " + getcastledata(.RTaken$[.@i], 14) ) ;
										dispbottom ( "Guild 6th Guardian Knight :: " + getcastledata(.RTaken$[.@i], 15) ) ;
										dispbottom ( "Guild 7th Guardian Knight :: " + getcastledata(.RTaken$[.@i], 16) ) ;
										dispbottom ( "Guild 8th Guardian Knight :: " + getcastledata(.RTaken$[.@i], 17) ) ;
										break;
								case 6:
										close;

						}
				}
				close;
			}

OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	end;
}


2. can we disable default woe system and create custom woe system?

3. by doing this


        .@i = 1; .@x = 10;
        while ( .@i <= .@x ) {
            atcommand "@slaveclone "+strcharinfo(0);
            .@i += 1;
        }
        dispbottom ("spawn'ed " + (.@i-1) + " clones" );

can it able to announce when a slave clone die or should it be changed to something else?
if yes please show me how.
and can it be used with 
*setunitdata ??
 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

2. yes ....

3.

prontera,155,185,5	script	Daily Quest	1_F_MARIA,{
	getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
	.@x = 10;
	for ( .@i = 0; .@i < .@x; ++.@i )
		clone .@map$, .@x, .@y, strnpcinfo(NPC_NAME)+"::Onaaa", getcharid(CHAR_ID_CHAR), getcharid(CHAR_ID_CHAR);
	dispbottom sprintf( _$( "Spawned %d clones" ), .@x );
	end;
Onaaa:
	announce sprintf( _$( "%s's slave clone died."), strcharinfo(PC_NAME) ), bc_all;
	end;
}

 


no.1 . actually you are right, I reproduce your problem ....

Spoiler

guardian spawn once, remove once, spawn once ...


prontera,155,185,5	script	asdasd	1_F_MARIA,{
	end;
OnGuardianSpawn:
	for ( .@i = 0; .@i < 20; ++.@i ) {
		if ( getcastledata( .castle$[.@i], 1 ) ) {
			setcastledata( .castle$[.@i], 10, 1 );
			setcastledata( .castle$[.@i], 11, 1 );
			setcastledata( .castle$[.@i], 12, 1 );
			setcastledata( .castle$[.@i], 13, 1 );
			setcastledata( .castle$[.@i], 14, 1 );
			setcastledata( .castle$[.@i], 15, 1 );
			setcastledata( .castle$[.@i], 16, 1 );
			setcastledata( .castle$[.@i], 17, 1 );
//	Method 1: use sleep ... doesn't work
//			sleep 1;
//	Method 2: use requestguildinfo ... obviously doesn't work because its already in map-server memory
//			requestguildinfo getcastledata( .castle$[.@i], 1 );
//			requestguildinfo getcastledata( .castle$[.@i], 1 ), "Guardian#"+ .castle$[.@i] +"::OnSpawnGuardians";
//	Method 3: reset the guild castle ... also doesn't work ??
//			.@gid = getcastledata( .castle$[.@i], 1 );
//			setcastledata( .castle$[.@i], 1, 0 );
//			setcastledata( .castle$[.@i], 1, .@gid );
			donpcevent "Guardian#"+ .castle$[.@i] +"::OnSpawnGuardians";
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	bindatcmd "emp", strnpcinfo(0)+"::OnDebug", 99, 100;
	bindatcmd "gua", strnpcinfo(0)+"::OnGuardianSpawn", 99, 100;
	end;
OnDebug:
	switch ( atoi( .@atcmd_parameters$ ) ) {
	case 0: warp "aldeg_cas01",216,23; end;
	case 1: warp "aldeg_cas02",213,23; end;
	case 2: warp "aldeg_cas03",205,31; end;
	case 3: warp "aldeg_cas04",36,217; end;
	case 4: warp "aldeg_cas05",27,101; end;
	case 5: warp "gefg_cas01",197,181; end;
	case 6: warp "gefg_cas02",176,178; end;
	case 7: warp "gefg_cas03",244,166; end;
	case 8: warp "gefg_cas04",174,177; end;
	case 9: warp "gefg_cas05",194,184; end;
	case 10: warp "payg_cas01",139,139; end;
	case 11: warp "payg_cas02",38,25;   end;
	case 12: warp "payg_cas03",269,265; end;
	case 13: warp "payg_cas04",270,28;  end;
	case 14: warp "payg_cas05",30,30;   end;
	case 15: warp "prtg_cas01",197,197; end;
	case 16: warp "prtg_cas02",157,174; end;
	case 17: warp "prtg_cas03",16,220;  end;
	case 18: warp "prtg_cas04",291,14;  end;
	case 19: warp "prtg_cas05",266,266; end;
	case 20: warp "arug_cas01",87,219; end;
	case 21: warp "arug_cas02",89,256; end;
	case 22: warp "arug_cas03",141,293; end;
	case 23: warp "arug_cas04",141,293; end;
	case 24: warp "arug_cas05",141,293; end;
	case 25: warp "schg_cas01",120,272; end;
	case 26: warp "schg_cas02",162,193; end;
	case 27: warp "schg_cas03",338,202; end;
	case 28: warp "schg_cas04",120,272; end;
	case 29: warp "schg_cas05",120,272; end;
	default:
	}
	end;
}
Spoiler

prontera,155,185,5	script	asdasd	1_F_MARIA,{
	end;
OnGuardianSpawn:
	for ( .@i = 0; .@i < 20; ++.@i ) {
		if ( getcastledata( .castle$[.@i], 1 ) ) {
			if (.castle$[.@i] == "aldeg_cas01") {
				setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
				setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
				setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
			}
			else if (.castle$[.@i] == "aldeg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
				setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
			}
			else if (.castle$[.@i] == "aldeg_cas03") {
				setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
				setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
				setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
			}
			else if (.castle$[.@i] == "aldeg_cas04") {
				setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
				setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
				setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
			}
			else if (.castle$[.@i] == "aldeg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
				setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
				setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
			}
			// Geffen (Britoniah) Castles
			else if (.castle$[.@i] == "gefg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
				setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
			}
			else if (.castle$[.@i] == "gefg_cas02") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
				setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
			}
			else if (.castle$[.@i] == "gefg_cas03") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
				setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
			}
			else if (.castle$[.@i] == "gefg_cas04") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
				setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
			}
			else if (.castle$[.@i] == "gefg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
				setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
			}
			// Payon (Baulder) Castles
			else if (.castle$[.@i] == "payg_cas01") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
				setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
			}
			else if (.castle$[.@i] == "payg_cas02") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
				setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
			}
			else if (.castle$[.@i] == "payg_cas03") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
				setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
			}
			else if (.castle$[.@i] == "payg_cas04") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
				setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
			}
			else if (.castle$[.@i] == "payg_cas05") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
				setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
			}
			// Prontera (Valkyrie Realms) Castles
			else if (.castle$[.@i] == "prtg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
				setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
			}
			else if (.castle$[.@i] == "prtg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
				setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
			}
			else if (.castle$[.@i] == "prtg_cas03") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
				setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
			}
			else if (.castle$[.@i] == "prtg_cas04") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
				setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
			}
			else if (.castle$[.@i] == "prtg_cas05") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
				setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
			}
			for (.@i = 0; .@i <= 7; ++.@i) {
				.@UseGID = .@i + 10;
				if (.@guardiantype[.@i] == 1) { .@type = 1287; }
				else if (.@guardiantype[.@i] == 2) { .@type = 1285; }
				else { .@type = 1286; }
				if (!getcastledata(.castle$[.@i],.@UseGID)) {
					setcastledata( .castle$[.@i], .@UseGID, 1 );
					guardian .castle$[.@i],.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+.castle$[.@i]+"::OnGuardianDied",.@i;
				}
				else
					guardian .castle$[.@i],.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+.castle$[.@i]+"::OnGuardianDied",.@i;
			}
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	bindatcmd "emp", strnpcinfo(0)+"::OnDebug", 99, 100;
	bindatcmd "gua", strnpcinfo(0)+"::OnGuardianSpawn", 99, 100;
	bindatcmd "kil", strnpcinfo(0)+"::Onaaa", 99, 100;
	end;
Onaaa:
	for ( .@i = 0; .@i < 20; ++.@i )
		killmonster .castle$[.@i], "Guardian#"+.castle$[.@i]+"::OnGuardianDied";
	end;
OnDebug:
	switch ( atoi( .@atcmd_parameters$ ) ) {
	case 0: warp "aldeg_cas01",216,23; end;
	case 1: warp "aldeg_cas02",213,23; end;
	case 2: warp "aldeg_cas03",205,31; end;
	case 3: warp "aldeg_cas04",36,217; end;
	case 4: warp "aldeg_cas05",27,101; end;
	case 5: warp "gefg_cas01",197,181; end;
	case 6: warp "gefg_cas02",176,178; end;
	case 7: warp "gefg_cas03",244,166; end;
	case 8: warp "gefg_cas04",174,177; end;
	case 9: warp "gefg_cas05",194,184; end;
	case 10: warp "payg_cas01",139,139; end;
	case 11: warp "payg_cas02",38,25;   end;
	case 12: warp "payg_cas03",269,265; end;
	case 13: warp "payg_cas04",270,28;  end;
	case 14: warp "payg_cas05",30,30;   end;
	case 15: warp "prtg_cas01",197,197; end;
	case 16: warp "prtg_cas02",157,174; end;
	case 17: warp "prtg_cas03",16,220;  end;
	case 18: warp "prtg_cas04",291,14;  end;
	case 19: warp "prtg_cas05",266,266; end;
	case 20: warp "arug_cas01",87,219; end;
	case 21: warp "arug_cas02",89,256; end;
	case 22: warp "arug_cas03",141,293; end;
	case 23: warp "arug_cas04",141,293; end;
	case 24: warp "arug_cas05",141,293; end;
	case 25: warp "schg_cas01",120,272; end;
	case 26: warp "schg_cas02",162,193; end;
	case 27: warp "schg_cas03",338,202; end;
	case 28: warp "schg_cas04",120,272; end;
	case 29: warp "schg_cas05",120,272; end;
	default:
	}
	end;
}

server spam error ...


[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 0 which already has a guardian (castle map aldeg_cas01)
[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 1 which already has a guardian (castle map aldeg_cas02)
[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 2 which already has a guardian (castle map aldeg_cas03)
[Warning]: mob_spawn_guardian: Spawning guardian 1285 on a castle with no guild(castle map aldeg_cas04)
[Warning]: mob_spawn_guardian: Spawning guardian 1285 on a castle with no guild(castle map aldeg_cas05)
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild(castle map gefg_cas01)
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild(castle map gefg_cas02)
[Error]: map_addblock: out-of-bounds coordinates ("gefg_cas02",213,24), map is 200x220
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild
(castle map gefg_cas03)

hmmm ... I think sometimes need to look into this script once again ...

actually I also have no idea how to fix this ...

this map-server<->char-server miss-match was planned to do by Haru
https://github.com/HerculesWS/Hercules/pull/1027#issuecomment-180006223

EDIT: that's my own problem, I loop the castle map name with .@i, and loop the guardian index with .@i again
a fixed script is down below

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
On 2/25/2019 at 4:01 AM, AnnieRuru said:

no.1 . actually you are right, I reproduce your problem ....

  Reveal hidden contents

guardian spawn once, remove once, spawn once ...



prontera,155,185,5	script	asdasd	1_F_MARIA,{
	end;
OnGuardianSpawn:
	for ( .@i = 0; .@i < 20; ++.@i ) {
		if ( getcastledata( .castle$[.@i], 1 ) ) {
			setcastledata( .castle$[.@i], 10, 1 );
			setcastledata( .castle$[.@i], 11, 1 );
			setcastledata( .castle$[.@i], 12, 1 );
			setcastledata( .castle$[.@i], 13, 1 );
			setcastledata( .castle$[.@i], 14, 1 );
			setcastledata( .castle$[.@i], 15, 1 );
			setcastledata( .castle$[.@i], 16, 1 );
			setcastledata( .castle$[.@i], 17, 1 );
//	Method 1: use sleep ... doesn't work
//			sleep 1;
//	Method 2: use requestguildinfo ... obviously doesn't work because its already in map-server memory
//			requestguildinfo getcastledata( .castle$[.@i], 1 );
//			requestguildinfo getcastledata( .castle$[.@i], 1 ), "Guardian#"+ .castle$[.@i] +"::OnSpawnGuardians";
//	Method 3: reset the guild castle ... also doesn't work ??
//			.@gid = getcastledata( .castle$[.@i], 1 );
//			setcastledata( .castle$[.@i], 1, 0 );
//			setcastledata( .castle$[.@i], 1, .@gid );
			donpcevent "Guardian#"+ .castle$[.@i] +"::OnSpawnGuardians";
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	bindatcmd "emp", strnpcinfo(0)+"::OnDebug", 99, 100;
	bindatcmd "gua", strnpcinfo(0)+"::OnGuardianSpawn", 99, 100;
	end;
OnDebug:
	switch ( atoi( .@atcmd_parameters$ ) ) {
	case 0: warp "aldeg_cas01",216,23; end;
	case 1: warp "aldeg_cas02",213,23; end;
	case 2: warp "aldeg_cas03",205,31; end;
	case 3: warp "aldeg_cas04",36,217; end;
	case 4: warp "aldeg_cas05",27,101; end;
	case 5: warp "gefg_cas01",197,181; end;
	case 6: warp "gefg_cas02",176,178; end;
	case 7: warp "gefg_cas03",244,166; end;
	case 8: warp "gefg_cas04",174,177; end;
	case 9: warp "gefg_cas05",194,184; end;
	case 10: warp "payg_cas01",139,139; end;
	case 11: warp "payg_cas02",38,25;   end;
	case 12: warp "payg_cas03",269,265; end;
	case 13: warp "payg_cas04",270,28;  end;
	case 14: warp "payg_cas05",30,30;   end;
	case 15: warp "prtg_cas01",197,197; end;
	case 16: warp "prtg_cas02",157,174; end;
	case 17: warp "prtg_cas03",16,220;  end;
	case 18: warp "prtg_cas04",291,14;  end;
	case 19: warp "prtg_cas05",266,266; end;
	case 20: warp "arug_cas01",87,219; end;
	case 21: warp "arug_cas02",89,256; end;
	case 22: warp "arug_cas03",141,293; end;
	case 23: warp "arug_cas04",141,293; end;
	case 24: warp "arug_cas05",141,293; end;
	case 25: warp "schg_cas01",120,272; end;
	case 26: warp "schg_cas02",162,193; end;
	case 27: warp "schg_cas03",338,202; end;
	case 28: warp "schg_cas04",120,272; end;
	case 29: warp "schg_cas05",120,272; end;
	default:
	}
	end;
}
  Reveal hidden contents


prontera,155,185,5	script	asdasd	1_F_MARIA,{
	end;
OnGuardianSpawn:
	for ( .@i = 0; .@i < 20; ++.@i ) {
		if ( getcastledata( .castle$[.@i], 1 ) ) {
			if (.castle$[.@i] == "aldeg_cas01") {
				setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
				setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
				setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
			}
			else if (.castle$[.@i] == "aldeg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
				setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
			}
			else if (.castle$[.@i] == "aldeg_cas03") {
				setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
				setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
				setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
			}
			else if (.castle$[.@i] == "aldeg_cas04") {
				setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
				setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
				setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
			}
			else if (.castle$[.@i] == "aldeg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
				setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
				setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
			}
			// Geffen (Britoniah) Castles
			else if (.castle$[.@i] == "gefg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
				setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
			}
			else if (.castle$[.@i] == "gefg_cas02") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
				setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
			}
			else if (.castle$[.@i] == "gefg_cas03") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
				setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
			}
			else if (.castle$[.@i] == "gefg_cas04") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
				setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
			}
			else if (.castle$[.@i] == "gefg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
				setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
			}
			// Payon (Baulder) Castles
			else if (.castle$[.@i] == "payg_cas01") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
				setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
			}
			else if (.castle$[.@i] == "payg_cas02") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
				setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
			}
			else if (.castle$[.@i] == "payg_cas03") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
				setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
			}
			else if (.castle$[.@i] == "payg_cas04") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
				setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
			}
			else if (.castle$[.@i] == "payg_cas05") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
				setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
			}
			// Prontera (Valkyrie Realms) Castles
			else if (.castle$[.@i] == "prtg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
				setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
			}
			else if (.castle$[.@i] == "prtg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
				setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
			}
			else if (.castle$[.@i] == "prtg_cas03") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
				setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
			}
			else if (.castle$[.@i] == "prtg_cas04") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
				setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
			}
			else if (.castle$[.@i] == "prtg_cas05") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
				setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
			}
			for (.@i = 0; .@i <= 7; ++.@i) {
				.@UseGID = .@i + 10;
				if (.@guardiantype[.@i] == 1) { .@type = 1287; }
				else if (.@guardiantype[.@i] == 2) { .@type = 1285; }
				else { .@type = 1286; }
				if (!getcastledata(.castle$[.@i],.@UseGID)) {
					setcastledata( .castle$[.@i], .@UseGID, 1 );
					guardian .castle$[.@i],.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+.castle$[.@i]+"::OnGuardianDied",.@i;
				}
				else
					guardian .castle$[.@i],.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+.castle$[.@i]+"::OnGuardianDied",.@i;
			}
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	bindatcmd "emp", strnpcinfo(0)+"::OnDebug", 99, 100;
	bindatcmd "gua", strnpcinfo(0)+"::OnGuardianSpawn", 99, 100;
	bindatcmd "kil", strnpcinfo(0)+"::Onaaa", 99, 100;
	end;
Onaaa:
	for ( .@i = 0; .@i < 20; ++.@i )
		killmonster .castle$[.@i], "Guardian#"+.castle$[.@i]+"::OnGuardianDied";
	end;
OnDebug:
	switch ( atoi( .@atcmd_parameters$ ) ) {
	case 0: warp "aldeg_cas01",216,23; end;
	case 1: warp "aldeg_cas02",213,23; end;
	case 2: warp "aldeg_cas03",205,31; end;
	case 3: warp "aldeg_cas04",36,217; end;
	case 4: warp "aldeg_cas05",27,101; end;
	case 5: warp "gefg_cas01",197,181; end;
	case 6: warp "gefg_cas02",176,178; end;
	case 7: warp "gefg_cas03",244,166; end;
	case 8: warp "gefg_cas04",174,177; end;
	case 9: warp "gefg_cas05",194,184; end;
	case 10: warp "payg_cas01",139,139; end;
	case 11: warp "payg_cas02",38,25;   end;
	case 12: warp "payg_cas03",269,265; end;
	case 13: warp "payg_cas04",270,28;  end;
	case 14: warp "payg_cas05",30,30;   end;
	case 15: warp "prtg_cas01",197,197; end;
	case 16: warp "prtg_cas02",157,174; end;
	case 17: warp "prtg_cas03",16,220;  end;
	case 18: warp "prtg_cas04",291,14;  end;
	case 19: warp "prtg_cas05",266,266; end;
	case 20: warp "arug_cas01",87,219; end;
	case 21: warp "arug_cas02",89,256; end;
	case 22: warp "arug_cas03",141,293; end;
	case 23: warp "arug_cas04",141,293; end;
	case 24: warp "arug_cas05",141,293; end;
	case 25: warp "schg_cas01",120,272; end;
	case 26: warp "schg_cas02",162,193; end;
	case 27: warp "schg_cas03",338,202; end;
	case 28: warp "schg_cas04",120,272; end;
	case 29: warp "schg_cas05",120,272; end;
	default:
	}
	end;
}

server spam error ...



[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 0 which already has a guardian (castle map aldeg_cas01)
[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 1 which already has a guardian (castle map aldeg_cas02)
[Error]: mob_spawn_guardian: Attempted to spawn guardian in position 2 which already has a guardian (castle map aldeg_cas03)
[Warning]: mob_spawn_guardian: Spawning guardian 1285 on a castle with no guild(castle map aldeg_cas04)
[Warning]: mob_spawn_guardian: Spawning guardian 1285 on a castle with no guild(castle map aldeg_cas05)
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild(castle map gefg_cas01)
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild(castle map gefg_cas02)
[Error]: map_addblock: out-of-bounds coordinates ("gefg_cas02",213,24), map is 200x220
[Warning]: mob_spawn_guardian: Spawning guardian 1286 on a castle with no guild
(castle map gefg_cas03)

hmmm ... I think sometimes need to look into this script once again ...

actually I also have no idea how to fix this ...

this map-server<->char-server miss-match was planned to do by Haru
https://github.com/HerculesWS/Hercules/pull/1027#issuecomment-180006223

thanks for 2 and 3 but what am I right about 1??

I thought I make something broken???


and about 3 if I put this part into item script

strnpcinfo(NPC_NAME)+"::Onaaa"

I need change the part strnpcinfo(NPC_NAME to make it work, correct?


 
Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0

no.1
FIXED , I forgotten about the *guardianinfo script command

Spoiler

-	script	asdasd	-1,{
	end;
OnGuardianSpawn:
	for ( .@i = 0; .@i < 20; ++.@i ) {
		if ( getcastledata( .castle$[.@i], 1 ) ) {
			if (.castle$[.@i] == "aldeg_cas01") {
				setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
				setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
				setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
			}
			else if (.castle$[.@i] == "aldeg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
				setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
			}
			else if (.castle$[.@i] == "aldeg_cas03") {
				setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
				setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
				setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
			}
			else if (.castle$[.@i] == "aldeg_cas04") {
				setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
				setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
				setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
			}
			else if (.castle$[.@i] == "aldeg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
				setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
				setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
			}
			// Geffen (Britoniah) Castles
			else if (.castle$[.@i] == "gefg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
				setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
			}
			else if (.castle$[.@i] == "gefg_cas02") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
				setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
			}
			else if (.castle$[.@i] == "gefg_cas03") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
				setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
			}
			else if (.castle$[.@i] == "gefg_cas04") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
				setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
			}
			else if (.castle$[.@i] == "gefg_cas05") {
				setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
				setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
				setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
			}
			// Payon (Baulder) Castles
			else if (.castle$[.@i] == "payg_cas01") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
				setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
			}
			else if (.castle$[.@i] == "payg_cas02") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
				setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
			}
			else if (.castle$[.@i] == "payg_cas03") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
				setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
			}
			else if (.castle$[.@i] == "payg_cas04") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
				setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
			}
			else if (.castle$[.@i] == "payg_cas05") {
				setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
				setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
				setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
			}
			// Prontera (Valkyrie Realms) Castles
			else if (.castle$[.@i] == "prtg_cas01") {
				setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
				setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
				setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
			}
			else if (.castle$[.@i] == "prtg_cas02") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
				setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
			}
			else if (.castle$[.@i] == "prtg_cas03") {
				setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
				setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
				setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
			}
			else if (.castle$[.@i] == "prtg_cas04") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
				setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
			}
			else if (.castle$[.@i] == "prtg_cas05") {
				setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
				setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
				setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
			}
			for (.@j = 0; .@j <= 7; ++.@j) {
				.@UseGID = .@j + 10;
				if (.@guardiantype[.@j] == 1) { .@type = 1287; }
				else if (.@guardiantype[.@j] == 2) { .@type = 1285; }
				else { .@type = 1286; }
				if ( !guardianinfo( .castle$[.@i], .@j, 0 ) ) {
					setcastledata( .castle$[.@i], .@UseGID, 1 );
					guardian .castle$[.@i],.@guardianposx[.@j],.@guardianposy[.@j],strmobinfo(2,.@type),.@type,"Guardian#"+.castle$[.@i]+"::OnGuardianDied",.@j;
				}
			}
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	bindatcmd "emp", strnpcinfo(0)+"::OnDebug", 99, 100;
	bindatcmd "gua", strnpcinfo(0)+"::OnGuardianSpawn", 99, 100;
	bindatcmd "kil", strnpcinfo(0)+"::Onaaa", 99, 100;
	end;
Onaaa:
	for ( .@i = 0; .@i < 20; ++.@i )
		killmonster .castle$[.@i], "Guardian#"+.castle$[.@i]+"::OnGuardianDied";
	end;
OnDebug:
	switch ( atoi( .@atcmd_parameters$ ) ) {
	case 0: warp "aldeg_cas01",216,23; end;
	case 1: warp "aldeg_cas02",213,23; end;
	case 2: warp "aldeg_cas03",205,31; end;
	case 3: warp "aldeg_cas04",36,217; end;
	case 4: warp "aldeg_cas05",27,101; end;
	case 5: warp "gefg_cas01",197,181; end;
	case 6: warp "gefg_cas02",176,178; end;
	case 7: warp "gefg_cas03",244,166; end;
	case 8: warp "gefg_cas04",174,177; end;
	case 9: warp "gefg_cas05",194,184; end;
	case 10: warp "payg_cas01",139,139; end;
	case 11: warp "payg_cas02",38,25;   end;
	case 12: warp "payg_cas03",269,265; end;
	case 13: warp "payg_cas04",270,28;  end;
	case 14: warp "payg_cas05",30,30;   end;
	case 15: warp "prtg_cas01",197,197; end;
	case 16: warp "prtg_cas02",157,174; end;
	case 17: warp "prtg_cas03",16,220;  end;
	case 18: warp "prtg_cas04",291,14;  end;
	case 19: warp "prtg_cas05",266,266; end;
	case 20: warp "arug_cas01",87,219; end;
	case 21: warp "arug_cas02",89,256; end;
	case 22: warp "arug_cas03",141,293; end;
	case 23: warp "arug_cas04",141,293; end;
	case 24: warp "arug_cas05",141,293; end;
	case 25: warp "schg_cas01",120,272; end;
	case 26: warp "schg_cas02",162,193; end;
	case 27: warp "schg_cas03",338,202; end;
	case 28: warp "schg_cas04",120,272; end;
	case 29: warp "schg_cas05",120,272; end;
	default:
	}
	end;
}

 

no.3

function	script	call_from_item	{
	getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
	.@x = 10;
	for ( .@i = 0; .@i < .@x; ++.@i )
		clone .@map$, .@x, .@y, "asdf::Onaaa", getcharid(CHAR_ID_CHAR), getcharid(CHAR_ID_CHAR);
	dispbottom sprintf( _$( "Spawned %d clones" ), .@x );
	end;
}

-	script	asdf	FAKE_NPC,{
Onaaa:
	announce sprintf( _$( "%s's slave clone died."), strcharinfo(PC_NAME) ), bc_all;
	end;
}

yes, have a callfunc from the item, then have another floating npc to trigger the event label

Share this post


Link to post
Share on other sites
  • 0

Question about 1:

Q1. Do I use this npc as duplicate like woe FE did??  like the guild manager or guild starter npc?

Q2. about the bindatcmd it only work if I duplicate them?

 

 

Share this post


Link to post
Share on other sites
  • 0

Q1, no, just insert that part into the script demonstrate on your 1st post

Q2, my bindatcmd is just a debugging command, you can remove it

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.