Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 08-27-2010, 10:52 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by cbk1994 View Post
You'll want to use onKeyPressed() and GraalControl.onKeyUp()

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.spread 0.1;
  
this.freeze 0.1// player freeze time
  
this.speed 0.05// controls the timeout
  
this.reload 50;
  
this.load 50;
}
function 
onKeyPressed(codekeyscan) {
  if (
player.weapon != this) {
    return; 
// weapon not selected
  
}
  
  if (
this.keyD) {
    return;
  }
  
  if (
key == "d") {
    
this.keyD true;
    
this.onTimeOut();
  }
}

function 
GraalControl.onKeyUp(codekeyscan) {
  if (
key == "d") {
    
this.keyD false;
    
this.setTimer(0); // end the timeout, stop shooting
  
}
}

function 
onTimeOut() { // this is where the shooting goes
  
freezePlayer(this.freeze);
  
setAni("millenium_scar-fire"NULL);

  
temp.angl getangle(vecx(player.dir), vecy(player.dir))+random(this.spread*-1,this.spread);
  
  
shoot(player.0.5 vecx(player.dir), player.vecy(player.dir), player.ztemp.angl00"idle"player.dir);
  
setTimer(this.speed);

You'll also need to add checks for things like reloading, etc.
..
__________________
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 07:14 PM.


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