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 07-12-2007, 10:43 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
slashing game is broken :(

this is in a barrel npc in a level. you are sapost to slash the barrel a bunch of times untill the barrel has 0 hits left, then it gives you cash.

the only part that wont work is the give you cash part at the botem.
PHP Code:
//NPC by theHAWKER
function onCreated(){
this.hits 1000;
setTimer(.5);
}
function 
onWa****(){
this.hits -= int(random(1,10));
onHitCheck;
}
function 
onTimeout(){
this.chat = @this.hits" hits left!";
setTimer(.5);
}
//#CLIENTSIDE
function onHitCheck(){
if (
this.hits == || this.hits 0){
player.chat "I got 250$!";
player.rupees += 250;
onCreated();
}
echo(
"HitCheckIsWorking");

__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 07-12-2007, 10:45 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Yes, let's all call CLIENTSIDE FUNCTIONS, from SERVERSIDE.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #3  
Old 07-12-2007, 10:51 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
it still dose the same thing with no clientside...
__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 07-12-2007, 10:53 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by theHAWKER View Post
it still dose the same thing with no clientside...


When you set a this. variable serverside or clientside, it won't read the same with the counterpart (I.E if you set a this. variable clientside, it won't read the same serverside unless you use a trigger and send the variable over, and the same goes for setting it serverside).
Reply With Quote
  #5  
Old 07-12-2007, 10:54 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
you have onhitcheck serverside and the function is clientside. Yeehaw.

Also, you can't set player rupees clientside.
Reply With Quote
  #6  
Old 07-12-2007, 10:56 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
it still dose the same thing with no clientside....
__________________
**FLIP OUT**
Reply With Quote
  #7  
Old 07-12-2007, 10:57 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by theHAWKER View Post
it still dose the same thing with no clientside....


Who said that all of those functions work serverside? x-x
Reply With Quote
  #8  
Old 07-12-2007, 10:59 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by Gambet View Post
Who said that all of those functions work serverside? x-x
can u help me out?
__________________
**FLIP OUT**
Reply With Quote
  #9  
Old 07-12-2007, 11:00 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by theHAWKER View Post
it still dose the same thing with no clientside....
You said it all works except the money part. You have the money part clientside. You cannot set money clientside. You also call a clientside function from serverside which is impossible. Hell, you call onCreated() clientside when the only onCreated block is serverside.

Also, when calling a function, do blah(); not blah;
Reply With Quote
  #10  
Old 07-12-2007, 11:05 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by Twinny View Post
Also, when calling a function, do blah(); not blah;
that worked xD thx
__________________
**FLIP OUT**
Reply With Quote
  #11  
Old 07-12-2007, 11:11 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
PHP Code:
function onActionAward()
{
 
player.rupees+=250;
}

//#CLIENTSIDE
function onCreated()
{
 
reset_NPC(0);
}

function 
onWa****()
{
 
this.to_deduct int(random(1,10));
 if (
this.hits this.to_deduct >= 0)
  {
   
this.hits this.hits this.to_deduct;
   
this.chat this.hits " hits left!";
  }
 else
  {
   
this.hits NULL;
   
NPC_Dead();
  }
}

function 
NPC_Dead()
{
 
this.chat "";
 
player.chat "I got $250!";
 
player.triggeraction(x+1.5,y+1.5,"Award","");
 
reset_NPC(2);
}

function 
reset_NPC(time)
{
 
sleep(time);
 
this.hits 1000;
 
this.chat this.hits;


Scripted it here on the forums so didn't test anything, but works in theory.
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 07:44 PM.


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