Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   baddy killing (https://forums.graalonline.com/forums/showthread.php?t=134261087)

callimuc 11-14-2010 06:17 PM

baddy killing
 
hey i got another question. how is the script that i can kill npcs on playerworld? i have tried everything and looked everywhere but it wont work. just the normal baddies (blue soldier,...) will work, but not the other npcs. i can hit them but it wont play the gani and they wont die.

MrOmega 11-15-2010 03:37 AM

Basically you can create your own baddie by setting this.hp and use onActionWas.Hit() ( remove the period, forum censors) for when the player uses their sword or onActionExploded() for bombs and just take away some hp, then just kill it when this.hp is zero.

callimuc 11-16-2010 06:53 PM

ill try what you mean but could you put in an example?

Cubical 11-17-2010 01:26 AM

Not for copying and pasting, it's more to give you an idea of some of the things you'll need.
PHP Code:

function onCreated(){
  
//set vars
  
this.respawnpos = {this.xthis.y};
  
setTimer(0.05);
}
function 
onTimeout(){
  
doMovement();
  
setTimer(0.05);
}
function 
doMovement(){
  if (
this.hp 0){
    
//do checks to see if a player is in the baddies aggro radius
   //then
    //do movement
  
}
}
function 
onActionWa****(){
  if (! (
this.hp <= 0)){
    
this.hp -= 0.5;
  } else 
doDead();
}
function 
doDead(){
  
//set animation to dead and add exp if thats what you're doing
  
scheduleevent(2"Respawn"null);
}
function 
onRespawn(){
  
//set x and y to where you want it to respawn at each time
  
this.this.respawnpos[0];
  
this.this.respawnpos[1];
  
this.hp this.maxhp;




All times are GMT +2. The time now is 10:38 AM.

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