Jump to content
Sign in to follow this  
Shadow_Spyder

Refuel/Rearm/Repair script

Recommended Posts

Hey everyone. I am a complete newb when it comes to scripts, and I was wondering if anyone could get me a script that will cause whatever enters the trigger(s) to get repaired, refueled, and rearmed. Kind of like what happens in the evolution map. I downloaded a script by killjoy that's soposed to do it, only 2 problems with it though. Not enough triggers, and when I try making more, they don't work. Also, it wont rearm anything. Refuel and repair work fine, but no rearming. SO, anyone able to help me out here? Thx help.gif

Share this post


Link to post
Share on other sites

I know there is a thing in EditorUdate V_102

that makes Rearm/Repair and refuel.

Its called re****points. Might wanna check that out.

Share this post


Link to post
Share on other sites

I was wrong with the EditorUpdate it was Mapfact..

There is a function in the MAP:Support

were you can add a point on map that

will be a point to rearm, refuel and

repair.

Share this post


Link to post
Share on other sites
I was wrong with the EditorUpdate it was Mapfact..

There is a function in the MAP:Support

were you can add a point on map that

will be a point to rearm, refuel and

repair.

MAP_Misc is the Addon you spoke from wink_o.gif

Share this post


Link to post
Share on other sites

Thx everyone for your replies. A couple things. I have checked the biki, I couldn't find anything that I needed, and even if I did, I most likely wouldn't have known how to use it properly. The biki is mainly there for people who already know some-what what there doing and know what there looking for. I do not know either. Also, I do have the map_misc and all that, but i'd much rather NOT use another mod that everyone will need in order to play when I know it's possible by scripting and everyone wont need that. Thanks though.

Share this post


Link to post
Share on other sites

This is what you seek exactly:

1. Make a script in your mission called "vclRepairPad.sqs"

2. Put the code below in that script.

3. Make helo pad and put this in the helo pad's init. Put a trigger on it with a "hint" like "Land to Refuel/Repair/Rearm".

INIT: this exec "vclRepairPad.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_pad = _this

;;repairList = ["UH60MG","Mi17_MG","Mi17","AV8B2","AV8B","SU34","SU34B","AH1W","AH6","KA50","AH6_RACS","M1Abrams","T72"]

repairList = ["Land","Air"]

#CheckLoop

~3

_x = 0

#SearchLoop

~1

_class = repairList Select _x

_obj = NearestObject [_pad,_class]

?!Isnull _obj : Goto "Continue"

Goto "Skip"

#Continue

;;hint format ["%1\n%2",_obj,_pad distance _obj]

_type = typeOf _obj

?_obj isKindOf "Man" : goto "Skip"

?_pad Distance _obj < 10 && Alive _obj && getPos _obj select 2 < 2 && Local _obj && count crew _obj > 0 : Goto "Found"

#Skip

_x = _x + 1

?_x < Count repairList : Goto "SearchLoop"

goto "CheckLoop"

#Found

_name = getText (configFile >> "CfgVehicles" >> _type >> "displayName")

?damage _obj > .01 && local _obj : titletext [format ["Repairing %1",_name],"PLAIN"]

#RepairLoop

~.03

_obj setDamage (Damage _obj - .01)

?damage _obj > .005 : goto "RepairLoop"

?fuel _obj < 1 && local _obj : titletext [format ["Refueling %1",_name],"PLAIN"]

#FuelLoop

~.03

_obj setFuel (fuel _obj + .01)

?fuel _obj < .99 : goto "FuelLoop"

#Rearm

_weapons = weapons _obj

?count _weapons < 1 : goto "EndArm"

?count _weapons == 1 && _weapons select 0 in ["CarHorn", "BikeHorn","TruckHorn","SportCarHorn"] : goto "EndArm"

?local _obj : titletext [format ["Rearming %1",_name],"PLAIN"]

?!local _obj : goto "EndArm"

{_obj removeWeapon _x} foreach _weapons

~1

{_obj addWeapon _x} foreach _weapons

_x = 0

#GetMagazines

~1

_w = _weapons select _x

_mags = getArray (configFile >> "CfgWeapons" >> _w >> "magazines")

?_type == "AH1W" && count _mags > 1 : _mags = ["38RND_FFAR"]

;;player groupChat format ["_w: %1, _mags: %2",_w,_mags]

{_obj removeMagazine _x} foreach _mags

~1

{_obj addMagazine _x} foreach _mags

_x = _x + 1

?_x < count _weapons : goto "GetMagazines"

~2

?local _obj : titletext [format ["%1 is ready to go.",_name],"PLAIN"]

#EndArm

~30

goto "CheckLoop"

Share this post


Link to post
Share on other sites

Thanks for that script. I gave it a try and I got this little error thing in the top left of the screen:

'_obj = |NearestObject| [_Pad,_class]'

Error Type Bool, Expected Number

Also, my test was on an AH1Z and the refueling worked when I first turned on the choppers engins, but once I took off, I launched off some MG fire, FFAR's, and hellfires, then landed hard enough to damage the aircraft. No rearming, no refueling, and no repairing happend then.

~~EDIT~~ Nevermind, I put it in the init field of the helipad and it works fine now. Doesn't like triggers i guess.

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  

×