Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Baddie issue (https://forums.graalonline.com/forums/showthread.php?t=134266503)

blackbeltben 05-23-2012 11:59 PM

Baddie issue
 
I don't know what I'm doing wrong. I have a simple baddie I am developing.
The Image displays, and the initial health displays, but it is not actually functional.
The onWasDmg() does work, but only when I change whole script to CLIENTSIDE....which I don't want to do.
I looked at many baddie examples (like gBaddie v3) and none of that is in CLIENTSIDE.
Why won't mine work :(


PHP Code:

function onCreated()
{
 
this.setshape(13232);
 
this.setImg("block.png");
 
this.health 500;
 
this.maxhealth 500;
 
setTimer(0.1);
 }

function 
onWasDmg()
{
 
this.health -= (player.clientr.tempdmg);
 } 

function 
onTimeOut()
{
 
this.chat this.health "/" this.maxhealth;
 
setTimer(0.05);
 } 


fowlplay4 05-24-2012 12:11 AM

If you're setting clientr.tempdmg client-side then the change isn't being seen serverside, therefore no damage is occurring.

Also update the chat when the baddy takes damage, not on a loop, that's very wasteful.

You can't 'timeout' faster than 0.1 seconds (and you should avoid doing so at all costs) on the server-side.

Try this:

PHP Code:

function onCreated() { 
  
this.setshape(13232); 
  
this.setImg("block.png"); 
  
this.health 500
  
this.maxhealth 500;
  
this.chat this.health "/" this.maxhealth;


function 
onWasDmg() { 
  
this.health -= 1;
  
this.chat this.health "/" this.maxhealth;


If it works then you need to fix your weapon system that triggers 'WasDmg'.


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

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