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 06-02-2007, 05:50 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
Archetypes with Gani Script

I have a gani script and I'm trying to load archetype variables. But it doesn't work.

PHP Code:
SCRIPT
function onCreated() {
  
this.baddyname "Default";
  
getBaddy();
  
onTimeOut();
}

function 
getBaddy() {
  
this.baddy.loadVars(
  
format("archetypes/baddies/%s.arc"this.baddyname));  
}

function 
onTimeOut() {
  
showtextthis.indexthis.x+2this.y+3,"Verdana""c",
    
this.baddy.nick);
  
showtextthis.index+1this.x+2this.y,"Verdana""c",
    
this.baddy.hp "/" this.baddy.fullhp);

  
changeimgzoomthis.index0.75);
  
changeimgzoomthis.index+10.75); 
     
if (
this.baddy.hp this.baddy.hp/3
  
changeimgcolorsthis.index+10100.99);
if (
this.baddy.hp this.baddy.hp/3)
  
changeimgcolorsthis.index+11100.99);
if (
this.baddy.hp this.baddy.hp/6)
  
changeimgcolorsthis.index+11000.99); 

if (
this.baddy.aggressor == 0changeimgcolorsthis.index0110.99); 
if (
this.baddy.aggressor == 1changeimgcolorsthis.index1100.99); 
if (
this.baddy.aggressor == 2changeimgcolorsthis.index1000.99); 

setTimer(0.05);
}
SCRIPTEND 
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 06-02-2007, 06:23 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I don't work with ganis often, but I believe they're clientside? x.x
__________________
Reply With Quote
  #3  
Old 06-02-2007, 06:30 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 Inverness View Post
I don't work with ganis often, but I believe they're clientside? x.x
Tried, also if so how would I load the vars.
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 06-02-2007, 06:41 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Angel_Light View Post
Tried, also if so how would I load the vars.
Uh, they're automatically clientside even without the //#CLIENTSIDE thingy in the script. You would need to use player attributes or gani params I believe. Like I said, don't work with ganis often.
__________________
Reply With Quote
  #5  
Old 06-02-2007, 11:25 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
You can't load serverside variables clientside... You can't display clientside showimg's serverside.

When you create the object (gani), leave 0.05 seconds for the attributes / params to work.
Reply With Quote
  #6  
Old 06-02-2007, 11:31 AM
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
Since you can't load serverside vars clientside, I'd suggest making a frame class then using a function that uses with() on a putnpc2 to set the baddy name an any other variables prior to it's creation.

Also another serverside function for getting the baddy information would be good. Public is preferable.
__________________


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
  #7  
Old 06-02-2007, 04:33 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You could use this script for calling serverside functions from the gani, I haven't tested it with ganis, but it is an object so it should work the same.
You would need to use serverFunction() since the second one doesn't wait for a return. Recommend placing this script in a weapon called System or something, it looks the coolest like that.
PHP Code:
public function waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyClient(objenametime) {
  
triggerClient("gui"name"notify"objenametime);
}
public function 
notifyServer(objenametime) {
  
scheduleEvent(0"ActionServerSide"objenametime);
}
public function 
clientFunction(fobjfnamefparams) {
  
temp.out 0;
  
  
client.temp.(@ "clientfunction_" fname) = null;
  
triggerClient("gui"name"clientfunction"fnamefparamsfobj);
  
waitForNotify(name"ClientFunctionEnd"5);
  
out client.temp.(@ "clientfunction_" fname);
  
client.temp.(@ "clientfunction_" fname) = null;
  return 
out;
}
public function 
clientFunction2(fobjfnamefparams) {
  
triggerClient("gui"name"clientfunction"fnamefparamsfobj);
}
function 
onActionServerSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"serverfunction":
      
temp.0;
      
temp.fn params[1];
      
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "serverfunction_" fn) = r;
      
notifyClient(name"ServerFunctionEnd"0);
      break;
    case 
"serverfunction2":
      if (
params[3] != null)
         
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      break;
  }
}
//#CLIENTSIDE
function onActionClientSide() {
  switch (
params[0]) {
    case 
"notify":
      
makevar(params[1]).scheduleEvent(params[3], "Notify" params[2], null);
      break;
    case 
"clientfunction":
      
temp.0;
      
temp.fn params[1];
      
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      
client.temp.(@ "clientfunction_" fn) = r;
      
notifyServer(name"ClientFunctionEnd"0);
      break;
    case 
"clientfunction2":
      if (
params[3] != null)
        
makevar(params[3] @ "." params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
      else 
        
makevar(params[1])(params[2][0], params[2][1], params[2][2], params[2][3], params[2][4], params[2][5]);
  }
}
public function 
waitForNotify(objactiontime) {
  return 
waitfor(obj"Notify" actiontime);
}
public function 
notifyServer(objenametime) {
  
triggerServer("gui"name"notify"objenametime);
}
public function 
notifyClient(objenametime) {
  
scheduleEvent(0"ActionClientSide""notify"objenametime);
}
public function 
serverFunction(fobjfnamefparams) {
  
temp.out 0;
  
  
client.temp.(@ "serverfunction_" fname) = null;
  
triggerServer("gui"name"serverfunction"fnamefparamsfobj);
  
waitForNotify(name"ServerFunctionEnd"5);
  
out client.temp.(@ "serverfunction_" fname);
  
client.temp.(@ "serverfunction_" fname) = null;
  return 
out;
}
public function 
serverFunction2(fobjfnamefparams) {
  
triggerServer("gui"name"serverfunction2"fnamefparamsfobj);

__________________
Reply With Quote
  #8  
Old 06-02-2007, 05:57 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
i tried it with params and with attr, and I had no luck here's what I did both times.

params try:

in the class part:
PHP Code:
  setcharani"nir_baddy_idle"this.baddy.nick
               
this.baddy.hpthis.baddy.fullhp,
               
this.baddy.aggressor); 
In the gani this:
PHP Code:
SCRIPT
function onCreated() onTimeOut();

function 
onTimeOut() {
  
showtextthis.indexthis.x+2this.y+3,"Verdana""c",
    
params[0]);
  
showtextthis.index+1this.x+2this.y,"Verdana""c",
    
params[1] @ "/" params[2]);

  
changeimgzoomthis.index0.75);
  
changeimgzoomthis.index+10.75); 
     
if (
params[1] > params[1]/3
  
changeimgcolorsthis.index+10100.99);
if (
params[1] < params[1]/3)
  
changeimgcolorsthis.index+11100.99);
if (
params[1] < params[1]/6)
  
changeimgcolorsthis.index+11000.99); 

if (
params[3] == 0changeimgcolorsthis.index0110.99); 
if (
params[3] == 1changeimgcolorsthis.index1100.99); 
if (
params[3] == 2changeimgcolorsthis.index1000.99); 

setTimer(0.05);
}
SCRIPTEND 
in the attr try I did this

class part:
PHP Code:
    thiso.attr[1] = this.baddy.nick
  
thiso.attr[2] = this.baddy.hp
  
thiso.attr[3] = this.baddy.fullhp;
  
thiso.attr[4] = this.baddy.aggressor
Gani:
PHP Code:
SCRIPT
function onCreated() onTimeOut();

function 
onTimeOut() {
  
showtextthis.indexthis.x+2this.y+3,"Verdana""c",
    
thiso.attr[1]);
  
showtextthis.index+1this.x+2this.y,"Verdana""c",
    
thiso.attr[2] @ "/" thiso.attr[3]);

  
changeimgzoomthis.index0.75);
  
changeimgzoomthis.index+10.75); 
     
if (
thiso.attr[2] > thiso.attr[2]/3
  
changeimgcolorsthis.index+10100.99);
if (
thiso.attr[2] < thiso.attr[2]/3)
  
changeimgcolorsthis.index+11100.99);
if (
thiso.attr[2] < thiso.attr[2]/6)
  
changeimgcolorsthis.index+11000.99); 

if (
thiso.attr[4] == 0changeimgcolorsthis.index0110.99); 
if (
thiso.attr[4] == 1changeimgcolorsthis.index1100.99); 
if (
thiso.attr[4] == 2changeimgcolorsthis.index1000.99); 

setTimer(0.05);
}
SCRIPTEND 
__________________
Deep into the Darkness peering...
Reply With Quote
  #9  
Old 06-02-2007, 06:04 PM
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
I would use Inverness' method
__________________
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:13 PM.


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