Jump to content
  • 0
rokimoki

Instances command for creating a new dungeon.

Question

Hello.

I need help for creating a new instance. I was looking for information here:
https://github.com/rathena/rathena/blob/master/doc/sample/instancing.txt
https://github.com/rathena/rathena/blob/master/doc/script_commands.txt (7.- Instance commands)

I need some advices like:
- How to create a map for instances, It can be original maps, for example: a prontera invasion but instanced.
- A simple instance example.
- Which is a must creating an instance.

I am trying to catch up all new things rAthena has, back in old times instances didn't exist so... never created one.

Thanks in advance.

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

instance_db.yml

  - Id: 1
    Name: Endless Tower
    TimeLimit: 14400
    Enter:
      Map: [email protected]
      X: 50
      Y: 355

NPC script

prontera,155,181,5	script	Sample	757,{
	[email protected]_name$ = "Endless Tower";
	if (!is_party_leader()) end;
	switch(select(
		"Create",
		"Enter",
		"Destroy"
	)) {
		case 1:
			instance_create([email protected]_name$, IM_PARTY);
			break;
		case 2:
			switch(instance_enter([email protected]_name$)) {
				case IE_NOMEMBER:
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes "ERROR: Unknown error.";
					break;
				default:
					break;
			}
			break;
		case 3:
			instance_destroy;
			break;
	}
	close;
}

 

  • Like 1
Link to comment
Share on other sites

  • 0
14 hours ago, Emistry said:

instance_db.yml

  - Id: 1
    Name: Endless Tower
    TimeLimit: 14400
    Enter:
      Map: [email protected]
      X: 50
      Y: 355

NPC script

prontera,155,181,5	script	Sample	757,{
	[email protected]_name$ = "Endless Tower";
	if (!is_party_leader()) end;
	switch(select(
		"Create",
		"Enter",
		"Destroy"
	)) {
		case 1:
			instance_create([email protected]_name$, IM_PARTY);
			break;
		case 2:
			switch(instance_enter([email protected]_name$)) {
				case IE_NOMEMBER:
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes "ERROR: Unknown error.";
					break;
				default:
					break;
			}
			break;
		case 3:
			instance_destroy;
			break;
	}
	close;
}

 

Good day sir @Emistry . I tried this one for my guild dungeon .. Im planning to make it instance like dungeon .. I've managed to create and enter the dungeon but the weird part is theres no monster inside .. 
Also Destroy Instance is not working
 

  - Id: 22
    Name: Guild Dungeon
    TimeLimit: 7200
    Enter:
      Map: gld_dun01
      X: 32
      Y: 36
    AdditionalMaps:
      gld_dun02: true
      gld_dun03: true
      gld_dun04: true

//prontera,155,181,5	script	Sample	757,{
brasilis,169,245,3	script	Test 	860,{
	[email protected]_name$ = "Guild Dungeon";
	if (!is_party_leader()) end;
	switch(select(
		"Create",
		"Enter",
		"Destroy"
	)) {
		case 1:
			instance_create([email protected]_name$, IM_PARTY);
			break;
		case 2:
			switch(instance_enter([email protected]_name$)) {
				case IE_NOMEMBER:
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes "ERROR: Unknown error.";
					break;
				default:
					break;
			}
			break;
		case 3:
			instance_destroy;
			break;
	}
	close;
}

image.png.3942358d43c4f58c544b136d65b83dcb.png

Edited by Eross
Link to comment
Share on other sites

  • 0

@ErossU need to spawn the monster at the script cuz' an instance is a clear copy of the default map. Only Npcs and mapflags copied to the instance.

Instance.txt

 

Rynbef~

  • Upvote 1
Link to comment
Share on other sites

  • 0
6 hours ago, Eross said:

Good day sir @Emistry . I tried this one for my guild dungeon .. Im planning to make it instance like dungeon .. I've managed to create and enter the dungeon but the weird part is theres no monster inside .. 
Also Destroy Instance is not working
 

  - Id: 22
    Name: Guild Dungeon
    TimeLimit: 7200
    Enter:
      Map: gld_dun01
      X: 32
      Y: 36
    AdditionalMaps:
      gld_dun02: true
      gld_dun03: true
      gld_dun04: true

//prontera,155,181,5	script	Sample	757,{
brasilis,169,245,3	script	Test 	860,{
	[email protected]_name$ = "Guild Dungeon";
	if (!is_party_leader()) end;
	switch(select(
		"Create",
		"Enter",
		"Destroy"
	)) {
		case 1:
			instance_create([email protected]_name$, IM_PARTY);
			break;
		case 2:
			switch(instance_enter([email protected]_name$)) {
				case IE_NOMEMBER:
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes "ERROR: Unknown error.";
					break;
				default:
					break;
			}
			break;
		case 3:
			instance_destroy;
			break;
	}
	close;
}

image.png.3942358d43c4f58c544b136d65b83dcb.png

You need to create the instance body in a new npc with the instance map

you can check the instances commands in 

https://github.com/rathena/rathena/blob/0aa5e93397d3ddfe7a559747b09c16b055da8b24/doc/script_commands.txt#L9248

and instances events in

https://github.com/rathena/rathena/blob/0aa5e93397d3ddfe7a559747b09c16b055da8b24/doc/script_commands.txt#L903

 

so for example you want to spawn 1 poring when the instance starts and respawn it again everytime id die would be like

gld_dun01,0,0,0	script	#instance_main_body	444,{
	end;
OnInstanceInit://Runs once the instance is created.
	'instance_id = instance_id();//save the instance id
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	//^ 'var is instance variable , you can call it from any script in that instance.
	
	//spawn the monster with a death event
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

OnPoringKilled:
	//announce that the poring is killed inside all the instance's maps
	instance_announce('instance_id,"The poring is killed!",0);
	
	//spawn the monster again after it's dead.
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;
}

 

 

and to destroy the instance from outside you need to provide the instance id

this should work

change

instance_destroy;

to

instance_destroy(instance_id(IM_PARTY));

^this will destroy the party instance that hooked to the player (it's not a good idea to do that without a lot of other checks like party leader , or the instance is the instance you want to destroy not another instance etc)

Edited by sader1992
  • Upvote 1
Link to comment
Share on other sites

  • 0

Thankyou for your time guys ! Ilove you all .. I will try this later when I got home

 

17 hours ago, sader1992 said:

You need to create the instance body in a new npc with the instance map

you can check the instances commands in 

https://github.com/rathena/rathena/blob/0aa5e93397d3ddfe7a559747b09c16b055da8b24/doc/script_commands.txt#L9248

and instances events in

https://github.com/rathena/rathena/blob/0aa5e93397d3ddfe7a559747b09c16b055da8b24/doc/script_commands.txt#L903

 

so for example you want to spawn 1 poring when the instance starts and respawn it again everytime id die would be like

gld_dun01,0,0,0	script	#instance_main_body	444,{
	end;
OnInstanceInit://Runs once the instance is created.
	'instance_id = instance_id();//save the instance id
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	//^ 'var is instance variable , you can call it from any script in that instance.
	
	//spawn the monster with a death event
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

OnPoringKilled:
	//announce that the poring is killed inside all the instance's maps
	instance_announce('instance_id,"The poring is killed!",0);
	
	//spawn the monster again after it's dead.
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;
}

 

 

and to destroy the instance from outside you need to provide the instance id

this should work

change

instance_destroy;

to

instance_destroy(instance_id(IM_PARTY));

^this will destroy the party instance that hooked to the player (it's not a good idea to do that without a lot of other checks like party leader , or the instance is the instance you want to destroy not another instance etc)

Hi sader! I tried the script but no monster has spawned .Also, how to spawn a monster that has spawn timer ? Like example in gld_dun01 there is an Eddga that respawn on certain time .. How to make it not respawn automatically after killing instead it will respawn afteer certain minutes

Link to comment
Share on other sites

  • 0
23 hours ago, Eross said:

Thankyou for your time guys ! Ilove you all .. I will try this later when I got home

 

Hi sader! I tried the script but no monster has spawned .Also, how to spawn a monster that has spawn timer ? Like example in gld_dun01 there is an Eddga that respawn on certain time .. How to make it not respawn automatically after killing instead it will respawn afteer certain minutes

create a timer , something like this

OnInstanceInit://Runs once the instance is created.
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
	
	initnpctimer('npc_instance_main_body$);
	stopnpctimer('npc_instance_main_body$);
end;

OnPoringKilled:
	startnpctimer('npc_instance_main_body$);
end;

OnTimer600000://after 10 minute
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
	setnpctimer(0,'npc_instance_main_body$);
	stopnpctimer('npc_instance_main_body$);
end;

or maybe put a sleep delay

OnInstanceInit://Runs once the instance is created.
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

OnPoringKilled:
	detachrid;//de attach the player from the event.
	sleep(600000);//sleep for 10 minutes
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

 

Edited by sader1992
  • Upvote 1
Link to comment
Share on other sites

  • 0
2 hours ago, sader1992 said:

create a timer , something like this

OnInstanceInit://Runs once the instance is created.
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
	
	initnpctimer('npc_instance_main_body$);
	stopnpctimer('npc_instance_main_body$);
end;

OnPoringKilled:
	startnpctimer('npc_instance_main_body$);
end;

OnTimer600000://after 10 minute
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
	setnpctimer(0,'npc_instance_main_body$);
	stopnpctimer('npc_instance_main_body$);
end;

or maybe put a sleep delay

OnInstanceInit://Runs once the instance is created.
	'map_gld_dun01$ = instance_mapname("gld_dun01");//save this map name inside the instance
	'npc_instance_main_body$ = instance_npcname(strnpcinfo(3));//save this npc name inside the instance
	
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

OnPoringKilled:
	detachrid;//de attach the player from the event.
	sleep(600000);//sleep for 10 minutes
	monster('map_gld_dun01$,32,36,"--en--",1002,1,'npc_instance_main_body$ + "::OnPoringKilled");
end;

 

Thankyou! I figured out earlier and use sleep2 rand(###,###); on script and works fine ..Thankyou !!!!

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

Important Information

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