Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-16-2009, 07:23 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Selection

PHP Code:
//#CLIENTSIDE
function onMouseDown(key) {
  if (!(
key in {"left""right"})) return;
  
this.("on" key "Click")();
}

function 
onLeftClick() {
  
this.ns = {mousescreenxmousescreeny};
  
this.np = {mousexmousey};
  
setTimer(0.05);
}

function 
onRightClick() {
  if (
this.list == null) return true;
  
  
this.list = null;
  
this.onClearPeople();
}

function 
onTimeout() {
  if (!
mousebuttons) {
    
this.onSearch({mousexmousey});
    return;
  }
  
  
showpoly(200, {
    
this.ns[0], this.ns[1],
    
mousescreenxthis.ns[1],
    
mousescreenxmousescreeny,
    
this.ns[0], mousescreeny
  
});
  
changeimgvis(2004); 
  
changeimgcolors(2000000.4);
  
  
setTimer(0.05);
}

function 
onSearch(mp) {    
  
hideimg(200);
  
  
temp.this.np//origional mx/my
  
temp.= {mp[0] - c[0], mp[1] - c[1]};
  if (
p[0].starts("-")) {
    
temp.= {{mp[0], c[1]}, {c[0], mp[1]}};
    if (
p[1].starts("-")) {
      
temp.= {mpc};
    }
  } else {
    
temp.= {cmp};
    if (
p[1].starts("-")) {
      
temp.= {{c[0], mp[1]}, {mp[0], c[1]}};
    }
  }
  
  
temp.pl findnearestplayers(s[0][0], s[0][1]);
  for (
temp.ppl) {
    if (!(
p.x in |s[0][0], s[1][0]|)) continue;
    if (!(
p.y in |s[0][1], s[1][1]|)) continue;
    
temp.list.add(p);
  }
  if (
temp.list == null) return;
  
this.list = temp.list;
  
  
this.onDisplayPeople();
}

function 
onDisplayPeople() {
  
this.onClearPeople();
    
  
temp.pos = {0100};
  
temp.ext = {150, (32 this.list.size())};
  
with (findimg(201)) {
    
polygon = {pos[0], pos[1], 
               
pos[0] + ext[0], pos[1],
               
pos[0] + ext[0], pos[1] + ext[1],
               
pos[0], pos[1] + ext[1]};
    
layer 4;  
    
mode 2;
    
alpha 0.5;
  }
  
  for (
temp.pthis.list) {
    
temp.ypos = (pos[1] + ((thiso.imgcount 1) * 32));
      
//Head
    
with(findimg(201 this.imgcount)) {
      
image p.headimg
      
pos[0];
      
ypos;
      
layer 5;
      
partw 32parth 32partx 0party 64;
    }
      
//Account
    
with(findimg(206 this.imgcount)) {
      
text p.nick.substring(017); 
      
pos[0] + 35;
      
ypos;
      
zoom 0.6;
      
layer 5;
    }
      
//HP&MP
    
for (temp.0temp.2temp.i++) {
      
with(findimg((211 + (1) * 6) + + this.imgcount)) {
        
image "c_gui-bar" ".png";
        
layer 5;
        
pos[0] + 35;
        
ypos 14 + (8);
      }
    } 
    
this.imgcount++;
    if (
this.imgcount 5) break;
  }
}

function 
onClearPeople() {
  
hideimgs(200225 this.imgcount);
  
this.imgcount 1;

It's similar to C&C game selection, but it works for players! I was originally going to make a staff system with it, but as an example this one shows the selected players health points on the left hand side. It's quite fun
Attached Thumbnails
Click image for larger version

Name:	conttrol.jpg
Views:	272
Size:	14.5 KB
ID:	47442  
Attached Images
  
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:32 AM.


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