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 05-28-2006, 06:47 PM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Variables problem

I got a particle script from a friend to learn but I coudnt put it in the level right. I got it actualy to appear in the level (the script is a class) but I cant get the x to appear at this.smokex and this.smokey even though in the script I have it set to be there.
NPC Code:
// NPC made by Irata
if (created){
this.smokex=x;
this.smokey=y;
}
join smoketest;



and in the particle script I use
NPC Code:
if (created||timeout){
with (findimg(200)){
x=this.smokex;
y=this.smokey;
}


timeout=0.05;
}
__________________

Last edited by wild8900; 05-28-2006 at 09:40 PM..
Reply With Quote
  #2  
Old 05-29-2006, 01:09 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
PHP Code:
with (findimg(200)){
x=this.smokex;
y=this.smokey;

You need to use thiso. if you're in a with() block.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 05-29-2006, 01:37 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
I just put that but it didnt work.
PHP Code:
if (created||timeout){
  
with (findimg(200)) {
  
x=thiso.smokex;
  
y=thiso.smokey;
    }
    
timeout=0.05;

Im guessing its reading the var wrong from the basic script with join in it.
PHP Code:
if (created){
this.smokex=x;
this.smokey=y;
}
join smoketest
This is the basic object (in the level)
__________________
Reply With Quote
  #4  
Old 05-29-2006, 06:29 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
do you have attachtoowner set in the particle? and what layer are you using for the particles? If you're using 4+ (I believe) they are screen coordinates and not level coordinates.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 05-29-2006, 09:25 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
this is all I used in the object in the level:
PHP Code:
if (created){
this.smokex=x;
this.smokey=y;
}
join smoketest
i used attachtoowner just now. Didnt work.
And the layer is 2
__________________
Reply With Quote
  #6  
Old 05-29-2006, 10:07 AM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
PHP Code:
if (created){ 
thiso.smokex=x
thiso.smokey=y


You have to set thiso.smokex and thiso.smokey which is compeletely different from this.smokex and this.smokey.
__________________


CAUTION
Reply With Quote
  #7  
Old 05-29-2006, 04:35 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by wild8900
this is all I used in the object in the level:
PHP Code:
if (created){
this.smokex=x;
this.smokey=y;
}
join smoketest
i used attachtoowner just now. Didnt work.
And the layer is 2
Could I see some of the particle modifyer code? Perhaps you are using some kind of static x and y modification in the code, and are not relying on the position of the NPC.


Quote:
Originally Posted by Luigi203
PHP Code:
if (created){ 
thiso.smokex=x
thiso.smokey=y


You have to set thiso.smokex and thiso.smokey which is compeletely different from this.smokex and this.smokey.
.. thiso. is used to access this. variables in the parent.

PHP Code:
function onCreated() {
  
this.test "Weee";

  
with(findNPC("SomeDB-NPC")) {
    
this.blah thiso.test;
  }

this.blah in SomeDB-NPC will now contain "Weee"

Please do not post advice if you don't know what you're talking about.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 01:39 AM.


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