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
  #1  
Old 12-22-2005, 05:29 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Mana Shield Script

PHP Code:
// NPC made by Sephir Scarrend
//Mana Absorpotion Shield
//#CLIENTSIDE
if (created) {
  
this.state=0;
}
if (
playertouchsme) {
  
toweapons Mana Shield;
}
if (
weaponfired) {
  if (
strtofloat(#s(clientr.player_mp))>0) {
    
this.on=1;
  } else {
    
setplayerprop #c, Not enough MP!;
  
}
  
timeout=.05;
  
setimg light2.png;
  
this.hearts=playerhearts;
  
this.state=0;
}

if (
timeout) {
  if (
this.on==1) {
    
timeout=.05;
    if(
playerhearts!=this.hearts){
      
playerhearts=this.hearts;
      
freezeplayer 0;
    }
    
showimg 1,light2.png,playerx-2.5,playery-2.5;
    
changeimgcolors 1,1,1,1,0.9;
    
this.state=(this.state+1)%12;
    
changeimgzoom 1,1-.08*this.state;
    
drawaslight;
    
this.mp strtofloat(#s(clientr.player_mp))-.01; //MP drain while shield is active
    
setstring clientr.player_mp,#v(this.mp);
    
if (strtofloat(#s(clientr.player_mp))<0) {
      
this.on=0;
      
hideimg 1;
      
setimg door.gif;
      
dontblock;
      
this.mp 0;
      
setstring clientr.player_mp,this.mp;
    }
  }
}
if (
playerhurt) {
  if (
this.on==1) {
    
this.mp strtofloat(#s(clientr.player_mp))-.35; //MP lost when hurt normally (damage absorption)
    
setstring clientr.player_mp,#v(this.mp)
      
}
}
//below lines allow for disabling the shield
if(keypressed){
  if(
keydown(6)){
    if(
strequals(Mana Shield,#w)){
      
if(this.on==1){
        
this.on=0;
        
setimg door.gif;
        
hideimg 1;
        
dontblock;
      }
    }
  }

I have that, it works, perfectly, it's my first light script ever and my first try of doing any script without help.

I'm asking for criticism and what I can improve with this (nothing too complex please, or actually explain it to me..). If you want to use this on your server or anything, please let me know
__________________

I hope for nothing. I fear nothing. I am free.
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 05:03 AM.


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