Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   having trouble. (https://forums.graalonline.com/forums/showthread.php?t=80019)

Frankie 06-10-2008 01:58 AM

having trouble.
 
PHP Code:

with(putnpc2(this.x, this.y, "join newgas-" @ this.bombtype @ ";"))
{
  
this.time = random(30, 50);
  
this.owner2 = thiso.gasowner;
} 

if I try to view what this.gasowner is outside of with(putnpc2()) it's fine. but when I try to set a different string to it so it will transfer to the other class, it's not working. how can I fix this ?

xXziroXx 06-10-2008 02:02 AM

Quote:

Originally Posted by Frankie (Post 1395998)
PHP Code:

with(putnpc2(this.x, this.y, "join newgas-" @ this.bombtype @ ";"))
{
  
this.time = random(30, 50);
  
this.owner2 = thiso.gasowner;
} 

if I try to view what this.gasowner is outside of with(putnpc2()) it's fine. but when I try to set a different string to it so it will transfer to the other class, it's not working. how can I fix this ?

Personally, I think that way of doing it is ugly like hell. Try this, see if it works:

PHP Code:

temp.npc = putnpc2(this.x, this.y, "join(\"newgas-" @ this.bombtype @ "\");");
temp.npc.time = random(30, 50);
temp.npc.owner2 = this.gasowner; 


Frankie 06-10-2008 02:06 AM

I'm doing that, and it's still not working -.- damnit.

I see the problem

this.owner2 is trying to be read on the clientside. when I read it on the serverside it works fine.. I need to read it on clientside though in order to do what I'm trying to.

cbk1994 06-10-2008 03:56 AM

Since you already have it set up in temp.npc, just do this:

PHP Code:

temp.npc = putnpc( dx, dy, "" );
npc.join( "myclasslol" ); 

EDIT: I take that back, you don't have it setup like that, but you should ;o

Frankie 06-10-2008 02:08 PM

well, I just need to know how I can read the string clientside if it was set serverside :p

xXziroXx 06-10-2008 02:50 PM

Rough script.

PHP Code:

function onActionServerSide()
{
  if (
params[0] == "putNPC") {
    
temp.npc = putnpc2(this.x, this.y, "join(\"newgas-" @ this.bombtype @ "\");");
    
temp.npc.time = random(30, 50);
    
temp.npc.owner = this.gasowner;
    
temp.npc.attr[25] = this.gasowner;
  }
} 

Then in the class...

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
chat = "My owner [" SPC attr[25] SPC "]";
} 


Frankie 06-10-2008 05:29 PM

ahh. it worked. thank you

xXziroXx 06-10-2008 05:53 PM

Quote:

Originally Posted by Frankie (Post 1396154)
ahh. it worked. thank you

:)

I'd probably do something like this though:

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
this.owner = attr[25]; // string > attr, 4sho
  
chat = "My owner [" SPC this.owner SPC "]";
} 



All times are GMT +2. The time now is 04:23 AM.

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