Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Algorithm for warping (https://forums.graalonline.com/forums/showthread.php?t=73217)

cbk1994 04-01-2007 11:13 PM

Algorithm for warping
 
On my custom map script, I need the player to be able to warp (like CTRL + click on classic map). I can't find the algorithm.

I'm using a GuiShowImgCtrl named Map_Window.

The gmap is 32x32 levels wide.

This is what I've got ... it's probably all wrong.

PHP Code:

function Map_Window.onRightMouseDownddxdyclicks )
{
  
temp.coords Map_Window.globaltolocalcoord( { dxdy } );
  
  
temp.ddx temp.coords[0];
  
temp.ddy temp.coords[1];
  
  
temp.wid Map_Window.width;
  
temp.rate = ( 538 32 ) / 63;
  
  
temp.tiles temp.wid temp.rate;
  
  
temp.posx = ( temp.wid 32 ) / temp.tiles temp.ddx;
  
  
player.chat "warpto" SPC temp.posx SPC 30

I'm only working with x for now. If I can figure that out I can get y to work.

The map image is 538x538 pixels.

Looks like this:

PHP Code:

   new GuiShowImgCtrl"Map_Window" )
  {
    
image temp.map;
    
width 538;
    
height 538;
    
visible temp.show;
    
screenwidth - ( width );
    
screenheight - ( height );
  } 

Thanks a TON!

JkWhoSaysNi 04-02-2007 12:00 AM

Check out my custom bigmap script:

http://forums.graalonline.com/forums...ad.php?t=68644

It has the exact thing you want. Look at the onMouseDown() event.

cbk1994 04-02-2007 12:42 AM

Thank you so much! That worked perfectly. For those curious I did this.

PHP Code:

function Map_Window.onRightMouseDownddxdyclicks )
{
  
temp.coords Map_Window.globaltolocalcoord( { dxdy } );
  
temp.ddx = ( temp.coords[0] / 538 ) * ( 32 64 );
  
temp.ddy = ( temp.coords[1] / 538 ) * ( 32 64 );
  
player.chat "warpto" SPC temp.ddx SPC temp.ddy;




All times are GMT +2. The time now is 10:35 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.