OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started 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
-
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
-
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
-
?
Literally. The line is If _amount is greater than 20 then goto "exit"
-
if _amount > 40|#| : goto "exit" type needs to be logical
Can you explain what's going on with these types of ?
-
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}
-
ok thanks
how to make a script that ON with the engine
-
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 conditionisEngineOn 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@isEngineOn OneCarefulOwner and the script will continue.
-
the script does not run these 2 methods do not help
see if the code for errors
#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
-
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
-
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?
-
the script is designed to expand to 330 vehicles per hour with 550Nm torque
-
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
; 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
-
but the script runs for a short time anyway thanks :)
-
know of any scripts on the repetition time
I am so thoroughly
_car setVelocity [_vx, _vz, _vy]
_car setVectorUp _u
~0.25
-
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