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 01-29-2005, 12:49 PM
Methril Methril is offline
Registered User
Join Date: Jan 2005
Posts: 237
Methril is on a distinguished road
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
Reply With Quote
  #2  
Old 01-29-2005, 12:53 PM
Arkan1k Arkan1k is offline
Delph
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 35
Arkan1k is on a distinguished road
Send a message via AIM to Arkan1k Send a message via MSN to Arkan1k
Spot the difference:

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

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

__________________
[ Delph ]
Reply With Quote
  #3  
Old 01-29-2005, 01:38 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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.
Reply With Quote
  #4  
Old 01-29-2005, 02:56 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
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
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #5  
Old 01-29-2005, 03:09 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________

Last edited by Kaimetsu; 01-29-2005 at 04:04 PM.. Reason: clarification
Reply With Quote
  #6  
Old 01-29-2005, 07:55 PM
Methril Methril is offline
Registered User
Join Date: Jan 2005
Posts: 237
Methril is on a distinguished road
This should work regardless of anything else, should it not?

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

Reply With Quote
  #7  
Old 01-29-2005, 10:55 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Arrow

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.
Reply With Quote
  #8  
Old 01-29-2005, 11:57 PM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
canbecarried will not work online, anyway

x.x
__________________

Reply With Quote
  #9  
Old 01-30-2005, 04:10 AM
DarkShadows_Legend DarkShadows_Legend is offline
Cult of the Winky
DarkShadows_Legend's Avatar
Join Date: Apr 2003
Location: Florida
Posts: 614
DarkShadows_Legend is on a distinguished road
Send a message via AIM to DarkShadows_Legend
NPC Code:

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



This worked online when I tested it.

The event wasthrown doesn't work serverside though.
__________________
- Criminal X

"I rather be hated for being myself, than be liked for being what you like best. I go above the influence, not under." - Me
Reply With Quote
  #10  
Old 01-30-2005, 05:38 AM
Methril Methril is offline
Registered User
Join Date: Jan 2005
Posts: 237
Methril is on a distinguished road
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?
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 02:36 PM.


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