Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-28-2011, 09:44 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Problem With A Car Script

Basically iv made a car script and it works good but there's one problem.
When accelerating it looks non normal and goes from 0 - top speed instantly.
I am clueless on how i would actually do acceleration.
Ff anyone has any ideas they'd be much appreciated.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 08-28-2011, 11:50 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
basically have a counter:

PHP Code:
function onPlayerenters()
{
  
settimer(0.05);
}

function 
onTimeout()
{
  if (
keydown2(keycode("f"),true) && this.speed<this.topspeed)this.speed++;
  else 
this.speed-=0.25;
  
settimer(0.05);

I dont think I've used valid syntax for keydown2 but I can't remember what works and what not o_0, hopefully this will give you an idea on how to do it. But you could always post your script then one of us can examine it and tell you what the problem is lol , its most likely that you not having the script take a break after the key is pressed. So pop into your script
PHP Code:
sleep (0.05); 
after your speed increment statement
Reply With Quote
  #3  
Old 08-28-2011, 12:02 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
ah ok i get the jist of this.
what its doing on a timer its slowly incrementing the speed.
if the keys arent being held down it slowly reduces until its nothing.
also its just using arrow keys btw not f lol.
thanks man.
youv'e given me a new approach on this.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 08-28-2011, 12:09 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
im not near my pc but i think iv'e found another problem.
how the speed will work is confusing...
i know how to make my self go faster but the on wall check im not so sure about.
maybe somthing like this.
PHP Code:
function onKeydown(code){
if(
code == "37"){ //Left Arrow
if(!onwall(player.1.5player.y){ 
But im not sure if theres an easier way to check if on wall besides manually entering that on each keydown check.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 08-28-2011, 04:29 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
I would check with keydown from 1-4. Since your car script is kind of it´s own movement, I´d take a look at this one
Dusty´s Bare Bone Movement.
The math might be complicated for the walls check.
__________________
MEEP!
Reply With Quote
  #6  
Old 09-01-2011, 02:22 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
you can do a check.
if (keydown(1))
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #7  
Old 09-01-2011, 02:32 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
Quote:
Originally Posted by callimuc View Post
I would check with keydown from 1-4.
Keys 0-3, not 1-4, are for the arrow keys.
__________________
Reply With Quote
  #8  
Old 09-01-2011, 02:37 AM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by cbk1994 View Post
Keys 0-3, not 1-4, are for the arrow keys.
Oh was a quick mistake
__________________
MEEP!
Reply With Quote
  #9  
Old 09-19-2011, 02:34 PM
irock1 irock1 is offline
Registered User
Join Date: Aug 2011
Posts: 20
irock1 can only hope to improve
I made a car script but the car pic dosent rotate (car rotates) just the gani dosent help D:
__________________
YOUR A
Reply With Quote
  #10  
Old 09-21-2011, 01:07 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Correction: You didnt make it, Astram did.
Dont claim scripts as your own unless you scripted the full script.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #11  
Old 09-30-2011, 10:42 AM
irock1 irock1 is offline
Registered User
Join Date: Aug 2011
Posts: 20
irock1 can only hope to improve
just god damn help!
__________________
YOUR A
Reply With Quote
  #12  
Old 09-30-2011, 11:29 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by irock1 View Post
just god damn help!
Please stop coding.
__________________
Reply With Quote
  #13  
Old 09-30-2011, 03:28 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
Quote:
Originally Posted by irock1 View Post
just god damn help!
Since you can't get rotation to work, have you tried scripting rotation functionality into your car script?
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:35 AM.


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