Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-05-2007, 09:39 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Chompy View Post
One thing, I've never seen a function inside a function >_>
That is actually quite common and most of my complex script. I originally thought that until my scripting teacher corrected me XP Anyways, for the hitting thing I have one idea not sure it will work though here it is

PHP Code:
//#CLIENTSIDE

etc...

function 
onTimeOut() {
random(1,2);
if (
player.x in |this.x-1;,this+3| && player.y in |this.y-1,this.y+3| && player.ani == "Attack Gani" && == "1") {
function 
hurtNPC(amount,type,force);
}
else if (
player.x in |this.x-1;,this+3| && player.y in |this.y-1,this.y+3| && player.ani == "Attack Gani" && == "2") {
function 
dmgplayer(amount);
}
setTimer(0.05):

the random thing is like if the player hit's or misses the baddy.
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 01-07-2007, 12:57 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Angel_Light View Post
That is actually quite common and most of my complex script. I originally thought that until my scripting teacher corrected me XP Anyways, for the hitting thing I have one idea not sure it will work though here it is

PHP Code:
//#CLIENTSIDE

etc...

function 
onTimeOut() {
random(1,2);
if (
player.x in |this.x-1;,this+3| && player.y in |this.y-1,this.y+3| && player.ani == "Attack Gani" && == "1") {
function 
hurtNPC(amount,type,force);
}
else if (
player.x in |this.x-1;,this+3| && player.y in |this.y-1,this.y+3| && player.ani == "Attack Gani" && == "2") {
function 
dmgplayer(amount);
}
setTimer(0.05):

the random thing is like if the player hit's or misses the baddy.
That just looks weird with 'function' >_>
It would work wihtout 'function' <_<
__________________
Reply With Quote
  #3  
Old 01-07-2007, 07:49 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Chompy View Post
That just looks weird with 'function' >_>
It would work wihtout 'function' <_<
???
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 01-07-2007, 08:51 AM
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
yeah... i generally do

PHP Code:
function somefunction()
{
  if (
condition)
    
doanotherfunction();

You don't need to write 'function someFunction();' to call a function, just 'someFunction();

I think the original comment was about the fact excal had function wa****() inside a function ontimeout() ....

Last edited by Twinny; 01-07-2007 at 09:08 AM..
Reply With Quote
  #5  
Old 01-10-2007, 11:20 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Twinny View Post
yeah... i generally do
You don't need to write 'function someFunction();' to call a function, just 'someFunction();
you can do somefunction() if you have the function outside of the timeout but if you put the function in it you n eed function
__________________
Deep into the Darkness peering...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:35 AM.


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