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 09-23-2006, 07:59 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Car drifting

How does the drifting for the cars on UN work? In other words, how would I make drifting for a car script that I have. It moves in the 360 degree direction that changes to the arrow key direction. How does drifting work in general?

EDIT: btw, I am willing to post parts of my script if it helps...
__________________

Last edited by wild8900; 09-23-2006 at 09:15 AM..
Reply With Quote
  #2  
Old 09-23-2006, 03:38 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Would be much the same as an ice skating rink script. I can provide a GS1 example though I'm not sure how useful that would be. PM me if you would like it.
Reply With Quote
  #3  
Old 09-23-2006, 06:24 PM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Thanks, im better with gs1
__________________
Reply With Quote
  #4  
Old 09-23-2006, 07:01 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
they got drifting on un? if so i should play there all day :P
__________________
Reply With Quote
  #5  
Old 09-23-2006, 07:50 PM
zim5354 zim5354 is offline
That one guy!
zim5354's Avatar
Join Date: May 2004
Location: U.S.A
Posts: 1,122
zim5354 has a little shameless behaviour in the past
Send a message via AIM to zim5354
Quote:
Originally Posted by Gerami View Post
they got drifting on un? if so i should play there all day :P
UN cars suck.
Reply With Quote
  #6  
Old 09-23-2006, 08:03 PM
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
What do you mean by drifting?
Reply With Quote
  #7  
Old 09-23-2006, 08:20 PM
k0rupt_ed k0rupt_ed is offline
Lat.. Bleh
k0rupt_ed's Avatar
Join Date: Feb 2006
Location: Under your bed.
Posts: 514
k0rupt_ed is on a distinguished road
they have drifting? wtf?
__________________


Reply With Quote
  #8  
Old 09-23-2006, 09:24 PM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
not really drifting but what I mean is, when you are giong in one direction but turn to A different one really quick, you still move in the other direction a little bit with inertia.
__________________
Reply With Quote
  #9  
Old 09-23-2006, 09:33 PM
zim5354 zim5354 is offline
That one guy!
zim5354's Avatar
Join Date: May 2004
Location: U.S.A
Posts: 1,122
zim5354 has a little shameless behaviour in the past
Send a message via AIM to zim5354
Quote:
Originally Posted by wild8900 View Post
not really drifting but what I mean is, when you are giong in one direction but turn to A different one really quick, you still move in the other direction a little bit with inertia.
There scripting is just bad im pretty sure that wasnt intended lol.
Reply With Quote
  #10  
Old 09-23-2006, 10:18 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Thumbs up 360 degree

Quote:
Originally Posted by wild8900 View Post
360 degree
For that, cos and sin would be good
Reply With Quote
  #11  
Old 09-23-2006, 10:22 PM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
right, I already know that, my car script can move in 360 degrees with some pretty good collision detection. I just chose to limit it to 8 or 4 directions like UN.
__________________
Reply With Quote
  #12  
Old 09-23-2006, 10:25 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
you made it like, when pressing left or right, angle++/-- and then up is acceleration and down is brake?
Reply With Quote
  #13  
Old 09-24-2006, 12:40 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
Well, you'll want to have two variables: xvelocity and yvelocity

While the car is moving, you'll increase the x/y by xvelocity and yvelocity.
When you press the up key, you'll decrease y velocity by the acceleration until it reaches the speed limit. When it reaches the speed limit, it stops increasing the velocity.
Do the same for the other keys.

PHP Code:
function onCreated() {
  
this.xvelocity this.yvelocity 0;
  
this.acceleration .1;
  
this.speedlimit 1;
}

function 
onTimeout() {
  for (
04k++) {
    if (
keydown(k)) {
      
this.xvelocity limit(this.xvelocity vecx(k) * this.acceleration,-this.speedlimit,this.speedlimit);
      
this.yvelocity limit(this.yvelocity vecy(k) * this.acceleration,-this.speedlimit,this.speedlimit);
    }
  }
}

function 
limit(val,min,max) {
  if (
val minval min;
  if (
val maxval max;
  return 
val;

Reply With Quote
  #14  
Old 09-24-2006, 01:17 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
that Script looks good well you only miss one thing :O

setTimer(0.05); in timeout and/or in onCreated()?

or not needed?
__________________

Last edited by Chompy; 09-24-2006 at 01:19 AM.. Reason: misspelling
Reply With Quote
  #15  
Old 09-24-2006, 06:19 PM
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
I didn't give the full script, I just gave a general idea of how to do it.
Reply With Quote
  #16  
Old 09-24-2006, 09:44 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
ah, I was wondreing, because I know you can script :P

__________________
Reply With Quote
  #17  
Old 09-25-2006, 04:06 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by zim5354 View Post
UN cars suck.
**** >:[

Quote:
Originally Posted by zim5354 View Post
There scripting is just bad im pretty sure that wasnt intended lol.
Actually, it was. Incase you haven't noticed, if you make a sharp turn with a car in real life, the momentum from the original direction you were travelling doesn't just magically dissapear.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #18  
Old 09-25-2006, 04:12 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
It wouldn't surprise me if the "drift" was caused by bad scripting =p
Reply With Quote
  #19  
Old 09-25-2006, 05:47 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Twinny View Post
It wouldn't surprise me if the "drift" was caused by bad scripting =p
Reed b4 u post plx.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 12:59 AM.


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