Jump to content
  • 0

Instance specific event


Venture

Question


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  179
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

I wanted the instance to be destroyed and teleports to prontera when the player "Logs out or Dies Inside the Instance", but not to run the event outside the instance.

 

How do I do this?

 

I tried

OnPCDieEvent:
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
OnPCLogoutEvent:
    percentheal -100,0;
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;

In the same folder as the instance NPC, but they keep giving me error on the console, "Trying to destroy invalid instance 0". outside the Instance (They work well inside!)

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

replace the if statement with this..

 

if(@map$ != instance_mapname("abyss_03")) end;

 

Sorry if I can't test it, I don't have a functioning SVN anymore :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Add getmapxy()

 

Replace instance_map with the map to be used.

OnPCDieEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
OnPCLogoutEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    percentheal -100,0;
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
Edited by sandbox
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  179
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

 

Add getmapxy()

 

Replace instance_map with the map to be used.

OnPCDieEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
OnPCLogoutEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    percentheal -100,0;
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;

Tried, does not run :(

 

I changed "instance map" into "abyss_03", does not work.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Typo, can you try replacing the duplicate @x to @y and re-test it?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  179
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

Typo, can you try replacing the duplicate @x to @y and re-test it?

Re-tested, I tried printing @map$ into string, its returning 001abyss_03 instead of "abyss_03" like in the check.

dispbottom "I am at " + instance_id() + " " + @map$;

Returns

 

I am at 1 001abyss_03

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  179
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

replace the if statement with this..

if(@map$ != instance_mapname("abyss_03")) end;

Sorry if I can't test it, I don't have a functioning SVN anymore :)

ahh, that solves it! thanks!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

 

Add getmapxy()

 

Replace instance_map with the map to be used.

OnPCDieEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
OnPCLogoutEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    percentheal -100,0;
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;

 

What's the use in getmapxy() if you're only using the map name returned? It'd make more sense just use strcharinfo(3) to return the invoking player's map name.

Example:

if (strcharinfo(3) != instance_mapname("abyss_03")) {
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

 

 

Add getmapxy()

 

Replace instance_map with the map to be used.

OnPCDieEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;
OnPCLogoutEvent:
    getmapxy(@map$,@x,@x,0);
    if(@map$ != "instance_map") end;

    percentheal -100,0;
    warp "prontera",153,189;
    instance_destroy();
    percentheal 100,100;
    end;

 

What's the use in getmapxy() if you're only using the map name returned? It'd make more sense just use strcharinfo(3) to return the invoking player's map name.

Example:

if (strcharinfo(3) != instance_mapname("abyss_03")) {
	end;
}

 

That would work as well..

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