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 12-23-2007, 12:08 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
replacing functions
(now we replace a already existing function)

a) replacing an npcs functions

(note that -HolyAddHere is an existant weapon that i have got on my char )

<script of any npc>
PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  (
"-HolyAddHere").cTest = function()
    {
    
player.chat "a";
    };
  (
"-HolyAddHere").callFunction"cTest" );
  } 
<script of -HolyAddHere>
PHP Code:
//#CLIENTSIDE
public function callFunctionfuncN )
  {
  (@ 
funcN)();
  }
  
function 
cTest()
  {
  
player.chat "b";
  } 
works with servside npcs too

b) replacing a standard graal function

k, lets say if you do setani( "meh", "" ); the player will say "meh"... impossible? nooo

<script of some npc>
PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  
this.setani = function( anianiparams )
    {
    
player.chat ani;
    };
  
setani"meh""" );
  } 
or from servside:
<script of some npcs>
PHP Code:
function onCreated()
  {
  
this.sendtorc = function( msg )
    {
    echo( 
"NPC-Serv wants to say:" msg );
    };
  
sendtorc"meh" );
  } 
Reply With Quote
  #2  
Old 12-23-2007, 12:08 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
2 separated timeouts(note that -System/Attack1 is a non-existant(it isnt a weapon, npc or anything else in rc/serv))

running both timeouts:
( in this case player saying "running timeout1" + sitting all the time )

PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  (
"-System/Attack1") = new TStaticVar();
  (
"-System/Attack1").onTimeout = function()
    {
    
player.chat "running timeout1";

    
setTimer0.05 );
    };
  (
"-System/Attack1").trigger"Timeout""" );
  
onTimeout();
  }
  
function 
onTimeout()
  {
    
setani"sit""" );
    
setTimer0.05 );
  } 
running only the main(in the npc itself)
( in this case player sitting all the time without saying "running timeout1" )

PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  (
"-System/Attack1") = new TStaticVar();
  (
"-System/Attack1").onTimeout = function()
    {
    
player.chat "running timeout1";
  
    
//setTimer( 0.05 );
    
};
  
//("-System/Attack1").trigger( "Timeout", "" );
  
onTimeout();
  }
  
function 
onTimeout()
  {
    
setani"sit""" );
    
setTimer0.05 );
  } 
running only the "sub" timeout:
(in this case player saying "running timeout1" without sitting all the time)

PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  (
"-System/Attack1") = new TStaticVar();
  (
"-System/Attack1").onTimeout = function()
    {
    
player.chat "running timeout1";
  
    
setTimer0.05 );
    };
  (
"-System/Attack1").trigger"Timeout""" );
  
//onTimeout();
  
}
  
function 
onTimeout()
  {
    
setani"sit""" );
    
setTimer0.05 );
  } 

Last edited by projectigi; 12-23-2007 at 04:32 PM..
Reply With Quote
  #3  
Old 12-23-2007, 03:21 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by projectigi View Post
french
Interesting ...
There could be practical uses for this, but I think for making them say "running timeout1" and sitting, you would be better off with something else
__________________
Reply With Quote
  #4  
Old 12-23-2007, 04:32 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
Quote:
Originally Posted by cbkbud View Post
Interesting ...
There could be practical uses for this, but I think for making them say "running timeout1" and sitting, you would be better off with something else
well it was just an example for how to do it xD
i'm kinda lazy and didnt wanna think of useful examples heh
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:40 PM.


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