Jump to content
  • 0
Eternity

Question regarding getmapxy

Question

So i would like to ask if how can i make each player is returned to the same exact point they were before playing the match.

 

 

OnEventEnd:
   getmapxy(.@m$,.@px,.@py,0);
   warp .@m$,.@px,.@py; 
    .off = 0;
    .on = 0;
    for(set .@i, 0; .@i < getarraysize(.option); set .@i,.@i+1)
        removemapflag .map$,.option[.@i];
    end;

 

 

Everytime the event is end, the mapserver tells player not attached. maybe? does it requires any SQL?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

When you want to trigger the warp, you need to use attachrid(AID)

 

1. When creating event, you need to add every AID to an array which will be looped through at the end to check.

2. When event starts, save coordinates and map values using temporary @ value. E.g. @map$ = "prontera"; @x = 150; @y = 150;

3. When event ends, trigger donpcevent() for the event.

4. Loop through array and attachrid as you go.

 

Here is an example...cannot confirm it works trying to work through with logic.

 

 

prontera,150,150,3    script    Blah_Blah_Me    CLEAR_NPC,{

    @map$ = "amatsu"; @x = 200; @y = 200;
    $@Event_Array[$@Count] = getcharid(CHAR_ID_ACCOUNT);
    $@Count ++;
    mes("I saved your coordinates!");
    close;

OnEnd:
    for (.@i = 0; .@i < getarraysize($@Event_Array); ++.@i)
        if (isloggedin($@Event_Array[.@i]))
        {
            attachrid($@Event_Array[.@i]);
            warp("" + @map$ + "", @x, @y, 0);
            detachrid();
        }
    deletearray($@Event_Array);
    $@Count = 0;
    end;
}

 

Again, cannot confirm if works, tryna work through logic.

Share this post


Link to post
Share on other sites
  • 0

Thanks for the idea and base! i appreciate it.

Edited: Does not work.

Also, i want them to be warp on their original position (coordinates) where they play the last matched.
 

e.g
player 1 was in the pay_fild01 123 22

After the EVENT ends, he will warped back to its original position THE "pay_fild01 123 22"

Thank you for helping!

Edited by Eternity

Share this post


Link to post
Share on other sites
  • 0

There is no need to use global variables ($@) or to use attachrid

	getmapxy(@evt_map$, @evt_x, @evt_y, UNITTYPE_PC); // save the previous position
	warp(.map$, .warp_x, .warp_y); // warp the player to your event
	end;

OnWarpBack:
	warp(@evt_map$, @evt_x, @evt_y);
	end;

OnEventEnd:
	.@count = getunits(BL_PC, .@players, false, .map$);
	for (.@i = 0; .@i < .@count; .@i++) {
		addtimer(rand(500), strnpcinfo(0) + "::OnWarpBack", .@players[.@i]);
	}
	end;


OnInit:
	.map$ = "the-map"; // map of the event
	.warp_x = 50; // the x position to warp the player to
	.warp_y = 50; // the y position to warp the player to

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.