Thread: Custom map
View Single Post
  #1  
Old 10-17-2006, 03:10 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Custom map

Not that others may use this, but I just wanted to show the script, and get some oppinions on it. Maybe tips to improve it?

- Contiga

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
map.offset_x map.offset_y 0;
  
map.movespeed 10;
  
map.status 0;
}

function 
onKeyPressednumkeyscan) {
  if ( 
key "m") {
    if ( 
isonmap) {
      
map.update true;
      
map.status map.status;
    }
    
setTimer0.05);
  }
}

function 
loadPos() {
  
setAni"bomyisland_map-unfold""");
  
map.offset_x = ( player.* ( map.i_width map.r_width)) - ( screenwidth 2) + 16;
  
map.offset_y = ( player.* ( map.i_height map.r_height)) - ( screenheight 2) + 32;
  
fixMapPos();
  
map.update false;
  
map.wait 1;
}

function 
onTimeout() {
  if ( 
map.status == 1) {
    if ( 
isonmapdrawMap();
    else 
hideMap();
  }
  else 
hideMap();
}

public function 
turnOff()
  
map.status 0;

function 
hideMap() {
  
setAni"bomyisland_map-fold""");
  
hideImgs200map.images_index);
  
disabledaynight false;
}

function 
drawMap() {
  
freezeplayer.1);
  if ( 
map.wait 0)
    
map.wait -= 0.1;
  
disabledaynight true;
  
hideImgs200map.images_index); 
  
map.images_index 200;
  
map.r_width map.r_height int64 25); 
  
map.background_poly = { 00screenwidth0screenwidthscreenheight0screenheight};
  
map.co_ordinates = { map.offset_xmap.offset_yscreenwidth 32screenheight 32};
  
map.i_width imgwidthnewmainmap.png); 
  
map.i_height imgheightnewmainmap.png);
  
fixMapPos();
  
drawImg"bomyisland_bigmap.png"16161710.81map.co_ordinates);
  
drawPolymap.background_poly160.71, { 000});
  
map.objects.clear(); 
  
map.objects.add( { "*" player.accountintplayer.x), intplayer.y), player.head, { 0643232}});
  
map.objects.add( { "Train"serverr.train_10], serverr.train_11], "trainicon.png", { 003232}});
  for ( 
plallplayers) {
    if ( 
pl.level.starts"world"))
      
map.objects.add( { "*" pl.accountintpl.x), intpl.y), pl.head, { 0643232}});
  }
  for ( 
omap.objects) {
    
obj_new_x = ( o1] * ( map.i_width map.r_width)) - map.offset_x;
    
obj_new_y = ( o2] * ( map.i_height map.r_height)) - map.offset_y;
    if ( 
obj_new_x in 0screenwidth| && obj_new_y in 0screenheight|) {
      
drawImgo3], obj_new_xobj_new_y190.511o4]);
      if ( 
mousescreenx in obj_new_x 8obj_new_x 24| && mousescreeny in obj_new_y 8obj_new_y 24|) {
        
drawTexto0], obj_new_x 26obj_new_y 4"Arial"0.8"bi", { 111}, 19);
        
obj_polygon_1 = { obj_new_x 26obj_new_y 4obj_new_x 30 getTextWidth0.8"Arial""bi"o0]), obj_new_y 4obj_new_x 30 getTextWidth0.8"Arial""bi"o0]), obj_new_y 24obj_new_x 26obj_new_y 24};
        
obj_polygon_2 = { obj_new_x 6obj_new_y 4obj_new_x 26obj_new_y 4obj_new_x 26obj_new_y 24obj_new_x 6obj_new_y 24};
        
drawPolyobj_polygon_1180.71, { 10.50}); drawPolyobj_polygon_2180.61, { 010});
      }
    }
  }
  if ( 
keydown0) || mousescreeny in 016|) map.offset_y max0map.offset_y map.movespeed);
  if ( 
keydown1) || mousescreenx in 016|) map.offset_x max0map.offset_x map.movespeed);
  if ( 
keydown2) || mousescreeny in screenheight 16screenheight|) map.offset_y minmap.i_height screenheight 32map.offset_y map.movespeed);
  if ( 
keydown3) || mousescreenx in screenwidth 16screenwidth|) map.offset_x minmap.i_width screenwidth 32map.offset_x map.movespeed);
  
findWeapon"*Inventory").invOff();
  if ( 
map.update == true)
    
loadPos();
  
setTimer0.05);
}

function 
fixMapPos() {
  
map.offset_y max0map.offset_y); 
  
map.offset_y minmap.i_height screenheight 32map.offset_y);
  
map.offset_x minmap.i_width screenwidth 32map.offset_x); 
  
map.offset_x max0map.offset_x);
}

function 
drawPolyipiliaimic) {
  
map.images_index ++;
  
with findImgmap.images_index)) {
    
polygon iplayer ilalpha iamode im;
    
red ic0]; green ic1]; blue ic2];
  }
}

function 
drawImgimixiyiliziaimodeipart) {
  
map.images_index ++;
  
with findImgmap.images_index)) {
    
image imixiylayer il;
    
zoom izalpha iamode imode;
  } 
changeImgPartmap.images_indexipart0], ipart1], ipart2], ipart3]);
}

function 
drawTexttmtxtytftztstctl) {
  if ( 
tc 0tc = { 111};
  
map.images_index ++;
  
with findImgmap.images_index)) {
    
txtyfont tfzoom tztext tmstyle ts;
    
red tc0]; blue tc2]; green tc1]; layer tl 1;
  }
  
map.images_index ++;
  
with findImgmap.images_index)) {
    
tx 1ty + ( - ( 16)); font tfzoom tz;
    
text tmstyle tsred blue green 0layer tl;
  }
}

function 
onMouseDownbutton) {
  switch ( 
button) {
    case 
"left":
      if ( 
map.status 0) return "";
      if ( 
keydown2162true)) {
        
map.warp_x = ( ( mousescreenx map.offset_x) - 16) * ( map.r_width map.i_width);
        
map.warp_y = ( ( mousescreeny map.offset_y) - 16) * ( map.r_height map.i_height);
        
player.chat "warpto " intmap.warp_x) @ " " intmap.warp_y) @ " newmain.gmap";
        
map.status 0;
      }
      break;
  }

__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote