Instancing troubles.

Aeromesi

Custom Instance Maniac
Messages
821
Points
0
Age
33
Location
Custom Instances
Discord
Aeromesi#0293
Github
http://www.github.com/aeromesi
Emulator
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... :/

 
Last edited by a moderator:
@@Aeromesi

Did you try it with emulation like this?

instance_attachmap("payon", .@instance, 1, "payon2")
if that works you need to change the warp like this:

Code:
warp "payon2", 150, 150;
 
@@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!

 
Last edited by a moderator:
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
default_tongue.png


 
Last edited by a moderator:
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.

 
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.

Code:
instance_attach <instance id>;Attaches the current script to the instance given by <instance id>.
 
Back
Top