Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-23-2012, 11:59 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
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);
 } 
Reply With Quote
  #2  
Old 05-24-2012, 12:11 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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'.
__________________
Quote:
Reply With Quote
Reply


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 01:09 AM.


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