Jump to content
  • 0
Sign in to follow this  
Aeromesi

Instancing troubles.

Question

So I used Hercules example for an instance

 

 

payon,150,150,4<tab>script<tab>Payon instance<tab>101,{set .@instance, instance_create("Payon instanced", getcharid(1));if( .@instance < 0 ){	mes "Failed to create the instance!";	close;}if( instance_attachmap("payon", .@instance) == "" ){	instance_destroy(.@instance);	mes "Failed to attach payon as a map!";	close;}instance_attach(.@instance);instance_set_timeout(3600, 300, .@instance);instance_init(.@instance);warp "payon", 150, 150;}

 

It makes my client crash. I even tried what Dastgir suggested on Skype which was to get rid of instance_attach(.@instance);

Still crashed, changed the payon map to eden (my custom hometown) and it still crashed. But I tried endless tower and I didn't crash. What could I be doing wrong? I never attempted to make an instance before, I understood the concept of it and how it's done, but I just keep getting these client crashes... :/

Edited by Aeromesi

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

@@Winterfox testing right now



When its like this

 

payon,150,150,0	script	Payon Instance#a	101,{set .@instance, instance_create("Payon instanced", getcharid(1));if( .@instance < 0 ){	mes "Failed to create the instance!";	close;}instance_attachmap("payon", .@instance, 1, "payon2");if( instance_attachmap("payon2", .@instance) == "" ){	 instance_destroy(.@instance);	mes "Failed to attach payon as a map!";	close;}instance_set_timeout(3600, 300, .@instance);instance_init(.@instance);instance_attach(.@instance); warp "payon2", 93, 117;}


Nothing happens but it says The Memorial Dungeon has been removed. wtf? lol


So I got it working, but how come 2nd player can't warp to the instance? It just says Failed to create instance!

Edited by Aeromesi

Share this post


Link to post
Share on other sites
  • 0

What does the 1 stand for btw? and how many parameters does this have?
 

instance_attachmap("payon", .@instance, 1, "payon2");


So it works now! Now I can start coding instances :P

Edited by Aeromesi

Share this post


Link to post
Share on other sites
  • 0

The mistake you made was this: 

instance_attachmap("payon", .@instance, 1, "payon2");if( instance_attachmap("payon2", .@instance) == "" )

Needs to be:

if( instance_attachmap("payon", .@instance, 1, "payon2") == "" )

The reason why you have to attach the map like this is the following:

Before you start, you have to choose the map, that you want to have instanced. Various restrictions are put on the map names on client-side. If you ignore them, the client usually crashes upon entering the instanced map.Only maps, that begin with a number and @ (e. g. 1@tower) are recognized as instance map by the client. If you want to use a map, that does not match this naming scheme, just must attach it with emulation (parameter <use basename> in command instance_attachmap), which makes the client think, that it is on the actual map, instead of an instance.Map name length limitations:For emulated instance maps you cannot use maps, whose names are longer than 7 characters, because the instance map name is composed of 3 digits, followed by # and the original map name.For client-recognized instance maps, the map name limit is 8 characters, because the instance map name is composed of 3 digits and the original map name.

 

 

The 1 sets the emulation to 1 and the second parameter sets the name for the instance map, since it would confuse the server if you would use a real existing map.

Share this post


Link to post
Share on other sites
  • 0

Thanks a ton @@Winterfox you're awesome. Well now I know how to do this~ :D


Do I still need instance_attach(.@instance);

? Dastgir told me not to use that.

Edited by Aeromesi

Share this post


Link to post
Share on other sites
  • 0

Well you don't need it, it adds the script you are currently running to the instance.

I don't see a point in doing so.

 

instance_attach <instance id>;Attaches the current script to the instance given by <instance id>.

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.