Jump to content
Sign in to follow this  
tophe

Simple Repair Script

Recommended Posts

Simple Repair Script 1.1

by Tophe of Östgöta Ops [OOPS]

<< ARMAHOLIC DOWNLOAD >>

This is a very simple script that probably anyone could make in a few minutes, but I thought I'd share it anyway.

It will will repair any object if it is damaged. Works fine with statics, vehicles, buildings etc.

To use with default settings just put this in the vehicles init line:

nul = [this] execVM "repair.sqf"

By default the script will repair the unit 10 seconds after any damage has occurred.

OPTIONS:

There are some optional settings. The format for these are:

nul = [this, delay, number of repairs, damage] execVM "vehicle.sqf"

If you don't put anything the default settings will be used:

nul = [this, 10, 0, 0] execVM "vehicle.sqf"

DELAY:

Default repair delay is 10 seconds, to set a custom respawn delay time,

put that in the init as well. This one will repair after 2 seconds:

nul = [this, 2] execVM "repair.sqf"

DAMAGE:

The amount of damage needed for the script to repair is by default 0.

Meaning that even a little dent will trigger the repair.

If you want another value first set the delay, then add the damage value

between 0 and 1 (0 = undamaged and 1 = destroyed).

This one will need to be pretty messed up before being repaired:

nul = [this, 2, 0.5] execVM "repair.sqf"

REPAIRS:

Default number of repairs available is unlimited.

To set a limit just add the amount after the delay and damage values.

Put 0 for default unlimited number of repairs.

This one will repair 10 times, 2 seconds after any little damage occured:

nul = [this, 2, 0, 10] execVM "repair.sqf"

Version history:

v1.1

* Fixed some bad coding that made ArmA2 report errors.

v1.0

* First release.

Edited by Tophe
updated script

Share this post


Link to post
Share on other sites

Thx for this script, Tophe :)

Put it on our script and functions section at Assault Mission Studio

dlicon.gif

Simple Repair Script [1.1] by Tophe

Edited by Imutep

Share this post


Link to post
Share on other sites

Update script to v1.1.

Check first post

Share this post


Link to post
Share on other sites

Awesome :)

Got a question tho, i tried making a script like this on my own for repairing static defenses, but for some reason when a static defense turret is destroyed and then repaired its unuseable.

And i thought i just was a worse scripter then i already knew i was.

But its the same with yours.

Any ideas?

Share this post


Link to post
Share on other sites

That's strange.. i don't get that problem.

Share this post


Link to post
Share on other sites

Love the script. I have the respawn working with no problems. I do have a problem with the newly respawned vehicles and their original init.

This is the original init before vehicle.sqf was added.

s = this execVM "vrs.sqf"; this exec "scripts\ammoTruckAll.sqf";

This is how I tried it with the vehicle.sqf added. I must be missing something. The vehicle respawn works but the vehicle respawned no longer has the ammo or vrs sqf initialized.

s = this execVM "vrs.sqf"; this exec "scripts\ammoTruckAll.sqf"; veh = [this, 30, 0, 0, TRUE, FALSE,"s = this execVM ""vrs.sqf""; this exec ""scripts\ammoTruckAll.sqf"""]execVM "vehicle.sqf"

I am not good with scripting language. Thanks in advance for your help.

Share this post


Link to post
Share on other sites

Get the latest version of his script here: http://www.armaholic.com/page.php?id=6080

Version 1.7

veh = [this, 30, 0, 0, TRUE, FALSE, "insert init code here"] execVM "vehicle.sqf"

Where it says "insert init code here" try executing your extra scripts, should respawn your vehicle with that code in its init.

Share this post


Link to post
Share on other sites

Thanks for your help with this issue. I just noticed this should be in his respawn script disscussion and not the repair script. DOH!

I did what the instructions and you say but the ammo and other scripts I am calling in the init are not running. The respawn works fine but lets say I want the respawned truck to run an ammo script to add equipment to it. The truck or heli respawns but the ammo script did not run. Here is what I am running in the vehicles init line:

s = this execVM "vrs.sqf"; this exec "scripts\ammoTruckAll.sqf"; veh = [this, 30, 0, 0, TRUE, FALSE,"s = this execVM ""vrs.sqf""; this exec ""scripts\ammoTruckAll.sqf"""]execVM "vehicle.sqf"

As per the isntructions I am enclosing the sqfs in two quotes and I run them outside this script so the initial instance of the vehicle gets proper init also. Thanks...da

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×