Home   Help Search Login Register  

Author Topic: A script to Auto-run or crawl if injured 100 meters / Opflash - CWA  (Read 2483 times)

0 Members and 1 Guest are viewing this topic.

Offline WW2Weasel

  • Members
  • *
A script to Auto-run or crawl if injured 100 meters / Opflash - CWA


https://www.dropbox.com/s/pbc77nqz3d6umbu/run%20crawl%20100%20meters.Intro.7z?dl=0

Test out and if it passes approval - post to Editor's Depot script side CWA

Tested by me & works.


The below readme files:

Script by WW2Weasel < 03-21-2012 > for WH40K Mod - WW2_Weasel@yahoo.com
No permission is needed to modify this script or it's counterpart. 
Have fun gaming - and why not visit us at the Wh40k mod and say hi!: http://s1.zetaboards.com/OFPWH40K/index/
This script written regarding tedious long range running of unit. 
I hadn't thought of doing this before. I thought this was an absolutely important feature to have in operation flashpoint.
The Scope of this script is to play animations to auto run or crawl if injured 100 meters.  This script is meant for players not the AI.
I thought long and hard about giving it more functionality.  I decided to leave as is; but allow others to modify to suit their own tastes.
Result of this Script:  The player's unit begins running then you can steer him around much like you would a vehicle in opflash.
Place in players init line of unit:  [(name of unit)] exec "Arun_Acrawl.sqs"
How to modify distance to be more than 100 meters?  Simple....
- for running - it takes 35 iterations of the playmove command to run 100 meters.  So to run Approx. 500 Meters (35 * 5 = 175) || ?canstand _unit: _i=175,goto "autorun"
- for crawling - it takes 138 iterations of the playmove command to crawl 100 meters.  So to crawl Approx. 500 Meters (138 * 5 = 690) || ?!canstand _unit: _i=690,goto "autocrawl"
Also very important to include: Arun_Acrawl_break.sqs in your mission folder as well - As this is the Addaction break mechanism used to stop the Auto running/crawling.
Also if you take dammage - if not immediately killed the script will stop.
I have not tested yet in MP. But it should still work.  It's meant for local players - and broadcasts the players positions via publicVariable.  One possible problem in busy games is the animation may become choppy and distance traveled could be less than 100m.
*** A Caveat - you may need to test delay in time with your pc and model/animation - time delay definitely needs fine tuning per individual's situation. 
Time delay is important for 2 reasons: 1) It allows for smooth running of animation and 2) Allows the Autorun break addaction to stop immediately upon activation.  To not have a time delay - renders autorun breaking useless.
On my pc default west soldier is ~.5 delay.
*** Default for Standard Imperial Guard unit is ~.6 a larger unit like Ogryn is ~.8.  If time is not set properly - jitter or pause may result.
You may need to change the animations if you are using custom animations - below are the ARMA Cold War Crisis defaults.
Default Bis run animation: _unit playMove "CombatSprintF";
Default Bis crawl animation: _unit playMove "LyingFastCrawlF"
Autorun = [(name of unit)] exec "Arun_Acrawl.sqs"
Autorunbreak = (name of unit) addAction ["Auto-stop - "+format ["%1",(name of unit)], "Arun_Acrawl_break.sqs"] - this runs other script that has a returned value to switch on/off script manually if player chooses via the addaction.



Arun_Acrawl_break.sqs:

Script by WW2Weasel for WH40K Mod
This script written regarding tedious long range running of unit. 
This portion of the Autorun scripts is to handle controlled exit from script by player.
Autorunbreak = player addAction ["Auto-run stop", "Arun_Acrawl_break.sqs"] - run from inside Arun_Acrawl.sqs
« Last Edit: 26 Jun 2016, 19:08:15 by WW2Weasel »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Didn't test this in-game yet but you need to TAG your global variables (like Autorun to MYTAG_autorun).
That's why the the whole system was invented back in the day :)


Oh, and crazy to see activity on these desolate plains  :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.