Thread: Bomb & Bow
View Single Post
  #3  
Old 06-26-2007, 06:57 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Angel_Light View Post
cant you use the default ones or do want to see the script? I'm not sure hwo they do there bow probably just shootarrow and stuff here's how I would do bombs

PHP Code:
//#CLIENTSIDE
function onWeaponFired() { 
if (
player.bombs 0) { 
  
setani("lay"NULL); 
  
freezeplayer(0.2); 
if (
isOnMap) { 
  
temp.px player.- (64 getMapX(player.level)) + 0.5 vecx(player.dir)*2
  
temp.py player.- (64 getMapY(player.level)) + 0.5 vecy(player.dir)*2
  
putBomb(1temp.pxtemp.py); 

else { 
  
putbomb(1,player.vecx(player.dir)*2player.0.5 vecy(player.dir)*2); 

  
player.bombs --; 


Much shorter version:
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
  if (
player.bombs <= 0) return; 
  
setani("lay""");
  
freezeplayer(0.2);
  
putBomb(1player.x%64 0.5 vecx(player.dir)*2player.y%64 vecy(player.dir)*2);
  
player.bombs --; 

Good use of math reduces the need to use if checks.
And why did you have + 0 on the Y for the map and + 0 on the x and + 0.5 for the Y off a map?
__________________
Do it with a DON!
Reply With Quote