Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Car Trouble ~.~ (https://forums.graalonline.com/forums/showthread.php?t=60774)

Foggy 08-27-2005 01:09 PM

Car Trouble ~.~
 
1 Attachment(s)
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. ^.^

Skyld 08-27-2005 01:41 PM

Use GANIs (setani), key detection (keypressed, keydown, keydown2), and some simple math.

Foggy 08-27-2005 01:49 PM

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?

Skyld 08-27-2005 02:33 PM

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)?

Foggy 08-27-2005 02:57 PM

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.

Bl0nkt 08-27-2005 03:02 PM

Here's a problem right off the bat:

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

Foggy 08-27-2005 03:08 PM

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?

Skyld 08-27-2005 03:59 PM

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.

Foggy 08-27-2005 04:51 PM

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?

Lance 08-27-2005 05:14 PM

Quote:

Originally Posted by Foggy
Ok I have made a gani now what?

He just told you.

Foggy 08-27-2005 05:30 PM

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,}
}


Lance 08-27-2005 05:35 PM

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.

Foggy 08-27-2005 05:48 PM

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?

projectigi 08-27-2005 06:57 PM

btw is there a way to make ganis blocking?
cuz it really sucks when someone walks under your car XD

excaliber7388 08-28-2005 02:24 AM

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;
}
}
}
}


calani 08-29-2005 07:40 AM

KSI-GS
http://forums.graal2001.com/forums/s...ad.php?t=46557

excaliber7388 08-29-2005 01:44 PM

:\

Foggy 08-29-2005 02:22 PM

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!

Skyld 08-29-2005 02:48 PM

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.

Foggy 08-29-2005 03:36 PM

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?

xAndrewx 08-29-2005 05:07 PM

Inside the gani, is the player inside the car?

Foggy 08-29-2005 06:14 PM

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?

Bl0nkt 08-29-2005 08:29 PM

Post your ganis here.

excaliber7388 08-30-2005 02:41 AM

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 :)

Foggy 08-30-2005 11:11 AM

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.

Foggy 08-30-2005 11:23 AM

Would it be cause i have not up loaded the GFX or the gani?

nullify 08-31-2005 06:21 PM

hwo wan 2 giv me skrips so i kan steel un carz and stuf?

Foggy 08-31-2005 07:32 PM

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.

Torankusu_2002 08-31-2005 10:03 PM

null wasn't serious in his post.

he knows how to script.

Foggy 08-31-2005 10:35 PM

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 ^^

xAndrewx 08-31-2005 10:39 PM

Why don't you try your questions instead of asking them.

Foggy 08-31-2005 10:49 PM

Quote:

Originally Posted by xAndrewx
Why don't you try your questions instead of asking them.


I shall try that

Dach 09-02-2005 03:21 AM

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.

excaliber7388 09-02-2005 04:37 PM

actually, I learned alot from copy paste :D 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 :D


All times are GMT +2. The time now is 01:30 PM.

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