Jump to content
  • 0

Help Learning Instance and how it works. <3


Atomik

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  10/23/17
  • Last Seen:  

Hello there, 

Can any one help me with a Simple instance script so i can read it and learn how instance works .

1) A npc that teleport you to an instance.
2) few monsters in that instance
3) Npcs inside the instance that destroys Instance once done. 

Please help <#.

---Atomik.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

ok let me rephrase that sentence ...
in rathena .......

34,Instance ONE,3600,15,guild_vs1,49,49
35,Instance TWO,3600,15,guild_vs2,49,49
prontera,150,180,0	script	Check Instance	1_F_MARIA,{
OnClick:
	dispbottom strcharinfo(3); 
	dispbottom instance_id() +""; // this line sux ... if you only have 1 instance attached then its ok, but if more than one ...
	end;
OnInit:
	bindatcmd "test", strnpcinfo(0)+"::OnClick";
	end;
}

prontera,155,180,0	script	Instance ONE	1_F_MARIA,{
	if ( getstrlen( instance_mapname("guild_vs1") ) ) {
		instance_enter "Instance ONE";
		end;
	}
	if ( instance_create( "Instance ONE", IM_PARTY ) < 0 ) {
		mes "failed to create instance";
		close;
	}
	instance_enter "Instance ONE";
	end;
}

prontera,158,180,0	script	Instance TWO	1_F_MARIA,{
	if ( getstrlen( instance_mapname("guild_vs2") ) ) {
		instance_enter "Instance TWO";
		end;
	}
	if ( instance_create( "Instance TWO", IM_GUILD ) < 0 ) {
		mes "failed to create instance";
		close;
	}
	instance_enter "Instance TWO";
	end;
}

yes, one for party, another one for guild

now here's the scenario ...

let's say Player A same party with Player C, and Player A register the Instance ONE for party
Player B same guild with Player C, and Player B register the Instance TWO for guild

Player C has the choice to go in both instance, since Player C has meet both requirement

my test result is ... it seems rathena has bug in this case, Player C allow to go in Party type only


test again in hercules ... no problem, Player C can go inside both instance

prontera,150,180,0	script	Check Instance	1_F_MARIA,{
OnClick:
	dispbottom strcharinfo(3);
	dispbottom instance_id() +""; // this script command is useless in hercules, always return -1 on non-instanced npc. An instanced npc don't need to use this script command anyway
	dispbottom has_instance2("guild_vs1") +"";
	dispbottom has_instance2("guild_vs2") +"";
	end;
OnInit:
	bindatcmd "test", strnpcinfo(0)+"::OnClick";
	end;
}

prontera,155,180,0	script	Instance ONE	1_F_MARIA,{
	if ( has_instance2("guild_vs1") >= 0 ) {
		warp has_instance("guild_vs1"), 49,49;
		end;
	}
	if ( ( .@ins = instance_create( "Instance ONE", getcharid(CHAR_ID_PARTY), IOT_PARTY ) ) < 0 ) {
		mes "error : "+ .@ins;
		close;
	}
	if ( !getstrlen( instance_attachmap( "guild_vs1", .@ins, true, .@ins +"INS1" ) ) ) {
		mes "error : 5";
		instance_destroy .@ins;
		close;
	}
	instance_set_timeout 3600, 15, .@ins;
	instance_init .@ins;
	warp has_instance("guild_vs1"), 49,49;
	end;
}

prontera,158,180,0	script	Instance TWO	1_F_MARIA,{
	if ( has_instance2("guild_vs2") >= 0 ) {
		warp has_instance("guild_vs2"), 49,49;
		end;
	}
	if ( ( .@ins = instance_create( "Instance ONE", getcharid(CHAR_ID_GUILD), IOT_GUILD ) ) < 0 ) {
		mes "error : "+ .@ins;
		close;
	}
	if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, true, .@ins +"INS2" ) ) ) {
		mes "error : 5";
		instance_destroy .@ins;
		close;
	}
	instance_set_timeout 3600, 15, .@ins;
	instance_init .@ins;
	warp has_instance("guild_vs2"), 49,49;
	end;
}

 

Edited by AnnieRuru
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

same topic appear on hercules forum

34,Test Instance,3600,15,guild_vs2,49,49
prontera,155,180,0	script	Test Instance	1_F_MARIA,{
	if ( getstrlen( instance_mapname("guild_vs2") ) ) {
		instance_destroy;
	}
	if ( instance_create( "Test Instance", IM_CHAR ) < 0 ) {
		mes "failed to create instance";
		close;
	}
	instance_enter "Test Instance";
	end;
}
guild_vs2,49,49,5	script	test dialog	1_F_MARIA,{
	dispbottom strnpcinfo(4);
	mes sprintf( "%d monsters on this map", 'amount );
	next;
	select "Destroy";
	instance_destroy;
	end;
OnInstanceInit:
	monster instance_mapname("guild_vs2"), 49,49, "--ja--", 1002, 10, instance_npcname( strnpcinfo(0) )+"::OnMobDead";
	'amount = 10;
	end;
OnMobDead:
	--'amount;
	if ( !'amount )
		instance_announce 0, "all monster killed", bc_map;
	end;
}

A few things noted for rathena ones ...

1. rathena has instance_db.txt file ... make sure you add this line ... and @reloadinstancedb

2. rathena has much less instance related script command, making rathena instance script easier to learn, but there are 2 drawback
a. rathena seems cannot retrieve the instance ID you are in ... but doesn't matter since the map name is the one matter most
b. not as flexible as hercules has instance_timeout script command ... this value is hardcoded into database so all party has to use the same timeout value

3. rathena instance ID start from 1, hercules instance ID start from 0
a. make sure the instance_announce is set to 0

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   431
  • Joined:  01/26/16
  • Last Seen:  

50 minutes ago, AnnieRuru said:

rathena seems cannot retrieve the instance ID you are in

You can. See script_instancegetid.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  10/23/17
  • Last Seen:  

13 hours ago, AnnieRuru said:

ok let me rephrase that sentence ...
in rathena .......


34,Instance ONE,3600,15,guild_vs1,49,49
35,Instance TWO,3600,15,guild_vs2,49,49

prontera,150,180,0	script	Check Instance	1_F_MARIA,{
OnClick:
	dispbottom strcharinfo(3); 
	dispbottom instance_id() +""; // this line sux ... if you only have 1 instance attached then its ok, but if more than one ...
	end;
OnInit:
	bindatcmd "test", strnpcinfo(0)+"::OnClick";
	end;
}

prontera,155,180,0	script	Instance ONE	1_F_MARIA,{
	if ( getstrlen( instance_mapname("guild_vs1") ) ) {
		instance_enter "Instance ONE";
		end;
	}
	if ( instance_create( "Instance ONE", IM_PARTY ) < 0 ) {
		mes "failed to create instance";
		close;
	}
	instance_enter "Instance ONE";
	end;
}

prontera,158,180,0	script	Instance TWO	1_F_MARIA,{
	if ( getstrlen( instance_mapname("guild_vs2") ) ) {
		instance_enter "Instance TWO";
		end;
	}
	if ( instance_create( "Instance TWO", IM_GUILD ) < 0 ) {
		mes "failed to create instance";
		close;
	}
	instance_enter "Instance TWO";
	end;
}

yes, one for party, another one for guild

now here's the scenario ...

let's say Player A same party with Player C, and Player A register the Instance ONE for party
Player B same guild with Player C, and Player B register the Instance TWO for guild

Player C has the choice to go in both instance, since Player C has meet both requirement

my test result is ... it seems rathena has bug in this case, Player C allow to go in Party type only


test again in hercules ... no problem, Player C can go inside both instance


prontera,150,180,0	script	Check Instance	1_F_MARIA,{
OnClick:
	dispbottom strcharinfo(3);
	dispbottom instance_id() +""; // this script command is useless in hercules, always return -1 on non-instanced npc. An instanced npc don't need to use this script command anyway
	dispbottom has_instance2("guild_vs1") +"";
	dispbottom has_instance2("guild_vs2") +"";
	end;
OnInit:
	bindatcmd "test", strnpcinfo(0)+"::OnClick";
	end;
}

prontera,155,180,0	script	Instance ONE	1_F_MARIA,{
	if ( has_instance2("guild_vs1") >= 0 ) {
		warp has_instance("guild_vs1"), 49,49;
		end;
	}
	if ( ( .@ins = instance_create( "Instance ONE", getcharid(CHAR_ID_PARTY), IOT_PARTY ) ) < 0 ) {
		mes "error : "+ .@ins;
		close;
	}
	if ( !getstrlen( instance_attachmap( "guild_vs1", .@ins, true, .@ins +"INS1" ) ) ) {
		mes "error : 5";
		instance_destroy .@ins;
		close;
	}
	instance_set_timeout 3600, 15, .@ins;
	instance_init .@ins;
	warp has_instance("guild_vs1"), 49,49;
	end;
}

prontera,158,180,0	script	Instance TWO	1_F_MARIA,{
	if ( has_instance2("guild_vs2") >= 0 ) {
		warp has_instance("guild_vs2"), 49,49;
		end;
	}
	if ( ( .@ins = instance_create( "Instance ONE", getcharid(CHAR_ID_GUILD), IOT_GUILD ) ) < 0 ) {
		mes "error : "+ .@ins;
		close;
	}
	if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, true, .@ins +"INS2" ) ) ) {
		mes "error : 5";
		instance_destroy .@ins;
		close;
	}
	instance_set_timeout 3600, 15, .@ins;
	instance_init .@ins;
	warp has_instance("guild_vs2"), 49,49;
	end;
}

 


Thanks alot ❤️

Link to comment
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.   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...