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-22-2006, 12:56 AM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Instrument trouble...

Now, this has to be the easiest script, and I seem to be having a minor issue with it. The sounds don't seem to be playing when I press the corresponding keys, the sounds all work, I am unsure if I am overlooking something, or what.

NPC Code:
//#CLIENTSIDE
if (weaponfired) {
setani anzell_flute,anzell-flute.png;
disabledefmovement;
}
if (strequals(#m,anzell_flute)) {
if (keydown(6)) enabledefmovement;
if (keydown(5)) {
if (keydown(0)) play fire2.wav;
elseif (keydown(1)) play flute2.wav;
elseif (keydown(2)) play flute3.wav;
elseif (keydown(3)) play flute4.wav;
} else {
if (keydown(0)) play flute5.wav;
elseif (keydown(1)) play flute6.wav;
elseif (keydown(2)) play flute7.wav;
elseif (keydown(3)) play flute8.wav;
}
}



If anyone has any suggestions on a better script, notify me...XD
__________________

Reply With Quote
  #2  
Old 01-22-2006, 12:58 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
Please read this thread and stop putting code outside of event blocks.
Reply With Quote
  #3  
Old 01-22-2006, 01:03 AM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
O_o Uhh, I still don't see what that's supposed to be telling me about the event block O_o
__________________

Reply With Quote
  #4  
Old 01-22-2006, 01:04 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 RavenofEarth
O_o Uhh, I still don't see what that's supposed to be telling me about the event block O_o
You didn't read the thread. Please try again.

Pay special attention to the definitions of "code block", "event block", and Kai's Rule One.
Reply With Quote
  #5  
Old 01-22-2006, 01:09 AM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Uh, I read the thread...Yet, I am still confuzzled about what it's trying to convey.
__________________

Reply With Quote
  #6  
Old 01-22-2006, 01:14 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 RavenofEarth
Uh, I read the thread...Yet, I am still confuzzled about what it's trying to convey.
What part of those I referenced do you not understand?
Reply With Quote
  #7  
Old 01-22-2006, 01:43 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally Posted by RavenofEarth
O_o Uhh, I still don't see what that's supposed to be telling me about the event block O_o
The problem is that everything after the 'weaponfired' block in your script is not in an event block, so Graal is not sure when it is supposed to check if your gani is set to anzell_flute or if a certain key is being pressed; maybe it should check when it detects that any key has been pressed, or maybe it should check when you type some words in the chat box. Perhaps you want it to check if the 'up' key is pressed when the United States decides to adopt Graal's Terms of Service as its new constitution; nobody knows when it should check, because you have not specified any event that tells it when.

Events are things that can happen, like the weapon being fired (weaponfired), the npc being touched (playertouchsme), or a timeout occuring (you could set timeout = .05, and .05 seconds later the "timeout" event occurs); there are many others. In your case, you probably want to use the 'timeout' or 'keypressed' events (keypressed might only work in v4 for what you want it to do, I don't think v2 will call keypressed for the arrow keys).
__________________

Reply With Quote
  #8  
Old 01-22-2006, 02:18 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Style your scripts.
You should use a gani that plays the sound, instead of the 'play' command.
The 'play' command only plays the sound to you, not other players.
Using a gani will play the sound for everyone.

PHP Code:
if (event) {
  
command;
  
command;
  if (
condition) {
    
command;
    
command;
  }

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 03:48 PM.


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