Jump to content
  • 0

Instance specific event


Question

Posted

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!)

8 answers to this question

Recommended Posts

Posted (edited)

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
Posted

 

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.

Posted

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

Posted

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!

Posted

 

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;
}
Posted

 

 

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...