OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: OFPfreak on 26 Jun 2005, 09:25:32

Title: speed checker, 1 simple stupid last thing
Post by: OFPfreak on 26 Jun 2005, 09:25:32
I've got a script here to test my speed of the car, but theres 1 stupid last thing.
a hint format. How do I insert that? I've got:

Code: [Select]
_howfast = speed car

#loop

hint format ["your car is travelling %1 kilometers an hour",_howfast]
~0.25
? _time < 5 : goto "loop"
Title: Re:speed checker, 1 simple stupid last thing
Post by: bedges on 26 Jun 2005, 09:36:57
the syntax is correct, although in this instance i'd put the

Code: [Select]
_howfast = speed car
inside the loop so that it updates every 0.25 seconds.
Title: Re:speed checker, 1 simple stupid last thing
Post by: OFPfreak on 26 Jun 2005, 10:02:56
It now says the same as before!
It says:

Your car is travelling scalar bool array string 0xfcfffffcf kilometers per hour!

What is wrong!?
Title: Re:speed checker, 1 simple stupid last thing
Post by: bedges on 26 Jun 2005, 10:05:14
i personally wouldn't use 'car' as the name of a unit, as it may cause confusion in flashpoint, there being models called 'car'.

try

Code: [Select]
#loop

_howfast = speed player
hint format ["your car is travelling %1 kilometers an hour",_howfast]
~0.25
? _time < 5 : goto "loop"
Title: Re:speed checker, 1 simple stupid last thing
Post by: CopyrightPhilly on 26 Jun 2005, 10:06:11
try renameing the car...
or
execute the script by its init line
Code: [Select]
[this] exec "scriptname.sqs"
sqs file:
Code: [Select]
_vehicle = _this select 0
_howfast = speed _vehicle

#loop
hint format ["your car is travelling %1 kilometers an hour",_howfast]
~0.25
? _time < 5 : goto "loop"
Title: Re:speed checker, 1 simple stupid last thing
Post by: OFPfreak on 26 Jun 2005, 10:07:47
OOPS the car name is car1 not car! :D!

edit: Hm car1 didnt work either, I'm trying your ideas guys!
btw what does the _vehicle = this select 0 command do? the _ makes it a script only name right?

edit: OOPS again! I forgot to add a _ to howfast in the hintformat! Its got to work now!
Title: Re:speed checker, 1 simple stupid last thing
Post by: CopyrightPhilly on 26 Jun 2005, 10:08:25
lmao
Title: Re:speed checker, 1 simple stupid last thing
Post by: OFPfreak on 26 Jun 2005, 10:12:34
IT WORKS NOW!!! It was showing 0 becuase there was no one called "player" so I renamed it car1 and it shows it perfectly and very exact like 38.593485349534 kph!

the speed checker is in the attachment and propably works on soldiers as well!