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 11-14-2002, 10:26 AM
Twusk Twusk is offline
o.O
Join Date: Jun 2002
Location: California, USA
Posts: 57
Twusk is on a distinguished road
Send a message via AIM to Twusk
Passing variables to classes...

Alright, here's my problem...
I'm using a weapon with putnpc2 that is a "join class;" but I want to pass a variable to that class from the weapon, I know you can pass the variable from a weapon to putnpc2 through via
NPC Code:

putnpc2 x,y,{ message #v(this.test); join class; };
with (npcs[npcscount-1]) { this.test=3; }


but that variable (this.test) doesn't pass onto the class... and I want to know I can pass that variable onto the class. Can that be done?
__________________
</Twusk>
Reply With Quote
  #2  
Old 11-14-2002, 01:36 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
its doing the message #v(this.test) before you even set the this.test variable

NPC Code:

putnpc2 x,y,{
if(done){
message #v(this.test);
join class;
}
}
with(npcs[npcscount-1]){
this.test = 3;
callnpc npcscount-1,done;
}



might work or just try setting this.test on the putnpc2 part?

Last edited by Python523; 11-15-2002 at 06:29 AM..
Reply With Quote
  #3  
Old 11-15-2002, 07:12 AM
Twusk Twusk is offline
o.O
Join Date: Jun 2002
Location: California, USA
Posts: 57
Twusk is on a distinguished road
Send a message via AIM to Twusk
Quote:
Originally posted by Python523
its doing the message #v(this.test) before you even set the this.test variable

might work or just try setting this.test on the putnpc2 part?
Tried both, neither work. And actually that message #v(this.test) part would work, my problem is sending the variable to the class, I don't believe it has to do with time, it's just not going through. I guess you can't send variables to classes :/
__________________
</Twusk>
Reply With Quote
  #4  
Old 11-15-2002, 07:42 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
post teh class
Reply With Quote
  #5  
Old 11-15-2002, 10:18 AM
Twusk Twusk is offline
o.O
Join Date: Jun 2002
Location: California, USA
Posts: 57
Twusk is on a distinguished road
Send a message via AIM to Twusk
Ok, here's the basic of what I have...

WEAPON:
NPC Code:

if (actionserverside) {
putnpc2 playerx,playery,{join class;};
with (npcs[npcscount-1]) { this.test=3; }
}
//#CLIENTSIDE
if (weaponfired) { triggeraction 0,0,serverside,weapon; }



CLASS:
NPC Code:

//#CLIENTSIDE
if (created) { message #v(this.test); }



That's not my actual script, it's much longer, but you get the idea, that still won't work.
__________________
</Twusk>
Reply With Quote
  #6  
Old 11-15-2002, 10:37 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
normal vars set serverside cant be accessed clientside, use a save var for your script ( save[0] = 3 )
Reply With Quote
  #7  
Old 11-15-2002, 01:36 PM
Twusk Twusk is offline
o.O
Join Date: Jun 2002
Location: California, USA
Posts: 57
Twusk is on a distinguished road
Send a message via AIM to Twusk
Quote:
Originally posted by Python523
normal vars set serverside cant be accessed clientside, use a save var for your script ( save[0] = 3 )
Ahh, thank you...
__________________
</Twusk>
Reply With Quote
  #8  
Old 11-15-2002, 07:05 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Why do you need to do it clientside at all?
The class you posted would be fine serverside.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #9  
Old 11-16-2002, 07:19 AM
Twusk Twusk is offline
o.O
Join Date: Jun 2002
Location: California, USA
Posts: 57
Twusk is on a distinguished road
Send a message via AIM to Twusk
Quote:
Originally posted by Com013
Why do you need to do it clientside at all?
The class you posted would be fine serverside.
I knew someone was going to say that... that was just an example, my real class is much longer and has a timeout of .05, that's why it needs to be clientside
__________________
</Twusk>
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 04:01 PM.


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