Jump to content

Photo
- - - - -

An Autorun script is in the works.


  • Please log in to reply
6 replies to this topic
Thread Starter
WW2Weasel
WW2Weasel

    Sergeant

  • Members
  • 118 posts

#1

Posted 22 March 2012 - 19:05

I've made an autorun script; So a player need not hold key down or put paperclip to hold key down.
It will make your unit run 100m if healthy - crawl a 100m if wounded.
It is an addaction driven script.

Script exits if:

Unit completes 100m movement.
Unit takes damage along the way.
Player issues the stop/break addaction to halt movement.
The player dies.

Right now tested and works for: Single player mode and campaign.
Working on MP compatability.

Once done I will submit the file and demo.

Complete with remarks in script to explain how to use; explanation of the concept and how to further extend distance, etc....

Edited by WW2Weasel, 24 March 2012 - 01:14.


Thread Starter
WW2Weasel
WW2Weasel

    Sergeant

  • Members
  • 118 posts

#2

Posted 22 March 2012 - 22:48

OK update just tested with WH40K mod associate newnoob - and Good news it works in MP - had a few small issues to fix - nothing that can't be fixed.

So both players were able to autorun or autocrawl.

So in a few days time the script and demo will be available for all.

Need a few days to try and work in some more time to do mp testing - at work so cannot do further testing.

Beagle
Beagle

    Chief Warrant Officer

  • Members
  • 3697 posts

#3

Posted 22 March 2012 - 22:52

Funny, because I habe autoron since OFP without any script. Does your's have collision avoidance? Because collision and gettig hung when you get back is my biggest problem with autorun.

Thread Starter
WW2Weasel
WW2Weasel

    Sergeant

  • Members
  • 118 posts

#4

Posted 22 March 2012 - 23:50

Perhaps we have a misunderstanding?

Collision avoidance? My Auto-run script is just for Infantry. The idea behind my script is to move a unit on foot/running 100 meters with one click of the mouse.

Well my script plays animations - so it's all on foot - there is no hang - and no collision - problems with infantry. Are you referring to "auto-hover"?

on a side note: I reworked the script - hammered out the small issues and just need to retest again later.

Edited by WW2Weasel, 22 March 2012 - 23:56.


Beagle
Beagle

    Chief Warrant Officer

  • Members
  • 3697 posts

#5

Posted 23 March 2012 - 01:07

No im referrign to autorun on INfanrty...you know...I activate it and it rusn endlessly until I return to pc...but most of the time it get's stuck on some map objects...
I don't use a script in game just a key repearter programmed into keyboard.

Thread Starter
WW2Weasel
WW2Weasel

    Sergeant

  • Members
  • 118 posts

#6

Posted 23 March 2012 - 01:38

Ahhh - k - gotcha - have a simple keyboard and don't use keyboard repeating software- so I don't do that option. The animation will run you through an object <I think, can't remember> so you're not gonna get stuck. But I currently set the distance to run @ 100m. But in the script I give each editor the instructions on how to increase distance if they feel they need more running room.

Edited by WW2Weasel, 23 March 2012 - 01:46.


Thread Starter
WW2Weasel
WW2Weasel

    Sergeant

  • Members
  • 118 posts

#7

Posted 24 March 2012 - 00:50

Still at work - haven't mp tested. But I will post up scripts - if peeps want to MP test for me - that would be good.

ok the first script: "Arun_Acrawl.sqs"


;Script by WW2Weasel < 03-21-2012 > for WH40K Mod - WW2_Weasel@yahoo.com
;No permission is needed to modify this script.
;Have fun gaming - and why not visit us at the Wh40k mod and say hi!: http://s1.zetaboards...OFPWH40K/index/
;This script written to address an ofp fan's complaint regarding tedious long range running of unit.
;I had'nt thought of doing this before until I read the fan's request. I thought this was an absolutely important feature to have in operation flashpoint and it garnered immediate acion from me.
;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: Autorun = this addAction ["Auto-run - "+format ["%1",name this], "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 "autorun"
;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 "CombatRunF";
;Default Bis crawl animation: _unit playMove "LyingFastCrawlF"
;Autorunbreak = _unit addAction ["Auto-stop - "+format ["%1",name _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.

?_lockplyr:exit
?!local player && !local (_this select 0): exit
_lockplyr=true
_pbreak=false
_unit=_this select 0
_blplyr = "bplyr" + format["%1",_unit]
?!alive _unit || _pbreak:_pbreak=false,_unit removeAction Autorunbreak,_lockplyr=false,exit
Autorunbreak = _unit addAction ["Auto-stop - "+format ["%1",name _unit], "Arun_Acrawl_break.sqs"]
_health=getdammage _unit
?canstand _unit: _i=35,_arc="CombatRunF",goto "autorun"
?!canstand _unit: _i=138,_arc="LyingFastCrawlF",goto "autorun"

#autorun
?bplyr==_blplyr:_pbreak=true
?!alive _unit || _pbreak:_pbreak=false,bplyr="",publicVariable "bplyr",_unit removeAction Autorunbreak,_lockplyr=false,exit
_i=_i-1
?getdammage _unit > _health:exit
_unit playMove _arc?_i==0:_unit removeAction Autorunbreak,_lockplyr=false,exit
posplyr=getpos _unit
PublicVariable "posplyr"
~.55
goto "autorun"

exit

---------- Post added at 00:50 ---------- Previous post was at 00:48 ----------

ok the second script: "Arun_Acrawl_break.sqs"



;Script by WW2Weasel for WH40K Mod
;This script written to address ofp fan's complaint regarding tedious long range running of unit.
;This portion of the Autorun scripts is to handle controlled exit from script by player.
;Autorunbreak = _unit addAction ["Auto-stop - "+format ["%1",name _unit], "Arun_Acrawl_break.sqs"] - run from inside Arun_Acrawl.sqs

?!local player && !local (_this select 0): exit
_unit =_this select 0
bply = "bplyr" + format["%1",_unit]
bplyr = bply
publicvariable "bplyr"
_unit removeAction Autorunbreak
exit

Edited by WW2Weasel, 24 March 2012 - 08:25.