limitSpeed: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Default value correction) |
||
(89 intermediate revisions by 15 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| | |game1= arma1 | ||
|version1= 1.00 | |||
|1.00 | |game2= arma2 | ||
|version2= 1.00 | |||
| | |game3= arma2oa | ||
|version3= 1.50 | |||
| | |game4= tkoh | ||
|version4= 1.00 | |||
| | |game5= arma3 | ||
|version5= 0.50 | |||
| | |gr1= Unit Control | ||
| | |gr2= Object Manipulation | ||
| | |descr= Limit the speed of an AI-driven vehicle or AI person to given value. It has continuous effect and AI will not break through the speed limitation until one is contacted, engaged or regrouped. | ||
}} | |pr= Since {{GVI|tkoh|1.00|size= 0.75}} and as of {{GVI|arma3|2.14|size= 0.75}}, using any negative value on a helicopter will not reset the speed limit, but will force it to fly in reverse. | ||
|s1= objectName [[limitSpeed]] speed | |||
|p1= objectName: [[Object]] | |||
|p2= speed: [[Number]] - in km/h; By default, it's {{hl|2 * maxSpeed}} of the vehicle/unit (which is defined in config). See Example 1. | |||
|r1= [[Nothing]] | |||
|x1= <sqf> | |||
leader player limitSpeed 5; // set to walking speed | |||
sleep 30; | |||
leader player limitSpeed (2 * getNumber(configOf leader player >> "maxSpeed")); // remove the limit | |||
</sqf> | |||
|x2= <sqf> | |||
addMissionEventHandler ["OnEachFrame", { hintSilent format ["myVehicle's speed: %1 km/h", speed myVehicle toFixed 2] }]; | |||
< | sleep 5; | ||
myVehicle limitSpeed 5; | |||
</sqf> | |||
< | |x3= <sqf> | ||
</ | // it was necessary to use limitSpeed repeatedly before Arma 3 1.24 | ||
_this setVariable ["speedLimit", 50]; | |||
_this spawn { | |||
while { sleep 0.1; canMove _this } do | |||
{ | |||
_this limitSpeed (_this getVariable "speedLimit"); | |||
}; | |||
}; | |||
sleep 10; | |||
_this setVariable ["speedLimit", 100]; // update the speed limit | |||
</sqf> | |||
|seealso= [[speed]] [[setCruiseControl]] | |||
[[ | }} | ||
[[ | |||
Latest revision as of 18:09, 28 March 2024
Description
- Description:
- Limit the speed of an AI-driven vehicle or AI person to given value. It has continuous effect and AI will not break through the speed limitation until one is contacted, engaged or regrouped.
- Problems:
- Since 1.00 and as of 2.14, using any negative value on a helicopter will not reset the speed limit, but will force it to fly in reverse.
- Groups:
- Unit ControlObject Manipulation
Syntax
- Syntax:
- objectName limitSpeed speed
- Parameters:
- objectName: Object
- speed: Number - in km/h; By default, it's 2 * maxSpeed of the vehicle/unit (which is defined in config). See Example 1.
- Return Value:
- Nothing
Examples
- Example 1:
- Example 2:
- addMissionEventHandler ["OnEachFrame", { hintSilent format ["myVehicle's speed: %1 km/h", speed myVehicle toFixed 2] }]; sleep 5; myVehicle limitSpeed 5;
- Example 3:
- // it was necessary to use limitSpeed repeatedly before Arma 3 1.24 _this setVariable ["speedLimit", 50]; _this spawn { while { sleep 0.1; canMove _this } do { _this limitSpeed (_this getVariable "speedLimit"); }; }; sleep 10; _this setVariable ["speedLimit", 100]; // update the speed limit
Additional Information
- See also:
- speed setCruiseControl
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Unit Control
- Command Group: Object Manipulation