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 09-18-2005, 07:17 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
Gralats class...

NPC Code:

if (created) {
setshape 1,32,32;
showcharacter;
//dontblock;
updategani();
}

if (updategani) {
updategani();
}

function updategani() {
type = 1;
//if (rupees>=350) type = 5;
//else
if (rupees>=100) type = 4;
else if (rupees>=30) type = 3;
else if (rupees>=5) type = 2;
setcharani gralats,#v(type);
}

if (rupees>1 || playerenters){
setcharprop #c,#v(rupees);
}


if (playertouchsme) {
playerrupees += rupees;
rupees = 0;
destroy;
}




This works for me.
The part I am having a problem with is this:
NPC Code:

if (rupees>1 || playerenters){
setcharprop #c,#v(rupees);
sleep 5;
setcharprop #c,;
}


That will show the amount of gralats that are there, and it will stop showing after .5 seconds, but it won't let the player pick them up anymore. Can anyone tell me why?
__________________
torankusu's
Reply With Quote
  #2  
Old 09-18-2005, 07:25 AM
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 Torankusu_2002
The part I am having a problem with is this:
NPC Code:

if (rupees>1 || playerenters){
setcharprop #c,#v(rupees);
sleep 5;
setcharprop #c,;
}


That will show the amount of gralats that are there, and it will stop showing after .5 seconds, but it won't let the player pick them up anymore. Can anyone tell me why?
rupees>1 is not an event and it is being checked outside of an event block. Perhaps you meant to and those two conditions together instead of or them?
Reply With Quote
  #3  
Old 09-18-2005, 07:33 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
Quote:
Originally Posted by Lance
rupees>1 is not an event and it is being checked outside of an event block. Perhaps you meant to and those two conditions together instead of or them?
I don't understand what you mean? With the first class script I posted (without the sleep, etc), if the player drops a gralat and there is only 1 gralat there, it doesn't display anything, but can be picked up. If you put more than one gralat there (2,5,etc), then it shows how much.

I want that text to show and after 5 seconds disappear, but also show if the player enters, and then disappear.

hold on, playing around with it.

Okay, got it to work.

NPC Code:



if (created) {
setshape 1,32,32;
showcharacter;
//dontblock;

updategani();

}

if (updategani) {

updategani();
setcharprop #c,#v(rupees);
sleep 5;
setcharprop #c,;

}

__________________
torankusu's
Reply With Quote
  #4  
Old 09-18-2005, 07:39 AM
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 Torankusu_2002
I don't understand what you mean? With the first class script I posted (without the sleep, etc), if the player drops a gralat and there is only 1 gralat there, it doesn't display anything, but can be picked up. If you put more than one gralat there (2,5,etc), then it shows how much.
The way you had it structured, you were checking a condition outside of an event block (Not Good). See: this thread for more information.

Quote:
I want that text to show and after 5 seconds disappear, but also show if the player enters, and then disappear.

hold on, playing around with it.
A timeout might be better than a sleep for this.
Reply With Quote
  #5  
Old 09-19-2005, 07:32 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Quote:
Originally Posted by Lance
A timeout might be better than a sleep for this.
good habit to get into. v4 doesn't like sleeps in loops.
__________________
Reply With Quote
  #6  
Old 09-19-2005, 09:35 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Not too sure, but which one would be better here:
message #v(rupees); ?
setcharprop #c,#v(rupees);
not too sure, can someone answer this question and say why.
__________________
Reply With Quote
  #7  
Old 09-19-2005, 07:53 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
setcharprop would be the optimal choice in this case becase the npc is a showcharacter.
if it were a normal npc (non-gani), then setcharprop would do nothing.
__________________
Reply With Quote
  #8  
Old 09-19-2005, 07:54 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by calani
setcharprop would be the optimal choice in this case becase the npc is a showcharacter.
if it were a normal npc (non-gani), then setcharprop would do nothing.
Optimal choice?
__________________
Skyld
Reply With Quote
  #9  
Old 09-19-2005, 07:57 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
as in 'better of the two,' 'perferred,' 'best,' etc.
__________________
Reply With Quote
  #10  
Old 09-19-2005, 08:22 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by calani
as in 'better of the two,' 'perferred,' 'best,' etc.
Is there any valid reason to prefer it? I'm not sure "because it's showcharacter;" is really a valid reason.
__________________
Skyld
Reply With Quote
  #11  
Old 09-20-2005, 02:31 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Quote:
Originally Posted by Skyld
Is there any valid reason to prefer it? I'm not sure "because it's showcharacter;" is really a valid reason.
For my scripts, setcharprop on an NPC without calling showcharacter, even if the prop is #c, does absolutely nothing. That's why it would be better to use message() instead, so it works regardless of the NPC being a showcharacter.

Although this thing might have been fixed!

Edit: Reverse what I just said, for the reason I just stated. <3 (Use setcharprop #c)
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight

Last edited by ForgottenLegacy; 09-21-2005 at 12:21 AM..
Reply With Quote
  #12  
Old 09-20-2005, 04:10 AM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by ForgottenLegacy
For my scripts, setcharprop on an NPC without calling showcharacter, even if the prop is #c, does absolutely nothing. That's why it would be better to use message() instead, so it works regardless of the NPC being a showcharacter.

Although this thing might have been fixed!
But showcharacter is being called here, so why not use it.
__________________
Liek omigosh.

Reply With Quote
  #13  
Old 09-20-2005, 01:14 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
That's cool. Thanks
__________________
Reply With Quote
  #14  
Old 09-20-2005, 07:01 PM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
not trying to be a ****, but i took the old graal2001 gralats class which was probably scripted by stefan, so ask him?
__________________
torankusu's
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 05:58 PM.


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