Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Specific flag from specific carried npc (https://forums.graalonline.com/forums/showthread.php?t=57366)

Methril 01-29-2005 12:49 PM

Specific flag from specific carried npc
 
Hello ^^

I want to make this npc set a flag when it is moved out of place and then unset it when it is returned back. Some help would be appreciated. What am I doing wrong?

Thanks

PHP Code:

if(created){
  
canbecarried;
  
x=40;
  
y=23.5;
}

if (!
x=40 && !y=23.5){
  
set Carried;
}

if(
wasthrown){
  
x=40;
  
y=23.5;
  unset 
Carried


Arkan1k 01-29-2005 12:53 PM

Spot the difference:

NPC Code:
if (!x=40 && !y=23.5){
set Carried;
}

if (x!=40 && y!=23.5){
set Carried;
}


Lance 01-29-2005 01:38 PM

Quote:

Originally Posted by Methril
Hello ^^

I want to make this npc set a flag when it is moved out of place and then unset it when it is returned back. Some help would be appreciated. What am I doing wrong?

Thanks

Read KSI-GS.

Your middle code block is not an event block. If you want to have such a variable check, do it in a timeout.

HoudiniMan 01-29-2005 02:56 PM

Quote:

Originally Posted by Arkan1k
Spot the difference:

NPC Code:
if (!x=40 && !y=23.5){
set Carried;
}

if (x!=40 && y!=23.5){
set Carried;
}


Not sure if != operator is supported by graal, but you can also say !x==40, note the two ='s

Either may work

Kaimetsu 01-29-2005 03:09 PM

Quote:

Originally Posted by HoudiniMan
Not sure if != operator is supported by graal, but you can also say !x==40

Please read the scripting forum rules. Especially item four.

Methril 01-29-2005 07:55 PM

This should work regardless of anything else, should it not?

PHP Code:

if (x!=40 && y!=23.5){
  
set Carried;



Lance 01-29-2005 10:55 PM

Quote:

Originally Posted by Methril
This should work regardless of anything else, should it not?

PHP Code:

if (x!=40 && y!=23.5){
  
set Carried;



Again: that's a conditional statement, not an event block. You would need to create a timeout loop to check those conditions every certain amount of time. Otherwise, they aren't evaluated except:

1) When the NPC is created
2) When it receives another event

This is certainly not the behavior you want. Create a timeout loop.

Evil_Trunks 01-29-2005 11:57 PM

canbecarried will not work online, anyway

x.x

DarkShadows_Legend 01-30-2005 04:10 AM

NPC Code:

if ( created ) {
setimg block.png;
canbecarried;
}



This worked online when I tested it.

The event wasthrown doesn't work serverside though.

Methril 01-30-2005 05:38 AM

Thank you for all of the information everyone. This NPC was going to be for a store where you pickup the item and talk to the shopkeeper to buy it. The wasthrown part was so that if you threw it it would go back to x y on the shelf. I also had it so that the shopkeeper would choose a random scolding to give you when you tried to walk out with his item without paying. ^^

I'm now thinking that a clickable store and buy button would be much better, as I have already made clickable things work offline. Quickly, is there anything I should know about mouse scripting as per using it in online mode?


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

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