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 08-27-2005, 01:09 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Unhappy Car Trouble ~.~

I now that this car is not mine but I have made a car just like it and I was just wounlding how could I use a script to make it work? So I can drive about in graal editor, in my levels. ^.^
Attached Thumbnails
Click image for larger version

Name:	cyvic.png
Views:	170
Size:	8.0 KB
ID:	33208  
__________________
Reply With Quote
  #2  
Old 08-27-2005, 01:41 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
Use GANIs (setani), key detection (keypressed, keydown, keydown2), and some simple math.
__________________
Skyld
Reply With Quote
  #3  
Old 08-27-2005, 01:49 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Skyld
Use GANIs (setani), key detection (keypressed, keydown, keydown2), and some simple math.

Could it be posilbe if you counld give me an example with the math in it and all?
__________________
Reply With Quote
  #4  
Old 08-27-2005, 02:33 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
Well, I don't know how you want your car to work.

Do you want it to work around a full 360 degrees, or just the four directions (up, down, left and right)?
__________________
Skyld
Reply With Quote
  #5  
Old 08-27-2005, 02:57 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Skyld
Well, I don't know how you want your car to work.

Do you want it to work around a full 360 degrees, or just the four directions (up, down, left and right)?
Just the four directions (up, down, left and right) will do.
__________________
Reply With Quote
  #6  
Old 08-27-2005, 03:02 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Here's a problem right off the bat:

Your car doesn't have transparency or depth. This means it will be invisible.
Reply With Quote
  #7  
Old 08-27-2005, 03:08 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Bl0nkt
Here's a problem right off the bat:

Your car doesn't have transparency or depth. This means it will be invisible.

Do you want to see my car that i made?
__________________
Reply With Quote
  #8  
Old 08-27-2005, 03:59 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 Foggy
Just the four directions (up, down, left and right) will do.
In which case, you simply need to use playerx and playery to manipulate movement, and playerdir to manipulate the direction. Most likely a timeout, too.
__________________
Skyld
Reply With Quote
  #9  
Old 08-27-2005, 04:51 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Skyld
In which case, you simply need to use playerx and playery to manipulate movement, and playerdir to manipulate the direction. Most likely a timeout, too.

Ok I have made a gani now what?
__________________
Reply With Quote
  #10  
Old 08-27-2005, 05:14 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 Foggy
Ok I have made a gani now what?
He just told you.
Reply With Quote
  #11  
Old 08-27-2005, 05:30 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Lance
He just told you.
Is this it then? And how do I make move and make sounds?

NPC Code:
// NPC made by FOGGY
if (created || timeout) {timeout=.05}
if (playersays(/in)) {this.mode=1;disabledefmovement;}
if (playersays(/out)) {this.mode=0;enabledefmovement}
if (timeout && this.mode=1) {
if (keydown(0)) {dir=0;if (!onwater(x+1.5,y+2)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+1.5,y+.7)) {y-=this.speed}}
if (keydown(1)) {dir=1;if (!onwater(x+1.5,y+1.5)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+.2,y+2)) {x-=this.speed}}
if (keydown(2)) {dir=2;if (!onwater(x+1.5,y+2)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+1.5,y+3.2)) {y+=this.speed}}
if (keydown(3)) {dir=3;if (!onwater(x+1.5,y+1.5)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+2.8,y+2)) {x+=this.speed}}
if (!keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) && !keydown(5) && !onwater(x+1.5,y+1.5)) {setcharani my_car,}
}

__________________
Reply With Quote
  #12  
Old 08-27-2005, 05:35 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 Foggy
Is this it then? And how do I make move and make sounds?

NPC Code:
// NPC made by FOGGY
if (created || timeout) {timeout=.05}
if (playersays(/in)) {this.mode=1;disabledefmovement;}
if (playersays(/out)) {this.mode=0;enabledefmovement}
if (timeout && this.mode=1) {
if (keydown(0)) {dir=0;if (!onwater(x+1.5,y+2)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+1.5,y+.7)) {y-=this.speed}}
if (keydown(1)) {dir=1;if (!onwater(x+1.5,y+1.5)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+.2,y+2)) {x-=this.speed}}
if (keydown(2)) {dir=2;if (!onwater(x+1.5,y+2)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+1.5,y+3.2)) {y+=this.speed}}
if (keydown(3)) {dir=3;if (!onwater(x+1.5,y+1.5)) {setcharani my_car,} else {setcharani swim,;};if (!onwall(x+2.8,y+2)) {x+=this.speed}}
if (!keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) && !keydown(5) && !onwater(x+1.5,y+1.5)) {setcharani my_car,}
}

First, don't use playersays(). It's deprecated. Instead, catch the playerchats event and check the value of #c (the current chat text).

Second, Skyld already gave you some hints about how to move. For making sounds, there is the play command.
Reply With Quote
  #13  
Old 08-27-2005, 05:48 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Skyld already gave you some hints about how to move. For making sounds, there is the play command.
But how do i lay it all out and stuff?
__________________
Reply With Quote
  #14  
Old 08-27-2005, 06:57 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
btw is there a way to make ganis blocking?
cuz it really sucks when someone walks under your car XD
Reply With Quote
  #15  
Old 08-28-2005, 02:24 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
this is an NPC i made for running, it allows every direction (360) it's easier this way I think any way. BTW, this doesn't have gani's in or anything, and it lets you run over walls, which is something I'm working on now (minor problem) sorry, im terrible w/ formatting
NPC Code:
// NPC made by Excaliber (Manager)
if(playerenters){
toweapons run
}
if(isweapon&&keypressed&&strequals(#p(1),I)&&!onwa ll(playerx,playery-2) &&playerhearts=playerfullhearts){
freezeplayer .05;
playery=playery-1.5
}
if(isweapon){
timeout=.05
}
if(timeout){
for (i=0;i<4;i++) {
if (keydown(i)) {
if(!onwall(playerx+vecx(i)*1.6,playery+vecy(i)*1.6 )){
playerx=playerx+vecx(i)*1.25;
playery=playery+vecy(i)*1.25;
}
}
}
}

Reply With Quote
  #16  
Old 08-29-2005, 07:40 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
KSI-GS
http://forums.graal2001.com/forums/s...ad.php?t=46557
__________________
Reply With Quote
  #17  
Old 08-29-2005, 01:44 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Reply With Quote
  #18  
Old 08-29-2005, 02:22 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
OK I got the car to move now but the thing is that i do not go in it i stand at the side plz help and the gani is keep on flashing a white back ground!
__________________
Reply With Quote
  #19  
Old 08-29-2005, 02:48 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 Foggy
OK I got the car to move now but the thing is that i do not go in it i stand at the side plz help and the gani is keep on flashing a white back ground!
The first problem you describe is that you have probably made your GANI wrong.

The second problem you describe is that you have probably made your GANI wrong.
__________________
Skyld
Reply With Quote
  #20  
Old 08-29-2005, 03:36 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Skyld
The first problem you describe is that you have probably made your GANI wrong.

The second problem you describe is that you have probably made your GANI wrong.
Do you want 2 see the gani's to see if they are wrong?
__________________
Reply With Quote
  #21  
Old 08-29-2005, 05:07 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
Inside the gani, is the player inside the car?
__________________
Reply With Quote
  #22  
Old 08-29-2005, 06:14 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by xAndrewx
Inside the gani, is the player inside the car?
OK the problem is that the gani flashes a white back ground how do i stop that?
__________________
Reply With Quote
  #23  
Old 08-29-2005, 08:29 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Post your ganis here.
Reply With Quote
  #24  
Old 08-30-2005, 02:41 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
sounds like you layerd the car part of the gani below the player, and the GFX you used for the car might be off (bad backround) though, I doubt it's the GFX of the car, as it's on another server, you could be going to fast (seriously, the car may be going so fast that it take a while to load each movement) hope that helps a bit
Reply With Quote
  #25  
Old 08-30-2005, 11:11 AM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by excaliber7388
sounds like you layerd the car part of the gani below the player, and the GFX you used for the car might be off (bad backround) though, I doubt it's the GFX of the car, as it's on another server, you could be going to fast (seriously, the car may be going so fast that it take a while to load each movement) hope that helps a bit
No its my own GFX im using but it is like the car at the first post and ill try to go that thx for the info mate.
__________________
Reply With Quote
  #26  
Old 08-30-2005, 11:23 AM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Would it be cause i have not up loaded the GFX or the gani?
__________________
Reply With Quote
  #27  
Old 08-31-2005, 06:21 PM
nullify nullify is offline
Registerd Abuser
nullify's Avatar
Join Date: May 2004
Location: The cheese state.
Posts: 851
nullify has a spectacular aura about
hwo wan 2 giv me skrips so i kan steel un carz and stuf?
Reply With Quote
  #28  
Old 08-31-2005, 07:32 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by nullify
hwo wan 2 giv me skrips so i kan steel un carz and stuf?
Speak in English please and and what kind of script for im haveing some probems with my car script that im making.
__________________
Reply With Quote
  #29  
Old 08-31-2005, 10:03 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
null wasn't serious in his post.

he knows how to script.
__________________
torankusu's
Reply With Quote
  #30  
Old 08-31-2005, 10:35 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by Torankusu_2002
null wasn't serious in his post.

he knows how to script.
Will it will be good if he could help me with my script problem
__________________
Reply With Quote
  #31  
Old 08-31-2005, 10:39 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
Why don't you try your questions instead of asking them.
__________________
Reply With Quote
  #32  
Old 08-31-2005, 10:49 PM
Foggy Foggy is offline
Can you dance to my beat
Foggy's Avatar
Join Date: May 2005
Location: N.Ireland, Larne
Posts: 80
Foggy is on a distinguished road
Send a message via AIM to Foggy Send a message via MSN to Foggy
Quote:
Originally Posted by xAndrewx
Why don't you try your questions instead of asking them.

I shall try that
__________________
Reply With Quote
  #33  
Old 09-02-2005, 03:21 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by excaliber7388
this is an NPC i made for running, it allows every direction (360) it's easier this way I think any way. BTW, this doesn't have gani's in or anything, and it lets you run over walls, which is something I'm working on now (minor problem) sorry, im terrible w/ formatting
For one, there are four directions in your script.
Two, don't post full scripts, give an explanation of what to do. People don't learn by copy+paste.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #34  
Old 09-02-2005, 04:37 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
actually, I learned alot from copy paste you get to see proper format and use of commands and it wasn't complete, I never told him how to keep it from going on walls
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 07:28 AM.


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