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 12-01-2009, 01:54 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
Red face Flute (instrument)

Hi , im on my way to learn my self Scripting

and im gona start on my first script ever (an flute) !

but how shoud i start ?

and by the way i got an movment system so Disabledefmovment whoud maybe not work :S
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto

Last edited by Samposse; 12-01-2009 at 02:08 PM..
Reply With Quote
  #2  
Old 12-01-2009, 04:21 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
i guess you'll need onkeypressed()
and then put an animation in there, and a sound.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #3  
Old 12-01-2009, 05:53 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
yes i know that but can u post an Exsampl? ( like howt oscript the onKeypressed() thing=
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #4  
Old 12-01-2009, 05:58 PM
Rufus Rufus is offline
Registered User
Join Date: Jun 2004
Location: United Kingdom
Posts: 4,698
Rufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud of
Quote:
Originally Posted by Samposse View Post
yes i know that but can u post an Exsampl? ( like howt oscript the onKeypressed() thing=
There's an example here http://forums.graalonline.com/forums...55&postcount=9. You can find a lot of things if you use the search feature, and it will help you.
__________________
Quote:
Originally Posted by Loriel View Post
Seriously, you have ****-all for content and you're not exactly pulling in new developer talent, angling for prestigious titles should be your last concern.
Reply With Quote
  #5  
Old 12-01-2009, 06:15 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
oh , Thanks
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #6  
Old 12-01-2009, 06:17 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
PHP Code:
function onKeyPressed(keynamekeycode

  
// keyname(6) checks if the Grab button is pressed, default A on Qwerty. 
  
if (keyname == keyname(6).lower()) { 
    
// stuff 
  


but where do i type in what Key i shoud use to play ?

PHP Code:
function onKeyPressed(keynamekeycode

  
// keyname(6) checks if the Grab button is pressed, default A on Qwerty. 
  
if (keyname == keyname(h).lower()) { 
    
// stuff 
  


??
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #7  
Old 12-01-2009, 06:47 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
i normally use
PHP Code:
function onKeyPressed(code,key)
{
  if( 
key == "f")
  {
  }

but if i do it that way the script keeps looping if i hold the key down, and i think with the .lower that is stopped.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #8  
Old 12-01-2009, 08:23 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
ok i made one now but the Problem is that when i press a the button it playes but it dosnt stop playing :S , like i play 1 note 1 time and it plays that note until i play an other note ...

here's the script

PHP Code:
//Im not using GS2 here!

//#CLIENTSIDE

function onWeaponFired() {
if (!
flute){
setani idle,;
disabledefmovement();
disableweapons();
disableselectweapons();
disablepause();
disablemap();
set flute;
}}

if (
keypressed&&keydown(6)){
if (
flute){
enabledefmovement();
enableweapons();
enableselectweapons();
enablepause();
setani idle,;
unset 
flute;
}}

if (
keydown2(keycode(z),false)) {
if (
flute){
setani("delitto_flute-play1""");
}}

if (
keydown2(keycode(x),false)) {
if (
flute){
setani("delitto_flute-play2""");
}}

if (
keydown2(keycode(c),false)) {
if (
flute){
setani delitto_flute-play3,;
}}

if (
keydown2(keycode(j),false)) {
if (
flute){
setani delitto_flute-play4,;
}}

if (
keydown2(keycode(v),false)) {
if (
flute){
setani delitto_flute-play5,;
}}

if (
keydown2(keycode(b),false)) {
if (
flute){
setani delitto_flute-play6,;
}} 
all works but i wont it to only play an note in like 1 second
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #9  
Old 12-01-2009, 10:11 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
You're using a mix of GS1 and GS2.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #10  
Old 12-01-2009, 10:36 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Instead of having all those keydown2 calls, you can use if else or a switch statement instead.

PHP Code:
function onKeyPressed(code,key) {
  if( 
key == "f") {
    
// setani or do whatever
  
}
  else if (
key == "g") {
    
// setani or do whatever
  
}
  else if (
key == "h") {
    
// setani or do whatever
  
}

__________________
Quote:
Reply With Quote
  #11  
Old 12-02-2009, 12:21 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I've converted it to GS2 and fixed a couple of things; see the comments I left

PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
  if (! 
this.flute) { // the flute is off, so turn it on
    
setAni("idle"NULL);
    
disableDefMovement();
    
disableWeapons();
    
disableSelectWeapons();
    
disablePause();
    
disableMap();
    
    
this.flute true// 'set' and 'unset' are deprecated and no longer used
  
}
}

// like Jerret (fowlplay4) said, you can combine them in to one function

function onKeyPressed(codekey) {
  if (
this.flute) { // if the flute is on
    
if (keydown(6)) { // turn off the flute
      
enableDefMovement();
      
enableWeapons();
      
enableSelectWeapons();
      
enablePause();
      
enableMap();
      
      
this.flute false;
    } else if (
key == "z") {
      
setAni("delitto_flute-play1"NULL);
    } else if (
key == "x") {
      
setAni("delitto_flute-play2"NULL);
    } else if (
key == "c") {
      
setAni("delitto_flute-play3"NULL);
    } else if (
key == "j") {
      
setAni("delitto_flute-play4"NULL);
    } else if (
key == "v") {
      
setAni("delitto_flute-play5"NULL);
    } else if (
key == "b") {
      
setAni("delitto_flute-play6"NULL);
    }
  }

There are better ways to do this, but they're more complicated and would probably just make it even more confusing.

As for the problem of the sound repeating, that's in the GANI. Open up each of the GANI files in the GraalShop.exe program, and on the right side with the GANI attributes, change "SETBACKTO" to the name of the flute idle GANI. This way, when the GANI is over, it goes back to the normal animation and doesn't loop the sound.
__________________
Reply With Quote
  #12  
Old 12-02-2009, 05:02 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
Thank You So mutch ^it realy help'd me starting on Forums xD
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #13  
Old 12-03-2009, 11:27 AM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
ok my Flute is working Perfectly but its only one last problem, i need something to frezee the player while playing ...

disabledefmovment dont work ... :/
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #14  
Old 12-03-2009, 11:39 AM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
shoud i put something as this insted òf Disabledefmovment ?
PHP Code:
clientr.speed "0"
?
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #15  
Old 12-03-2009, 04:45 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You should quit double/triple posting.

I would add a flag such as.. client.disablemovement = true;

Then edit your movement system so it doesn't process movement if that flag is true, and please attempt to figure it out. I suspect you'll just post the movement script and have the forums do it for you yet again.
__________________
Quote:
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:04 AM.


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