Jump to content
  • 0

Instance_id actual use...


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I might need to play around with instances more, but I have a couple questions.

1) Is their a way to get the actual instance_id for an instance. Their are several cases where i want to use instance_destroy, but it tells me instance 0 is invalid. The script_commands tells me that it needs the instance_id to work. For example, if I want to use the OnPCDieEvent event to warp a character out of the map when he dies I need it to destory the instance if he was the last player on the map or it will keep it open until the timer ends.

2) Getmapusers when called from OnPCDieEvent does not render the proper map. Using strcharinfo(3) will the proper instanced map name such as 0011@gf, but instance_mapname nolonger does so they never match. Without the check it would warp players on anymap.

Peopleperson49

Quote

*instance_destroy {<instance id>};

Destroys instance with the ID <instance id>. If no ID is specified, the instance
the script is attached to is used. If the script is not attached to an instance,
the instance of the currently attached player's party is used. If that fails,
the script will come to a halt.

Quote

OnPCDieEvent:

if(playerattached()==0) { end; }

if(strcharinfo(3)!=getmapusers(instance_mapname("1@gf"))) { end; }

warp "SavePoint",0,0;

if(getmapusers(instance_mapname("1@gf"))<0) {  instance_destroy(); }

end;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Can somebody please make OnPCDieEvent and other similar events work in scripts also! So it is never going to work because it is specifically a script event, but it would work exactly the same in instances.

Peopleperson49

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2347
  • Joined:  10/28/11
  • Last Seen:  

something like this ?

	OnPCDieEvent:
		.@map$ = strcharinfo(3);
		if (strcharinfo(3) == instance_mapname(("1@gf")) {
			if (getmapusers(strcharinfo(3)) <= 1)
				instance_destroy;
		}
		end;

well, actually you can just set the instance idle timeout to shorter to it would auto destroy once the player warp out from instance, and also make it nobody can reenter if they left.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

That is what I did. OnPCDieEvent only works from scripts and for some reason it doesn't see instances as scripts. When you try to use it you get a nice warning telling just that... Using strcharinfo(3) will render the actual mapname only not the instance mapname. For example: it will show 1@map but your characters are in 0001@map. What I noticed is that when the last player leaves the instance such as respawning or disconnecting it wont destroy the instance until the timer runs out. Thanks for the reply.

Peopleperson49

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