OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: astaroth on 19 Feb 2009, 10:09:12

Title: problem
Post by: astaroth on 19 Feb 2009, 10:09:12
J' have a problem with init in config.cpp

init="[(_this select 0)] exec ""\BMW M5 (e60)\accel.sqs|#|; default value most be 0

don't work in mission editor and see this info

Fuck
Title: Re: problem
Post by: Planck on 19 Feb 2009, 15:22:03
Not sure exactly what the problem is, because more info is needed to clarify the issue.

Having said that I can say the example you posted that doesn't seem to be complete.

Should maybe be:

init="[(_this select 0)] exec ""\BMW M5 (e60)\accel.sqs""";


Planck
Title: Re: problem
Post by: astaroth on 20 Feb 2009, 16:33:09
do you see any Bug's or errors in this line

_amount>20 |#|: goto "exit" Error operator unknown


#accel
_inc = 1
_amount = 0
_car setvelocity [(velocity _car select 0) + _inc*cos getdir _car, (velocity _car select 1) + _inc*sin getdir _car, velocity _car select 2]
_amount=_amount+1
_amount>20 : goto "exit"
? speed _car < 330 && alive _car : goto "accel"

#exit
Title: Re: problem
Post by: Walter_E_Kurtz on 20 Feb 2009, 17:19:40
?


Literally. The line is If _amount is greater than 20 then goto "exit"
Title: Re: problem
Post by: astaroth on 22 Feb 2009, 19:13:42
if _amount > 40|#| : goto "exit" type needs to be logical


Can you explain what's going on with these types of ?
Title: Re: problem
Post by: Walter_E_Kurtz on 23 Feb 2009, 04:24:56
I don't know about "types of" - if something doesn't work, I try something else without worrying too much about why.


Be consistent in your syntax.

Either:
? _amount > 40: goto "exit"

Or:
if (_amount > 40) then goto "exit"   <- use brackets around the condtion


and, if you want to get more advanced:
if (condition) then {outcome} else {alternative}
Title: Re: problem
Post by: astaroth on 23 Feb 2009, 16:48:26
ok thanks
how to make a script that ON  with the engine
Title: Re: problem
Post by: Walter_E_Kurtz on 24 Feb 2009, 02:51:57
Use the isEngineOn (http://www.ofpec.com/COMREF/index.php?action=details&id=172) command.

First give the vehicle a name, for instance OneCarefulOwner, then

Method 1 - Trigger

Place a trigger, dimensions 0 x 0, activated Once and make the condition
Code: [Select]
isEngineOn OneCarefulOwner and launch your script in the On Activation line.


Method 2 - Waiting script

Alternatively, if the script is already running and you are just waiting for the engine to start, use the line
Code: [Select]
@isEngineOn OneCarefulOwner and the script will continue.
Title: Re: problem
Post by: astaroth on 25 Feb 2009, 14:04:04
the script does not run these 2 methods do not help
see if the code for errors

Code: [Select]
#accel
_inc = 1
_amountleft = 0
vechicle setvelocity [(velocity vechicle select 0) + _inc*sin getdir vechicle, (velocity vechicle select 1) + _inc*cos getdir vechicle, velocity vechicle select 2]
~1
if (_amount > 500) then { goto "exit" }
? speed vechicle < 330 && alive vechicle : goto "accel"

@isEngineOn OneCarefulOwner

#exit

Title: Re: problem
Post by: Planck on 25 Feb 2009, 18:26:17
The command 'vehicle' has the wrong spelling and possibly the syntax for it is not correct.

Syntax is 'vehicle unit', and returns the vehicle, if any, that the unit is in.
The unit itself is returned if it is not in a vehicle.


Planck
Title: Re: problem
Post by: Worldeater on 25 Feb 2009, 22:22:33
Hmm, I think vechicle (formerly _car) isn't used as a command but as a global variable.

Talking about variables: _amount isn't assigned a value, _inc is of no real use, _amountleft isn't used at all and I can only guess how OneCarefulOwner made it into the script. :)

Astaroth, can you describe what the script should do?
Title: Re: problem
Post by: astaroth on 26 Feb 2009, 15:53:08
the script is designed to expand to 330 vehicles per hour with 550Nm torque
Title: Re: problem
Post by: Worldeater on 27 Feb 2009, 07:53:38
Try this. With the current settings (_f = 1.2) ArmA's hatchback (http://community.bistudio.com/wikidata/images/3/31/Car_hatchback.jpg) will end the quarter mile in ~9.4s at a speed of ~230km/h... :D

Code: [Select]
; boost.sqs

_car = _this select 0
_u = vectorUp _car
_maxSpeed = 330

; You might have to change this value depending on the type of car you use
_f = 1.2

@isEngineOn _car
#accelerate

_height = (getPos _car) select 2

? not alive _car          : goto "end"
? speed _car >= _maxSpeed : goto "end"
? _height > 1             : goto "end"

_v = velocity _car
_vx = (_v select 0) * _f
_vz = (_v select 1) * _f
_vy = (_v select 2) * _f

_car setVelocity [_vx, _vz, _vy]
_car setVectorUp _u

~0.01
goto "accelerate"


#end
exit
Title: Re: problem
Post by: astaroth on 27 Feb 2009, 08:44:19
but the script runs for a short time anyway thanks :)
Title: Re: problem
Post by: astaroth on 05 Mar 2009, 19:03:14
know of any scripts on the repetition time
I am so thoroughly

_car setVelocity [_vx, _vz, _vy]
_car setVectorUp _u

~0.25
Title: Re: problem
Post by: astaroth on 18 Mar 2009, 18:10:08
can someone help me with this

know of any scripts on the repetition time
I am so thoroughly

_car setVelocity [_vx, _vz, _vy]
_car setVectorUp _u

~0.25