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 08-21-2006, 09:19 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Custom baddies and custom hp

Basically, I have one, apparently very powerfull, baddy. I can't damage it.
Here's some parts of the scritps used for attacking it, it's mostly triggeractions, but AI can't find out what's failing, since it's all going through
First, the action triggered by punching:
PHP Code:
triggeraction(player.x+1+vecx(player.dir)*2.1,player.y+1.5+vecy(player.dir)*2.1,"hurt","hurt",clientr.attack); 
This is received by the baddy:

PHP Code:
function onActionhurt()
{
  if(
params[0]=="hurt")
  {
      
this.hp-=params[1];
      
chat=this.hp;
      
triggeraction(x,y,"hp","hp",this.hp);
      if(
this.hp<=0)
      {
        
this.hp=int(random(15,25));
        
triggeraction(0,0,"serverside","-System","exp",1,"secure");
        
hide();
        
settimer(random(10,20));
      } 
  }
}

function 
onCreated()
{
  
setshape(1,32,32);
  
this.hp=int(random(15,25));

Which triggers the client of the baddy, for the hp variable to exist on clientside as well:

PHP Code:
function onActionhp()
{
  
this.hp=params[1];
}
function 
onCreated()
{
  
this.direct=2;
  
setimg("dr_baddy_spider.png");
  
setshape(1,32,32);
  
onTimeout();

Now...what's not working???
The hp doesn't go down, yet the actions are received.
=(
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 10:12 AM.


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