• 0
Sign in to follow this  
utofaery

H> inserting this script to woe2

Question

-	script	EmperiumGuardian	FAKE_NPC,{
OnAgitStart:// when woe start
	sleep 2;
	for( [email protected] = 0; [email protected] < .size_mob; [email protected]++ ) {
		for( [email protected] = 0; [email protected] < .size_map; [email protected]++ ) {
			if( getcastledata( .map_woe$[[email protected]],1 ) ) {
				for( [email protected] = 0; [email protected] < .mob_count[[email protected]]; [email protected]++ )
					guardian .map_woe$[[email protected]],0,0,"--ja--", .mob_ID[[email protected]];
			}
			else
				monster .map_woe$[[email protected]],0,0,"--ja--", .mob_ID[[email protected]], .mob_count[[email protected]],"";
		}
	}
	end;
OnAgitEnd:// when woe end
	sleep 2;
	for( [email protected] = 0; [email protected] < .size_map; [email protected]++ ) {
		sleep2 1;
		killmonsterall .map_woe$[[email protected]];
	}
	end;
OnNPCKillEvent:
	sleep2 1;
	if( agitcheck() && compare( .mob_id_c$, killedrid +"" ) && compare( .map_woe_c$, strcharinfo(3) ) ) {// check is woe on + if mob in .mob_ID list + map in .map_woe$ list
		if( getcastledata( strcharinfo(3),1 ) )
			guardian strcharinfo(3),0,0,"--ja--", killedrid;
		else
			monster strcharinfo(3),0,0,"--ja--", killedrid,1,"";
	}
	end;

OnInit:
// ------- setting

	setarray .mob_ID, 
		1646, // Lord Knight Seyren
		1647, // Assassin Cross Eremes
		1648, // Whitesmith Harword
		1649, // High Priest Magaleta
		1650, // Sniper Shecil
		1651, // High Wizard Katrinn

		2235, // Paladin Randel
		2236, // Creator Flamel
		2237, // Professor Celia
		2238, // Champion Chen
		2239, // Stalker Gertie
		2240, // Clown Alphoccio
		2241, // Gypsy Trentini

		1002; // xsa // change this !!!

		setarray .mob_count, // number of mobs summoned / .mob_ID array column
				5,
				5,
				5,
				5,
				5,
				5,

				5,
				5,
				5,
				5,
				5,
				5,
				5,

				0; // xsa // change this !!!
		
		setarray .map_woe$, // yours woe map
				"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 of setting
	.size_mob = getarraysize( .mob_ID );
	.size_map = getarraysize( .map_woe$ );
	for( [email protected] = 0; [email protected] < .size_mob; [email protected]++ )
		[email protected]$[[email protected]] = .mob_ID[[email protected]];
	.mob_id_c$ = implode( [email protected]$, "|" );
	.map_woe_c$ = implode( .map_woe$, "|" );
	end;
}












/*


Add in guild/agit_main.txt

killmonsterall strcharinfo(3);
after

// The Emperium has been broken.
OnAgitBreak:
	set [email protected],getcharid(2);
 

and

	donpcevent "EmperiumGuardian::OnAgitStart";
after

announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by the [" + getguildName([email protected]) + "] guild.",bc_all|bc_woe;


*/

this script make for fun and extra guild guardian but I need help plug this script in woe2 guild war files

 

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

erm .............................................................................................
...............................................Official WoE is like this
https://irowiki.org/wiki/War_of_Emperium
https://irowiki.org/wiki/War_of_Emperium_2
https://irowiki.org/wiki/War_of_Emperium_Training_Edition

ok, so you just want to make for fun
https://annieruru.blogspot.com/2019/01/how-to-create-your-own-woe-castle-map.html

-	script	EmperiumGuardian	FAKE_NPC,{
OnInit:
	setarray .mob,
		1646,5, // Lord Knight Seyren
		1647,5, // Assassin Cross Eremes
		1648,5, // Whitesmith Harword
		1649,5, // High Priest Magaleta
		1650,5, // Sniper Shecil
		1651,5, // High Wizard Katrinn
		        
		2235,5, // Paladin Randel
		2236,5, // Creator Flamel
		2237,5, // Professor Celia
		2238,5, // Champion Chen
		2239,5, // Stalker Gertie
		2240,5, // Clown Alphoccio
		2241,5; // Gypsy Trentini
	.mobsize = getarraysize(.mob);

	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;
OnAgitStart:  callsub OnAgitStartFunction, 0, 20;
OnAgitStart2: callsub OnAgitStartFunction, 20, 30;
OnAgitStartFunction:
	[email protected]_index = getarg(0);
	[email protected]_index = getarg(1);
	for ( [email protected] = [email protected]_index; [email protected] < [email protected]_index; [email protected] ) {
		if ( getcastledata( .castle$[[email protected]], CD_GUILD_ID ) ) {
			for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
				for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
					guardian .castle$[[email protected]], 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
		}
		else {
			for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 ) 
				monster .castle$[[email protected]], 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
		}
	}
	end;
OnAgitEnd:  callsub OnAgitEndFunction, 0, 20;
OnAgitEnd2: callsub OnAgitEndFunction, 20, 30;
OnAgitEndFunction:
	[email protected]_index = getarg(0);
	[email protected]_index = getarg(1);
	for ( [email protected] = [email protected]_index; [email protected] < [email protected]_index; [email protected] )
		killmonster .castle$[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
	end;
OnGuardianDead:
	if ( getcastledata( strcharinfo(3), CD_GUILD_ID ) )
		guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
	else
		monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
	end;
//OnAgitBreakEvent:
	// donpcevent can't include getarg, like a function ....
}

there is still something missing here, when the emperium breaks, all these monster has to replace with guardians
which you have to edit on the npc/guild/agit_main.txt and npc/guild2/agit_main_se.txt directly
http://herc.ws/board/topic/4848-woe-castle-auto-assign-on-guild/?do=findComment&amp;comment=31251

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, AnnieRuru said:

 

-	script	EmperiumGuardian	FAKE_NPC,{
OnInit:
	setarray .mob,
		1646,5, // Lord Knight Seyren
		1647,5, // Assassin Cross Eremes
		1648,5, // Whitesmith Harword
		1649,5, // High Priest Magaleta
		1650,5, // Sniper Shecil
		1651,5, // High Wizard Katrinn
		        
		2235,5, // Paladin Randel
		2236,5, // Creator Flamel
		2237,5, // Professor Celia
		2238,5, // Champion Chen
		2239,5, // Stalker Gertie
		2240,5, // Clown Alphoccio
		2241,5; // Gypsy Trentini
	.mobsize = getarraysize(.mob);

	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;
OnAgitStart:  callsub OnAgitStartFunction, 0, 20;
OnAgitStart2: callsub OnAgitStartFunction, 20, 30;
OnAgitStartFunction:
	[email protected]_index = getarg(0);
	[email protected]_index = getarg(1);
	for ( [email protected] = [email protected]_index; [email protected] < [email protected]_index; [email protected] ) {
		if ( getcastledata( .castle$[[email protected]], CD_GUILD_ID ) ) {
			for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
				for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
					guardian .castle$[[email protected]], 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
		}
		else {
			for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 ) 
				monster .castle$[[email protected]], 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
		}
	}
	end;
OnAgitEnd:  callsub OnAgitEndFunction, 0, 20;
OnAgitEnd2: callsub OnAgitEndFunction, 20, 30;
OnAgitEndFunction:
	[email protected]_index = getarg(0);
	[email protected]_index = getarg(1);
	for ( [email protected] = [email protected]_index; [email protected] < [email protected]_index; [email protected] )
		killmonster .castle$[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
	end;
OnGuardianDead:
	if ( getcastledata( strcharinfo(3), CD_GUILD_ID ) )
		guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
	else
		monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
	end;
//OnAgitBreakEvent:
	// donpcevent can't include getarg, like a function ....
}

there is still something missing here, when the emperium breaks, all these monster has to replace with guardians

1.
Do I just use the script as it is and when emperium gets spawned those array monster will spawn to help protect the emperium?

2.
This script was not a replacement for those lame guardian...(guardian no mobs as support so easy die)
It is mean to increase defense strength of defender so more hard for any one to invade ...
so that people would actually need to form party and not solo till the emperium room to break emp...

3. 

Could I make a request?>

On testing script

I found out that on WOE:SE half of the monster actually spawn outside of WOE'ing area (guild member convenience area),

and I am not good with the part of 

[email protected] += 2

thing 

so could you make changes to the script so the monster is actually spawn'ed by those stone guardian like those guardian but without the defense investment level spawning stuff??

WOE:SE script is a huge maze for me..

 

 

Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0

1. no, like I said, something is missing from my script, you still have to add more lines on the official script to make it spawn whenever someone break the emperium

2. I think its better to write a custom woe script to demonstrate, because the official woe are quite complex

https://annieruru.blogspot.com/2019/01/how-to-create-your-own-woe-castle-map.html

/* db\castle_db.txt
99,guild_vs2,guild_vs2 Test Castle,test flag,1
*/
guild_vs2,52,52,4	script	test flag	GUILD_FLAG,{
	dispbottom "=========================";
	[email protected] = getcastledata("guild_vs2", CD_GUILD_ID);
	dispbottom "owner of the castle : "+( ( [email protected] )? "["+ getguildname([email protected]) +"]" : "<none>" );
	dispbottom "agit check : "+( ( agitcheck() )?"on":"off" );
	dispbottom "gvg_castle mapflag : "+( ( getmapflag( strcharinfo(3), mf_gvg_castle )?"on":"off" ) );
	dispbottom "=========================";
	end;
OnInit:
	if ( agitcheck() == false && !getcastledata("guild_vs2", CD_GUILD_ID) || agitcheck() == true )
		donpcevent strnpcinfo(0)+"::OnAgitStart";
	setmapflag "guild_vs2", mf_gvg_castle;
	flagemblem getcastledata("guild_vs2", CD_GUILD_ID);

	setarray .mob,
	//	1646,1, // Lord Knight Seyren
	//	1647,1, // Assassin Cross Eremes
	//	1648,1, // Whitesmith Harword
	//	1649,1, // High Priest Magaleta
	//	1650,1, // Sniper Shecil
	//	1651,1, // High Wizard Katrinn
	//	        
	//	2235,1, // Paladin Randel
	//	2236,1, // Creator Flamel
	//	2237,1, // Professor Celia
	//	2238,1, // Champion Chen
		2239,1, // Stalker Gertie
		2240,1, // Clown Alphoccio
		2241,1; // Gypsy Trentini
	.mobsize = getarraysize(.mob);
	end;
OnEmpBreak:
	announce "The Emperium has fallen", bc_map|bc_woe;
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
	setcastledata "guild_vs2", 1, getcharid(2);
	donpcevent "::OnRecvCastle123";
	maprespawnguildid "guild_vs2", getcharid(2), 2;
	sleep 7000;
	if ( agitcheck() == false ) end;
OnAgitStart:
	monster "guild_vs2",49,49,"EMPERIUM",1288,1,strnpcinfo(0)+"::OnEmpBreak";
	setunitdata [email protected], UMOB_HP, 5;
	if ( getcastledata("guild_vs2", CD_GUILD_ID) ) {
		for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
			for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
				guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
	}
	else {
		for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
			monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
	}
	end;
OnAgitEnd:
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnEmpBreak";
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
	end;
OnGuardianDead:
	if ( getcastledata( strcharinfo(3), CD_GUILD_ID ) )
		guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
	else
		monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
	end;
OnAgitInit:
	requestguildinfo getcastledata("guild_vs2", CD_GUILD_ID);
OnRecvCastle123:
	flagemblem getcastledata("guild_vs2", CD_GUILD_ID);
	end;
OnGuildBreak:
	setcastledata "guild_vs2", 1, 0;
	donpcevent "::OnRecvCastle123";
	end;
}

this is the full script that should do what you want

AFTER you learn how to write your own castle, then apply this method into official script, OK ?

 

EDIT: I just saw no.3

5 hours ago, utofaery said:

I found out that on WOE:SE half of the monster actually spawn outside of WOE'ing area (guild member convenience area),

these are just coordinate, just change them from the *monster/*guardian script command

 

5 hours ago, utofaery said:

and I am not good with the part of 

[email protected] += 2

[email protected]++ is set [email protected], [email protected] +1;
[email protected] += 2 is equal to set [email protected], [email protected] +2;

 

5 hours ago, utofaery said:

so could you make changes to the script so the monster is actually spawn'ed by those stone guardian like those guardian but without the defense investment level spawning stuff?? 

yes, 100% done in scripting

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

Script 1:  Running fine on rathena

Spoiler

/* db\castle_db.txt
99,guild_vs2,guild_vs2 Test Castle,test flag,1
*/
guild_vs2,52,52,4    script    test flag    GUILD_FLAG,{
    dispbottom "=========================";
    [email protected] = getcastledata("guild_vs2", CD_GUILD_ID);
    dispbottom "owner of the castle : "+( ( [email protected] )? "["+ getguildname([email protected]) +"]" : "<none>" );
    dispbottom "agit check : "+( ( agitcheck() )?"on":"off" );
    dispbottom "gvg_castle mapflag : "+( ( getmapflag( strcharinfo(3), mf_gvg_castle )?"on":"off" ) );
    dispbottom "=========================";
    end;
OnInit:
    if ( agitcheck() == false && !getcastledata("guild_vs2", CD_GUILD_ID) || agitcheck() == true )
        donpcevent strnpcinfo(0)+"::OnAgitStart";
    setmapflag "guild_vs2", mf_gvg_castle;
    flagemblem getcastledata("guild_vs2", CD_GUILD_ID);
    setarray .mob,
        1646,3, // Lord Knight Seyren
        1647,3, // Assassin Cross Eremes
        1648,3, // Whitesmith Harword
        1649,3, // High Priest Magaleta
        1650,3, // Sniper Shecil
        1651,3, // High Wizard Katrinn
        2235,3, // Paladin Randel
        2236,3, // Creator Flamel
        2237,3, // Professor Celia
        2238,3, // Champion Chen
        2239,3, // Stalker Gertie
        2240,3, // Clown Alphoccio
        2241,3; // Gypsy Trentini
    .mobsize = getarraysize(.mob);
    end;
OnEmpBreak:
    announce "The Emperium has fallen", bc_map|bc_woe;
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    setcastledata "guild_vs2", 1, getcharid(2);
    donpcevent "::OnRecvCastle123";
    maprespawnguildid "guild_vs2", getcharid(2), 2;
    sleep 7000;
    if ( agitcheck() == false ) end;
    end; // xsa missing end???
OnAgitStart:
    [email protected] = monster ("guild_vs2",49,49,"EMPERIUM",1288,1,strnpcinfo(0)+"::OnEmpBreak");
    setunitdata [email protected], UMOB_HP, 5;

    if ( getcastledata("guild_vs2", CD_GUILD_ID) ) {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
                guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
    }
    else {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
    }
    end;
OnAgitEnd:
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnEmpBreak";
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    end;
OnGuardianDead:
    if ( getcastledata( strcharinfo(3), CD_GUILD_ID ) )
        guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
    else
        monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
    end;
OnAgitInit:
    requestguildinfo getcastledata("guild_vs2", CD_GUILD_ID);
    end; // xsa missing end???
OnRecvCastle123:
    flagemblem getcastledata("guild_vs2", CD_GUILD_ID);
    end;
OnGuildBreak:
    setcastledata "guild_vs2", 1, 0;
    donpcevent "::OnRecvCastle123";
    end;
}
 

 

Script 2 running on Hercules has infinite loop, Why?

Spoiler

/* db\castle_db.txt
99,guild_vs2,guild_vs2 Test Castle,test flag,1
*/
guild_vs2,52,52,4    script    test flag    GUILD_FLAG,{
    dispbottom "=========================";
    [email protected] = getcastledata("guild_vs2", 1); //CD_GUILD_ID == rathena ,  1 == hercules
    dispbottom "owner of the castle : "+( ( [email protected] )? "["+ getguildname([email protected]) +"]" : "<none>" );
    dispbottom "agit check : "+( ( agitcheck() )?"on":"off" );
    dispbottom "gvg_castle mapflag : "+( ( getmapflag( strcharinfo(3), mf_gvg_castle )?"on":"off" ) );
    dispbottom "=========================";
    end;
OnInit:
    if ( agitcheck() == false && !getcastledata("guild_vs2", 1) || agitcheck() == true )
        donpcevent strnpcinfo(0)+"::OnAgitStart";
    setmapflag "guild_vs2", mf_gvg_castle;
    flagemblem getcastledata("guild_vs2", 1);

    setarray .mob,
        1646,3, // Lord Knight Seyren
        1647,3, // Assassin Cross Eremes
        1648,3, // Whitesmith Harword
        1649,3, // High Priest Magaleta
        1650,3, // Sniper Shecil
        1651,3, // High Wizard Katrinn

        2235,3, // Paladin Randel
        2236,3, // Creator Flamel
        2237,3, // Professor Celia
        2238,3, // Champion Chen
        2239,3, // Stalker Gertie
        2240,3, // Clown Alphoccio
        2241,3; // Gypsy Trentini
    .mobsize = getarraysize(.mob);
    end;
OnEmpBreak:
    announce "The Emperium has fallen", bc_map|bc_woe;
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    setcastledata "guild_vs2", 1, getcharid(2);
    donpcevent "::OnRecvCastle123";
    maprespawnguildid "guild_vs2", getcharid(2), 2;
    sleep 7000;
    if ( agitcheck() == false ) end;
    end; // xsa missing end???
OnAgitStart:

    [email protected] = monster("guild_vs2",49,49,"EMPERIUM",1288,1,strnpcinfo(NPC_NAME)+"::OnEmpBreak");
    setunitdata [email protected], UDT_HP, 5;
    setunitdata [email protected], UDT_MAXHP, 5;

    if ( getcastledata("guild_vs2", 1) ) {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
                guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
    }
    else {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
    }
    end;
OnAgitEnd:
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnEmpBreak";
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    end;
OnGuardianDead:
    if ( getcastledata( strcharinfo(3), 1 ) )
        guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
    else
        monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
    end;
OnAgitInit:
    requestguildinfo getcastledata("guild_vs2", 1);
    end; // xsa missing end???
OnRecvCastle123:
    flagemblem getcastledata("guild_vs2", 1);
    end;
OnGuildBreak:
    setcastledata "guild_vs2", 1, 0;
    donpcevent "::OnRecvCastle123";
    end;
}

This could be the part that trigger that infinite loop but why?

some other script I try the for loop within for loop also causing infinite loop...

Spoiler

    if ( getcastledata("guild_vs2", 1) ) {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
                guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
    }
    else {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
    }

 

Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0
OnAgitInit:
    requestguildinfo getcastledata("guild_vs2", CD_GUILD_ID);
    end; // xsa missing end???
OnRecvCastle123:
    flagemblem getcastledata("guild_vs2", CD_GUILD_ID);
    end;

no, its not missing end, its call fall through
if you do like this, the flag emblem will not load when the server startup

the same with the label OnEmpBreak:
the way you do it, the emperium wont respawn whenever someone break the emperium

 

/* db\castle_db.txt
99,guild_vs2,guild_vs2 Test Castle,test flag,1
*/
guild_vs2,52,52,4	script	test flag	GUILD_FLAG,{
	dispbottom "=========================";
	.@gid = getcastledata("guild_vs2", 1); //CD_GUILD_ID == rathena ,  1 == hercules
	dispbottom "owner of the castle : "+( ( .@gid )? "["+ getguildname(.@gid) +"]" : "<none>" );
	dispbottom "agit check : "+( ( agitcheck() )?"on":"off" );
	dispbottom "gvg_castle mapflag : "+( ( getmapflag( strcharinfo(3), mf_gvg_castle )?"on":"off" ) );
	dispbottom "=========================";
	end;
OnInit:
	if ( agitcheck() == false && !getcastledata("guild_vs2", 1) || agitcheck() == true )
		donpcevent strnpcinfo(0)+"::OnAgitStart";
	setmapflag "guild_vs2", mf_gvg_castle;
	flagemblem getcastledata("guild_vs2", 1);

	setarray .mob,	
		1646,3, // Lord Knight Seyren
		1647,3, // Assassin Cross Eremes
		1648,3, // Whitesmith Harword
		1649,3, // High Priest Magaleta
		1650,3, // Sniper Shecil
		1651,3, // High Wizard Katrinn

		2235,3, // Paladin Randel
		2236,3, // Creator Flamel
		2237,3, // Professor Celia
		2238,3, // Champion Chen
		2239,3, // Stalker Gertie
		2240,3, // Clown Alphoccio
		2241,3; // Gypsy Trentini
	.mobsize = getarraysize(.mob);
	end;
OnEmpBreak:
	announce "The Emperium has fallen", bc_map|bc_woe;
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
	setcastledata "guild_vs2", 1, getcharid(2);
	donpcevent "::OnRecvCastle123";
	maprespawnguildid "guild_vs2", getcharid(2), 2;
	sleep 7000;
	if ( agitcheck() == false ) end;
OnAgitStart:
	.@mobid = monster("guild_vs2",49,49,"EMPERIUM",1288,1,strnpcinfo(NPC_NAME)+"::OnEmpBreak");
	setunitdata .@mobid, UDT_HP, 5;
	setunitdata .@mobid, UDT_MAXHP, 5;
	if ( getcastledata("guild_vs2", 1) ) {
		for ( .@i = 0; .@i < .mobsize; .@i += 2 )
			for ( .@j = 0; .@j < .mob[.@i +1]; ++.@j )
				guardian "guild_vs2", 0, 0, "--ja--", .mob[.@i], strnpcinfo(0)+"::OnGuardianDead";
	}
	else {
		for ( .@i = 0; .@i < .mobsize; .@i += 2 )
			monster "guild_vs2", 0,0, "--ja--", .mob[.@i], .mob[.@i +1], strnpcinfo(0)+"::OnGuardianDead";
	}
	end;
OnAgitEnd:
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnEmpBreak";
	killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
	end;
OnGuardianDead:
	if ( getcastledata( strcharinfo(3), 1 ) )
		guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
	else
		monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
	end;
OnAgitInit:
	requestguildinfo getcastledata("guild_vs2", 1);
OnRecvCastle123:
	flagemblem getcastledata("guild_vs2", 1);
	end;
OnGuildBreak:
	setcastledata "guild_vs2", 1, 0;
	donpcevent "::OnRecvCastle123";
	end;
}

where is the infinite loop ? I only see lots of MVP in the map ... map-server.exe all green
screen2019Hercules009.jpg

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
5 hours ago, AnnieRuru said:

no, its not missing end, its call fall through
if you do like this, the flag emblem will not load when the server startup

the same with the label OnEmpBreak:
the way you do it, the emperium wont respawn whenever someone break the emperium

 

where is the infinite loop ? I only see lots of MVP in the map ... map-server.exe all green
 

1. Thanks for the clarification of the "end;"

2. I meant script1 is working correctly on rathena. no loop anything except me kepo kacau put in the end;

3.  The loop occur however in script 2 when used on hercules.  I wonder why if you do something like 

Spoiler

        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 ) // <<< Loop 1
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] ) // <<< Loop 2

double loop in hercules if the loop 2 need to loop through may be value bigger than 10 or more then it auto infinite loop ( tested multiple times with different script)

This is what I mean if this script run in hercules map server spit infinite loop

9 hours ago, utofaery said:

Script 2 running on Hercules has infinite loop, Why?

  Reveal hidden contents

/* db\castle_db.txt
99,guild_vs2,guild_vs2 Test Castle,test flag,1
*/
guild_vs2,52,52,4    script    test flag    GUILD_FLAG,{
    dispbottom "=========================";
    [email protected] = getcastledata("guild_vs2", 1); //CD_GUILD_ID == rathena ,  1 == hercules
    dispbottom "owner of the castle : "+( ( [email protected] )? "["+ getguildname([email protected]) +"]" : "<none>" );
    dispbottom "agit check : "+( ( agitcheck() )?"on":"off" );
    dispbottom "gvg_castle mapflag : "+( ( getmapflag( strcharinfo(3), mf_gvg_castle )?"on":"off" ) );
    dispbottom "=========================";
    end;
OnInit:
    if ( agitcheck() == false && !getcastledata("guild_vs2", 1) || agitcheck() == true )
        donpcevent strnpcinfo(0)+"::OnAgitStart";
    setmapflag "guild_vs2", mf_gvg_castle;
    flagemblem getcastledata("guild_vs2", 1);

    setarray .mob,
        1646,3, // Lord Knight Seyren
        1647,3, // Assassin Cross Eremes
        1648,3, // Whitesmith Harword
        1649,3, // High Priest Magaleta
        1650,3, // Sniper Shecil
        1651,3, // High Wizard Katrinn

        2235,3, // Paladin Randel
        2236,3, // Creator Flamel
        2237,3, // Professor Celia
        2238,3, // Champion Chen
        2239,3, // Stalker Gertie
        2240,3, // Clown Alphoccio
        2241,3; // Gypsy Trentini
    .mobsize = getarraysize(.mob);
    end;
OnEmpBreak:
    announce "The Emperium has fallen", bc_map|bc_woe;
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    setcastledata "guild_vs2", 1, getcharid(2);
    donpcevent "::OnRecvCastle123";
    maprespawnguildid "guild_vs2", getcharid(2), 2;
    sleep 7000;
    if ( agitcheck() == false ) end;
    end; // xsa missing end???
OnAgitStart:

    [email protected] = monster("guild_vs2",49,49,"EMPERIUM",1288,1,strnpcinfo(NPC_NAME)+"::OnEmpBreak");
    setunitdata [email protected], UDT_HP, 5;
    setunitdata [email protected], UDT_MAXHP, 5;

    if ( getcastledata("guild_vs2", 1) ) {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
                guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
    }
    else {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
    }
    end;
OnAgitEnd:
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnEmpBreak";
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnGuardianDead";
    end;
OnGuardianDead:
    if ( getcastledata( strcharinfo(3), 1 ) )
        guardian strcharinfo(3), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnGuardianDead";
    else
        monster strcharinfo(3), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnGuardianDead";
    end;
OnAgitInit:
    requestguildinfo getcastledata("guild_vs2", 1);
    end; // xsa missing end???
OnRecvCastle123:
    flagemblem getcastledata("guild_vs2", 1);
    end;
OnGuildBreak:
    setcastledata "guild_vs2", 1, 0;
    donpcevent "::OnRecvCastle123";
    end;
}

This could be the part that trigger that infinite loop but why?

some other script I try the for loop within for loop also causing infinite loop...

  Reveal hidden contents

    if ( getcastledata("guild_vs2", 1) ) {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            for ( [email protected] = 0; [email protected] < .mob[[email protected] +1]; [email protected] )
                guardian "guild_vs2", 0, 0, "--ja--", .mob[[email protected]], strnpcinfo(0)+"::OnGuardianDead";
    }
    else {
        for ( [email protected] = 0; [email protected] < .mobsize; [email protected] += 2 )
            monster "guild_vs2", 0,0, "--ja--", .mob[[email protected]], .mob[[email protected] +1], strnpcinfo(0)+"::OnGuardianDead";
    }

 

 

Share this post


Link to post
Share on other sites
  • 0

the screenshot was tested on hercules

	setunitdata .@mobid, UDT_HP, 5;
	setunitdata .@mobid, UDT_MAXHP, 5;

UDT_ is hercules constant

Share this post


Link to post
Share on other sites
  • 0
29 minutes ago, AnnieRuru said:

the screenshot was tested on hercules

	setunitdata .@mobid, UDT_HP, 5;
	setunitdata .@mobid, UDT_MAXHP, 5;

UDT_ is hercules constant

I understand it work the thing I not understand is why it throw infinite loop in map server.

 

Process of infinite loop happened?!

Start serv.bat then 

gm use @agitstart  << in map server did this

Map server throw error::


[Status]: NPC_Event:[OnAgitStart] Run (24) Events by @AgitStart.
[Info]: HCP: War of Emperium has been initiated.
[Info]: HCP: '@agitstart' was used
[Error]: run_script: infinity loop !

Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0
[Status]: Map Server is now online.
[Info]: Received Fame List of '0' characters.
[Status]: Received '35' guild castles from char-server.
[Info]: 'AnnieRuru' logged in. (AID/CID: '2000000/150000', IP: '127.0.0.1', Group '99').
[Status]: Done reading '15' zones in 'db/re/map_zone_db.conf'.
[Info]: Done loading '1009' NPCs:
        -'0' Warps
        -'0' Shops
        -'1009' Scripts
        -'0' Spawn sets
        -'0' Mobs Cached
        -'0' Mobs Not Cached
[Status]: Event 'OnInit' executed with '70' NPCs.
[Status]: Event 'OnInterIfInit' executed with '0' NPCs.
[Status]: Event 'OnInterIfInitOnce' executed with '0' NPCs.
[Status]: NPC_Event:[OnAgitStart] Run (22) Events by @AgitStart.
[Status]: NPC_Event:[OnAgitEnd] Run (22) Events by @AgitEnd.
[Status]: NPC_Event:[OnAgitStart] Run (22) Events by @AgitStart.

db/re/map_zone_db.conf is hercules only

you have (24) ... you have 2 more OnAgitStart, I can understand 1 is from previous script, but you have 1 more extra
try find that one out

 

[Info]: HCP: War of Emperium has been initiated.

hmm ... from smokey's or dastgir's hercules battleground ?
don't think so, what does battleground has to do with woe LOL
it come from something else

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
9 hours ago, AnnieRuru said:

db/re/map_zone_db.conf is hercules only

you have (24) ... you have 2 more OnAgitStart, I can understand 1 is from previous script, but you have 1 more extra
try find that one out


gm use @agitstart
[Status]: NPC_Event:[OnAgitStart] Run (23) Events by @AgitStart.
[Info]: HCP: War of Emperium has been initiated.
[Info]: HCP: '@agitstart' was used
 

Resolved.

But after trial, 

killedrid is no changed at all and stuck at 1002??...

clicking on this TesterClone#TC02 then killing all the poring drops etc...

then the whole map end up with lots of poring nothing else...

is there any other way to get what monster died??

Spoiler

-    script    Tester    4_M_PAY_SOLDIER,{
OnCase1Test:

    deletearray( [email protected]_woe$ );
    deletearray( [email protected] );

    [email protected] = 46;
    [email protected] = 46;
    setarray [email protected]_woe$, // yours woe map

//        "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";
        "guild_vs2";

    setarray [email protected][0],

//        1646, 5, // Lord Knight Seyren
//        1647, 5, // Assassin Cross Eremes
//        1648, 5, // Whitesmith Harword
//        1649, 5, // High Priest Magaleta
//        1650, 5, // Sniper Shecil
//        1651, 5, // High Wizard Katrinn

//        2235, 5, // Paladin Randel
//        2236, 5, // Creator Flamel
//        2237, 5, // Professor Celia
//        2238, 5, // Champion Chen
//        2239, 5, // Stalker Gertie
//        2240, 5, // Clown Alphoccio

//        2241, 5; // Gypsy Trentini

        1031, 3, //Poporing
        1062, 3, //Santa Poring
        1090, 3, //Mastering
//        1096, 3, //Angeling
        1113, 3, //Drops
//        1120, 3, //Ghostring
        1242, 3, //Marin
        1388, 3, //Arc Angeling
//        1582, 3, //Deviling
        1613, 3, //Metaling
        1784, 3, //Stapo
        2093, 3, //Botaring
        1002, 3; //Poring

    for ( [email protected] = 0 ; [email protected] < getarraysize([email protected]_woe$) ; [email protected] ) {
        if ( getcastledata([email protected]_woe$[[email protected]], 1) ) {
            for ( [email protected] = 0 ; [email protected] < getarraysize([email protected]) ; [email protected] += 2 ) {
                for ( [email protected] = 0; [email protected] < [email protected][[email protected] +1]; [email protected]
                    guardian [email protected]_woe$[[email protected]], [email protected], [email protected], "--ja--", [email protected][[email protected]], "Tester::OnCase1Dead";
            }
        } else {
            for ( [email protected] = 0 ; [email protected] < getarraysize([email protected]) ; [email protected] += 2 ) {
                    monster [email protected]_woe$[[email protected]], [email protected], [email protected], "--ja--", [email protected][[email protected]], [email protected][[email protected] + 1 ], "Tester::OnCase1Dead";
            }
        }
    }

    end;

OnCase1Dead:
    sleep2 10;
    announce "killedrid :: " + killedrid,bc_all|bc_woe; //<< doesn't UPDATE at all?? and I end up with tons of Poring....in that map

    if ( getcastledata( strcharinfo(PC_MAP), 1 ) ) {
        guardian strcharinfo(PC_MAP), 0,0,"--ja--", killedrid, strnpcinfo(0)+"::OnCase1Dead";
    } else {
        monster strcharinfo(PC_MAP), 0,0, "--ja--", killedrid, 1, strnpcinfo(0)+"::OnCase1Dead";
    }
    end;

}

prontera,154,174,5    duplicate(Tester)    TesterClone#TC01    4_M_PAY_SOLDIER
guild_vs2,46,46,5    duplicate(Tester)    TesterClone#TC02    4_F_01

guild_vs2,53,46,5    script    TesterClone#TC03    4_F_01,{
    atcommand "@reloadscript";
    end;
}

 

Something Interesting I found,

While Killedrid is really nifty, but when player killed multiple monster in the same milisecond

if killed monster consist of poporing drops poring etc, 

and they all die in the same frame ( same milisecond)

announce "killedrid :: " + killedrid,bc_all|bc_woe;  <<<  announce killedrid is the same if poporing was first registered as killedrid

then the whole row of announce become poporing but no drops poring etc, 

so is there any other way to avoid this?

Spoiler


-    script    EmperiumGuardian    FAKE_NPC,{
onTestStart:// when woe start
    sleep 2;
    for( [email protected] = 0; [email protected] < .size_mob; [email protected]++ ) {
        for( [email protected] = 0; [email protected] < .size_map; [email protected]++ ) {
            if( getcastledata( .map_woe$[[email protected]],1 ) ) {
                for( [email protected] = 0; [email protected] < .mob_count[[email protected]]; [email protected]++ )
                    guardian .map_woe$[[email protected]],0,0,"--ja--", .mob_ID[[email protected]];
            }
            else
                monster .map_woe$[[email protected]],0,0,"--ja--", .mob_ID[[email protected]], .mob_count[[email protected]],"";
        }
    }
    end;
onTestEnd:// when woe end
    sleep 2;
    for( [email protected] = 0; [email protected] < .size_map; [email protected]++ ) {
        sleep2 1;
        killmonsterall .map_woe$[[email protected]];
    }
    end;
OnNPCKillEvent:
    sleep2 1;
    if( agitcheck() && compare( .mob_id_c$, killedrid +"" ) && compare( .map_woe_c$, strcharinfo(3) ) ) {// check is woe on + if mob in .mob_ID list + map in .map_woe$ list
        if( getcastledata( strcharinfo(3),1 ) ) {
            announce "killedrid :: " + killedrid,bc_all|bc_woe;
            guardian strcharinfo(3),0,0,"--ja--", killedrid;
        } else {
            announce "killedrid :: " + killedrid,bc_all|bc_woe;
            monster strcharinfo(3),0,0,"--ja--", killedrid,1,"";
        }
    }
    end;

OnInit:
// ------- setting

    setarray .mob_ID, 
//        1646, // Lord Knight Seyren
//        1647, // Assassin Cross Eremes
//        1648, // Whitesmith Harword
//        1649, // High Priest Magaleta
//        1650, // Sniper Shecil
//        1651, // High Wizard Katrinn

//        2235, // Paladin Randel
//        2236, // Creator Flamel
//        2237, // Professor Celia
//        2238, // Champion Chen
//        2239, // Stalker Gertie
//        2240, // Clown Alphoccio
//        2241, // Gypsy Trentini

        1031, //Poporing
        1062, //Santa Poring
        1090, //Mastering
//        1096, //Angeling
        1113, //Drops
//        1120, //Ghostring
        1242, //Marin
        1388, //Arc Angeling
//        1582, //Deviling
        1613, //Metaling
        1784, //Stapo
        2093, //Botaring
        1002, //Poring

        1002; // xsa // change this !!!

        setarray .mob_count, // number of mobs summoned / .mob_ID array column
                5, 5, 5, 5, 5, 5,

                5, 5, 5, 5, 5, 5, 5,

                0; // xsa // change this !!!
        
        setarray .map_woe$, // yours woe map
/*
            "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";
*/
        "guild_vs2";

//-------- end of setting
    .size_mob = getarraysize( .mob_ID );
    .size_map = getarraysize( .map_woe$ );
    for( [email protected] = 0; [email protected] < .size_mob; [email protected]++ )
        [email protected]$[[email protected]] = .mob_ID[[email protected]];
    .mob_id_c$ = implode( [email protected]$, "|" );
    .map_woe_c$ = implode( .map_woe$, "|" );
    end;
}
 

 

Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0

oh yeah, forgot hercules haven't apply this fix yet
https://github.com/HerculesWS/Hercules/pull/2061

just add 2 lines in your mob.c should fix that
https://github.com/rathena/rathena/commit/2e668ea25a1c2e6005815cb5f8dedba0c31dd2a0

well... currently hercules has a reputation that PR takes long time to merge ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this