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 07-21-2001, 05:32 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
Unhappy Needs help with keydown

To start out this post...I suck at scripting!!!
I was making the starting movement for a race and I couldn't make it so that the player stops using walk.gani and uses idle.gani when the player isn't moving. Right now the player just moves all the time.
Here's the script, could you help me out(i added the onwall incase that may be of any good use)?:
if (playertouchsme) {
toweapons System;
disabledefmovement;
timeout=0.05;}
if (timeout) {
if (keydown(0)){
playerdir = 0;
playery-=0.5;
setani walkslow,;
}
if (keydown(1)){
playerdir = 1;
playerx-=0.5;
setani walkslow,;
}
if (keydown(2)){
playerdir = 2;
playery+=0.5;
setani walkslow,;
timeout=0.05;
}
if (keydown(3)){
playerdir = 3;
playerx+=0.5;
setani walkslow,;
}
timeout=0.05;
//left detection
if (onwall(playerx+0.5,playery+1.5)) {playerx+=0.5}
if (onwall(playerx+0.5,playery+2)){playerx+=0.5}

//right detection
if (onwall(playerx+2,playery+1.5)) {playerx-=0.5}
if (onwall(playerx+2,playery+2)) {playerx-=0.5}

//down detection
if (onwall(playerx+0.5,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1.5,playery+2.5)) {playery-=0.5}

//up detection
if (onwall(playerx+0.5,playery+1)) {playery+=0.5}
if (onwall(playerx+1,playery+1)) {playery+=0.5}
if (onwall(playerx+1.5,playery+1)) {playery+=0.5}
Reply With Quote
  #2  
Old 07-21-2001, 05:35 PM
NeoNPL NeoNPL is offline
HONEY IM HOME!
NeoNPL's Avatar
Join Date: Jun 2001
Location: Mianus
Posts: 1,361
NeoNPL is on a distinguished road
Send a message via Yahoo to NeoNPL
Ok whats it supposed to do if u post the ganis ill look at it offline and see the problem
Reply With Quote
  #3  
Old 07-21-2001, 05:50 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
for (i=0; i<4; i++) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
I dunno if that would work, but it should.
*is pretty sure there is a very obvious mistake in there*
Reply With Quote
  #4  
Old 07-21-2001, 06:02 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
It's not working =(
I checked it in the editor and it says for the part,
----
for (i=0; i<4; i++) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
----
"Error: Expected format: if (flag) command;"
<edited>
for (i=0; i<4; i++)) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
//he forgot the extra ) after the for part

Last edited by Jerom; 07-21-2001 at 07:16 PM..
Reply With Quote
  #5  
Old 07-21-2001, 07:48 PM
Merlin2 Merlin2 is offline
Registered User
Join Date: Jun 2001
Location: I am a faggot.
Posts: 374
Merlin2 is on a distinguished road
Quote:
Originally posted by Jerom
It's not working =(
I checked it in the editor and it says for the part,
----
for (i=0; i<4; i++) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
----
"Error: Expected format: if (flag) command;"
<edited>
for (i=0; i<4; i++)) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
//he forgot the extra ) after the for part

I'll help, but I want off ignore
timeout=.50;
if (playertouchsme) {
toweapons System;
disabledefmovement;
timeout=0.05;}
if (timeout) {
if (keydown(0)){
playerdir = 0;
playery-=0.5;
setani walkslow,;
}
if (keydown(1)){
playerdir = 1;
playerx-=0.5;
setani walkslow,;
}
if (keydown(2)){
playerdir = 2;
playery+=0.5;
setani walkslow,;
timeout=0.05;
}
if (keydown(3)){
playerdir = 3;
playerx+=0.5;
setani walkslow,;
}
timeout=0.05;
//left detection
if (onwall(playerx+0.5,playery+1.5)) {playerx+=0.5}
if (onwall(playerx+0.5,playery+2)){playerx+=0.5}

//right detection
if (onwall(playerx+2,playery+1.5)) {playerx-=0.5}
if (onwall(playerx+2,playery+2)) {playerx-=0.5}

//down detection
if (onwall(playerx+0.5,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1.5,playery+2.5)) {playery-=0.5}

//up detection
if (onwall(playerx+0.5,playery+1)) {playery+=0.5}
if (onwall(playerx+1,playery+1)) {playery+=0.5}
if (onwall(playerx+1.5,playery+1)) {playery+=0.5}


You've been cursed with darklink wub.

What I done was added "timeout=.50" at top, hehehehe. It should work >.<
__________________
Hi. I am merlin, I own you because I am level 3 RC and I have the powers to reset you. I will scam you, and I will PK you. But do not worry, I will act mature and make you think I am ***. I am Merlin.

Message from DarkLink:
Merlin, you can have your account. It sucks anyway, all I have done for you. I've helped you with your stupid playerworld, I've gave you FTP after you sat and begged forever for it. Maybe you should grow up? You act like a ten year old, you're a *****.

This also goes to Tyne, who thinks "Providence" is the best because he can script in a language which is really ***, called GScript...

Grow up, get a life.
Reply With Quote
  #6  
Old 07-21-2001, 08:23 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
I already had a timeout set:timeout = 0.05
I've used some stuff Loriel's given me. I just need to find out where to use it and what else to add.
Reply With Quote
  #7  
Old 07-22-2001, 12:19 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
the problem with loriel's is after the if (keydown(0)
theres only one ")" and there needs to be 2
if (keydown(0)) i think
Reply With Quote
  #8  
Old 07-22-2001, 02:19 AM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
Quote:
Originally posted by Jerom
It's not working =(
I checked it in the editor and it says for the part,
----
for (i=0; i<4; i++) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
----
"Error: Expected format: if (flag) command;"
<edited>
for (i=0; i<4; i++)) {
if (keydown(i) {
setani walkslow,;
break;
} else
setani idle,;
}
//he forgot the extra ) after the for part
I already pointed that out in the post above. Loriel even told me in a PM he forgot that when i told him it didn't work.
Reply With Quote
  #9  
Old 07-22-2001, 04:11 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
hummmm

if you intend to have your player world non p2p you can't have different races, you could try using replaceani and screw keydown and all that, replaceani needs a p2p server though
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #10  
Old 07-22-2001, 02:13 PM
Guest
Posts: n/a
use while true...
Reply With Quote
  #11  
Old 07-22-2001, 05:53 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by IcePick_2001
use while true...
Hi, using while (true) would mean that you can't use that system NPC in combination with triggeraction anymore, bye.
__________________

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:14 AM.


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