Jump to content
Sign in to follow this  
DrBobcat

Some scripts

Recommended Posts

I have made a few scripts over the past few years that have been used quite extensively in my private collection of missions. These have never been seen by anyone but me and I find them pretty useful, even thought he main idea has been beaten to hell. Keep in mind I taught everything to myself and maybe some of the coding is not conventional. I dont have any place to host these so I will just post code! Also, these are all mission based, not addon based or anything like that. IF YOU WANT TO USE THESE IN A MISSION, PLEASE COPY THE CODE EXACTLY AS IS SO I GET SOME CREDIT!

loadchopper.sqs - helicopter lands,people get in, takes off

[heli,groupLeader] exec loadChopper.sqs

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

; "Land and Load Chopper" Script by Bobcat

; RAAAAAAAAAAAAAAAAAAAAAARRRRR

_group = _this select 0

_chopper = _this select 1

~0.5

_chopper flyInHeight 2

_chopper lockWp true

_loadgrp = units group _group

_chopper setSpeedMode "limited"

~random 1

_i = 0

goto "START"

#START

_dir = getDir _chopper

_trpAmount = count _loadGrp

_chopper flyInHeight 0

? getpos _chopper select 2 < 7 : _chopper setvelocity [(velocity _chopper select 0)-(velocity _chopper select 0)/20,(velocity _chopper select 1)-(velocity _chopper select 1)/20,(velocity _chopper select 2)]

? _i >= _trpAmount : goto "STOP"

? (_loadGrp select _i) in _chopper : _i = _i + 1

~0.01

goto "START"

#STOP

_chopper lockWp false

_chopper flyInHeight 50

_chopper setSpeedMode "full"

Exit

UnloadChopper.sqs - helicopter lands, unloads peeps, takes off

[heli] exec UnloadChopper.sqs

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

; "Land and Unload Chopper" Script by Bobcat

; RAAAAAAAAAAAAAAAAAAAAAARRRRR

_chopper = _this select 0

_height = getpos _chopper select 2

~0.5

_chopper flyInHeight 2

_chopper lockWp true

_loadGrp = (crew _chopper - [(driver _chopper)])

_loadGrp = _loadGrp - [(gunner _chopper)]

_chopper setSpeedMode "limited"

~random 1

_i = 0

_i2 = 10

goto "START"

#START

_chopper flyInHeight 0

_trpAmount = count _loadGrp

? _i >= _trpAmount : goto "STOP"

? getpos _chopper select 2 < 7 : _chopper setvelocity [(velocity _chopper select 0)-(velocity _chopper select 0)/20,(velocity _chopper select 1)-(velocity _chopper select 1)/20,(velocity _chopper select 2)]

? getpos _chopper select 2 < 1.5 && _i2 <= 0 : unassignVehicle (_loadgrp select _i); (_loadgrp select _i) action ["GETOUT",_chopper]; _i2 = 10

? not((_loadGrp select _i) in _chopper) : _i = _i + 1

_i2 = _i2 - 1

~0.1

goto "START"

#STOP

_chopper lockWp false

_chopper flyInHeight _height

_chopper setSpeedMode "full"

Exit

ParaVeh.sqs - parachute a vehicle onto the ground (no drift)

[Pos,Height,Dir,"Type"] exec "ParaVeh.sqs"

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

; Vehicle paradrop script by Bobcat (Accurate Dropping)

;[Pos,Height,Dir,"Type"]

;"Pos" is the position of the paradrop (best to use game logics as they are invisible)

;"Height" is the height of the vehicle being paradropped

;"Dir" is the direction of the vehicle

;"Type" is the type of vehicle being dropped. Must be the correct ID or it wont work

;/////////////////////////////////////////////////////////////////////////////////////////////////////////

;/////////////////////////////////////////////////////////////////////////////////////////////////////////

_pos = _this select 0

_height = _this select 1

_dir = _this select 2

_Type = _this select 3

_posXPos = (getpos _pos select 0) + (14 * cos _dir)

_posYPos = (getpos _pos select 1) - (14 * sin _dir)

_posZPos = getPos _pos select 2

~0.001

_newVeh = _type createVehicle [(_posXPos),(_posYPos),(_posZPos)]

_newVeh setpos [(getPos _newVeh select 0),(getPos _newVeh select 1),(getPos _newVeh select 2) + _height]

#NEXT

_newChute = "Parachutewest" createVehicle [0,0,0]

~0.001

_newVeh setDir _dir

_newVeh setpos [_posXPos,_posYPos,(0 + _height)]

_newVeh moveInDriver _newChute

#LOOP

_vehXPos = getpos _newVeh select 0

_vehYPos = getpos _newVeh select 1

_vehZPos = getpos _newVeh select 2

? not(alive _newVeh) : goto "SHITLANDING"

? getDammage _newVeh > 0.7 : goto "SHITLANDING"

? isNull _newChute : goto "GOODLANDING"

_newChute setDammage 0

_newChute setPos [(_vehXPos),(_vehYPos),(_vehZPos)]

_newChute setVelocity [0,0,-5.5]

_newVeh setpos [(_posXPos),(_posYPos),(getPos _newVeh select 2)]

_newVeh setVelocity [0,0,-5.5]

_newVeh moveInDriver _newChute

~0.001

? not(_newVeh in _newChute) : goto "LOOP"

#SHITLANDING

_newVeh setdammage 0.7

_newVeh setVelocity [(random 20) - random 20,(random 10) - random 10,(velocity _newVeh select 2)]

#LOOP2

deleteVehicle _newChute

? (getPos _newVeh select 2) < 2 : goto "SHITLANDING2"

~0.001

goto "LOOP2"

#SHITLANDING2

"MortarShell" camCreate getPos _newVeh

"MortarShell" camCreate getPos _newVeh

"MortarShell" camCreate getPos _newVeh

"Heat125" camCreate getPos _newVeh

"Heat125" camCreate getPos _newVeh

_newVeh setdammage 1

Exit

#GOODLANDING

_newVeh setVelocity [0,0,0]

deleteVehicle _newChute

Exit

ParaVeh2.sqs - Same as before but with a drift (more lag)

[Pos,Height,Dir,"Type"] exec "ParaVeh2.sqs"

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

; Vehicle paradrop script by Bobcat

;[Pos,Height,Dir,"Type"]

;"Pos" is the position of the paradrop (best to use game logics as they are invisible)

;"Height" is the height of the vehicle being paradropped

;"Dir" is the direction of the vehicle

;"Type" is the type of vehicle being dropped. Must be the correct ID or it wont work

;/////////////////////////////////////////////////////////////////////////////////////////////////////////

;/////////////////////////////////////////////////////////////////////////////////////////////////////////

_pos = _this select 0

_height = _this select 1

_dir = _this select 2

_Type = _this select 3

_posXPos = (getpos _pos select 0) + (14 * cos _dir)

_posYPos = (getpos _pos select 1) - (14 * sin _dir)

_posZPos = getPos _pos select 2

~0.001

_newVeh = _Type camCreate [(_posXPos),(_posYPos),(_posZPos)]

_newVeh setpos [(getPos _newVeh select 0),(getPos _newVeh select 1),(getPos _newVeh select 2) + _height]

#NEXT

_newChute = "Parachutewest" createVehicle [0,0,0]

~0.001

_newVeh setDir _dir

_newVeh setpos [_posXPos,_posYPos,(0 + _height)]

_newVeh moveInDriver _newChute

_vehXVel = (random 10 - random 10)

_vehYVel = (random 10 - random 10)

#LOOP

_vehXPos = getpos _newVeh select 0

_vehYPos = getpos _newVeh select 1

_vehZPos = getpos _newVeh select 2

? not(alive _newVeh) : goto "SHITLANDING"

? getDammage _newVeh > 0.7 : goto "SHITLANDING"

? isNull _newChute : goto "GOODLANDING"

_newChute setDammage 0

_newChute setPos [(_vehXPos),(_vehYPos),(_vehZPos)]

_newChute setVelocity [_vehYVel, _vehYVel, -5.5]

_newVeh setpos [(_vehXPos),(_vehYPos),(getPos _newVeh select 2)]

_newVeh setVelocity [_vehYVel, _vehYVel, -5.5]

_newVeh moveInDriver _newChute

~0.001

? not(_newVeh in _newChute) : goto "LOOP"

#SHITLANDING

_newVeh setdammage 0.7

_newVeh setVelocity [(random 20) - random 20,(random 10) - random 10,(velocity _newVeh select 2)]

#LOOP2

deleteVehicle _newChute

? (getPos _newVeh select 2) < 2 : goto "SHITLANDING2"

~0.001

goto "LOOP2"

#SHITLANDING2

"MortarShell" camCreate getPos _newVeh

"MortarShell" camCreate getPos _newVeh

"MortarShell" camCreate getPos _newVeh

"Heat125" camCreate getPos _newVeh

"Heat125" camCreate getPos _newVeh

_newVeh setdammage 1

Exit

#GOODLANDING

_newVeh setVelocity [0,0,0]

_newVeh2 = _type createVehicle [(getpos _newVeh select 0),(getpos _newVeh select 1),(getpos _newVeh select 2)]

_newVeh2 setDir _dir

_newVeh2 setPos getPos _newVeh

deleteVehicle _newChute

deleteVehicle _newVeh

Exit

Share this post


Link to post
Share on other sites

Sorry for a double post, but I did not want to just paste all of em in one go. So continuing on now....(Hard on the eyes)

Here is a collection of some MP designed HALO scripts. They

allow you to plan HALO jumps by "attaching" the script set to

a plane or helicopter. Fun and not too laggy at all!

Part 1 - Giving the person an option to "begin" the insertion. Not jumping yet, but just locking the thing down (to lower confusion) and giving the other two actions (less clutter!)

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

; "HALO" Script part 1 by Bobcat

; unit addAction ["Begin HALO Insertion","HALOBJump.sqs"]

_unit = _this select 0

_starter = _this select 1

_action = _this select 2

? !(_starter in _unit) : hint "Get in the vehicle before using this"; Exit

_unit lock true

_unit removeAction _action

HaloJump = _unit addAction ["Jump","HALOJump.sqs"]

_unit addAction ["End HALO Insertion","HALOEJump.sqs"]

Exit

Part 2 - Actually jumping out of the plane/chopper and removing his/her magazines (to make the jump look smoother).

When they land, their weapons are automatically returned!

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

; "HALO" Script part 2 by Bobcat

_unit = _this select 0

_jumper = _this select 1

_wepList = weapons _jumper

_magList = magazines _jumper

? _jumper == driver _unit : hint "You are the pilot! You cant jump!"; Exit

? _jumper == gunner _unit : hint "You are the gunner! You cant jump!"; Exit

? not(_jumper in _unit) : hint "Get in the vehicle before using this"; Exit

removeAllWeapons _jumper

_jumper action ["GETOUT",_unit]

_jumper setPos [getPos _unit select 0, getPos _unit select 1, (getPos _unit select 2) - 2]

_jumper switchMove "Para"

_xspeed = velocity _unit select 0

_yspeed = velocity _unit select 1

_zspeed = velocity _unit select 2

_jumper setVelocity [(_xspeed + random 20) - random 20, (_yspeed),0]

_jumper addAction ["Pull Parachute","OpenChute.sqs"]

#LOOP

? getpos _jumper select 2 < 1 : goto "QUIT"

~0.01

goto "LOOP"

#QUIT

"_jumper addMagazine _x" forEach _magList

"_jumper addWeapon _x" forEach _wepList

Exit

Pulling the chute - This script is executed when the person wants to pull his chute after jumping out of the chopper. Works great and doesnt jump around (thanks Velocity command!)

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

;Open Parachute script by Bobcat

;unit addAction ["Pull Parachute","OpenChute.sqs"]

_chuteMan = _this select 1

_action = _this select 2

_chuteManXPos = getPos _chuteMan select 0

_chuteManYPos = getPos _chuteMan select 1

_chuteManZPos = getPos _chuteMan select 2

~0.1

_chuteMan removeAction _action

? not(alive _chuteMan) : Exit

_newChute = "Parachute" CamCreate [_chuteManXPos,_chuteManYPos,_chuteManZPos]

_xspeed = velocity _chuteMan select 0

_yspeed = velocity _chuteMan select 1

_zspeed = velocity _chuteMan select 2

_newChute setVelocity [(_xspeed + random 30), (_yspeed), (_zspeed)]

_chuteMan moveInDriver _newChute

~random 1

Exit

Part 3 - Ending the insertion and unlocking the unit. Goes back to giving the action to begin, again :P

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

; "HALO" Script part 3 by Bobcat

_unit = _this select 0

_hitter = _this select 1

_action = _this select 2

? not(_hitter in _unit) : hint "Get in the vehicle before using this"; Exit

_unit removeAction HaloJump

_unit removeAction _action

_unit lock false

_unit addAction ["Begin HALO Insertion","HALOBJump.sqs"]

Exit

Share this post


Link to post
Share on other sites

Lastly is my most coveted set of scripts, my RealPlane and RealChopper sets. These are like a micro version of the FlashFX mods that can be attached to planes or helicopters and giving them some extra snazzy effects. (I aint very good at animations but I gave it a shot!)

*** ALL WORK IN MP!!!!

REALCHOPPER

Consists of -

* - Oil leak (causes random engine shutdown + smoke)

* - Fuel leak (leaks fuel from the helicopter  tounge_o.gif )

* - Electrical Malfunction (Lights flicker and weapons go offline)

* - Engine Fire (Helicopter catches on fire...goes boom after a bit  biggrin_o.gif )

* - Rotor Failure (Causes the helicopter to spin at a random speed in a random direction plummeting towards the ground. OW!  crazy_o.gif Random deaths/injuries. A small chance of the helicopter exploding right on impact biggrin_o.gif )

MAIN SCRIPT (Detects dammage and executes other scripts)

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

; Realistic Heli Damage Script by Bobcat

; RARRRRRRRRRRRRRRRRRRR!!!!!!!!!

; Must have a folder called "RealChopper" in your mission directory and must have the 4 other scripts along with it:

; "FuelLeak.sqs","OilLeak.sqs","ChopperFire.sqs","ElecMalf.sqs"

; To use, just select any chopper and in its INIT line put:

; [this,wepCon,rotorCon] exec "realChopper\RealChopper.sqs"

; wepCon = 0 for manned guns, 1 for no manned guns

; rotorCon = 0 for no rotor failure, 1 for rotor failure

_unit = _this select 0

_cond = _this select 1

_cond2 = _this select 2

_unit setDammage 0

_fuelLeak = false

_oilLeak = false

_fireStart = false

_elecMalf = false

_fuelLeakDone = false

_oilLeakDone = false

_fireStartDone = false

_elecMalfDone = false

_rotorFailDone = false

_damage = getDammage _unit

#SENSOR

? _damage < getDammage _unit : goto "START"

~0.05

goto "SENSOR"

#START

? getdammage _unit <=0.1 : goto "RESET2"

? not(alive _unit) : Exit

? _fuelLeak and not(_fuelLeakDone) : [_unit] exec "RealChopper\FuelLeak.sqs"; _fuelLeakDone = true

? _oilLeak and not(_oilLeakDone) : [_unit] exec "RealChopper\OilLeak.sqs"; _oilLeakDone = true

? _fireStart and not(_fireStartDone) : [_unit] exec "RealChopper\HeliFire.sqs"; _fireStartDone = true

? _elecMalf and not(_elecMalfDone) : [_unit,_cond] exec "RealChopper\ElecMalf.sqs"; _elecMalfDone = true

? _rotorFail and not(_rotorFailDone) : [_unit] exec "RealChopper\RotorFailure.sqs"; _rotorFailDone = true

_rnd1 = random 5

_rnd2 = random 5

_rnd3 = random 10

_rnd4 = random 5

_rotarRnd = random 10

? _rnd1 < 1 : _fuelLeak = true

? _rnd2 < 1 : _oilLeak = true

? _rnd3 < 1 and speed _unit > 50 : _fireStart = true

? _rnd4 < 1 : _elecMalf = true

? _rotarRnd < 1 and _cond2 == 1 : _rotorFail = true

~0.05

#RESET

_damage = getDammage _unit

goto "SENSOR"

#RESET2

_damage = getDammage _unit

_fuelLeak = false

_oilLeak = false

_fireStart = false

_elecMalf = false

_fuelLeakDone = false

_oilLeakDone = false

_fireStartDone = false

_elecMalfDone = false

goto "SENSOR"

OIL LEAK SCRIPT

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

; "Oil Leak" script by Bobcat

; RRAAAAAAAARRRRRRR!

; [unit] exec "OilLeak.sqs"

; Unit = unit affected

_unit = _this select 0

_unit vehicleChat "WARNING! OIL LEAK DETECTED!"

#OIL

~random 5

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : Exit

_rnd = random 20

_rnd2 = random 6

;? _rnd > 0 and _rnd < 2 : _unit action ["Engine off"]; _unit setFuel 0; _unit vehicleChat "ENGINE FAILURE! THE ENGINES ARE OUT!"; Exit

? _rnd > 0 and _rnd < 5 : _unit vehicleChat "ENGINE MALFUNCTION!"; goto "ENGINE"

#SMOKE

_xPos = getPos _unit select 0

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_rnd = _rnd - 1

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos + 2.5)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.1

? _rnd > 1 : goto "SMOKE"

goto "OIL"

#ENGINE

_xPos = ((getPos _unit select 0) + random 3 - random 3)

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

? _rnd2 <= 0 : goto "SMOKE"

_unit action ["Engine off"]

_rnd2 = _rnd2 - 1

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos + 2.5)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.5 + random 3

goto "ENGINE"

FUEL LEAK SCRIPT

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

; "Fuel Leak" script by Bobcat

; [unit] exec "FuelLeak.sqs"

_unit = _this select 0

_unit vehicleChat "WARNING! FUEL LEAK DETECTED!"

#FUEL

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : Exit

_fuelLev = fuel _unit

_fuel = _fuelLev - 0.001

_unit setFuel _fuel

~0.1

goto "FUEL"

ELECTRICAL MALFUNCTION SCRIPT

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

; "Electrical Malfunction" script by Bobcat

; RAAAAAAARRRRRRRRRRRRRRRRRR!!!!!!!

; [unit,cond] exec "ElecMalf.sqs"

; Unit = unit affected

; Cond: 0 = false 1 = true (if you want any weapon malfunctions or not. Make it false for choppers with manned weps)

_unit = _this select 0

_cond = _this select 1

_wepList = weapons _unit

_wepCount = count _wepList

_unit vehicleChat "WARNING! ELECTRICAL MALFUNCTION DETECTED!"

#ELEC

_wepListCons = weapons _unit

_rnd = random 30

? _rnd <= 1 : goto "WEPMALF"

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : _i = 0; goto "QUIT"

_unit action ["Light off"]

~random 1

_unit action ["Light on"]

~random 1

goto "ELEC"

#WEPMALF

? _cond == 0 : goto "ELEC"

? count _wepListCons == 0 : goto "ELEC"

_wepRnd = random count _wepListCons

? _wepRnd > 0 and _wepRnd < 1 : _wepNum = 0

? _wepRnd > 1 and _wepRnd < 2 : _wepNum = 1

? _wepRnd > 2 and _wepRnd < 3 : _wepNum = 2

? _wepRnd > 3 and _wepRnd < 4 : _wepNum = 3

? _wepRnd > 4 and _wepRnd < 5 : _wepNum = 4

? _wepRnd > 5 and _wepRnd < 6 : _wepNum = 5

_wep = _wepListCons select _wepNum

_msg = format ["WEAPON %1 IS NOT RESPONDING",_wep]

_unit vehicleChat _msg

_unit removeWeapon _wep

_wepListCons = _wepListCons - [_wepNum]

goto "ELEC"

#QUIT

_wepCount = count _wepList

? _i > _wepCount : Exit

_wep = _wepList select _i

_unit removeWeapon _wep

_unit addWeapon _wep

_i = _i + 1

~0.1

goto "QUIT"

ENGINE FIRE SCRIPT

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

; "Heli Fire" script by Bobcat

; [unit] exec "HeliFire.sqs"

; Unit = unit affected

_unit = _this select 0

_unit vehicleChat "WARNING! WARNING! ENGINE FIRE!"

#FIRE

? not(alive _unit) : goto "BOOM"

? getdammage _unit <=0.1 : Exit

_time = 60

_i = random 5

#BURN

_xPos = getPos _unit select 0

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_time = _time - 1

? not(alive _unit) : goto "BOOM"

? getDammage _unit > 0.7 and _i > 4 : goto "BOOM"

_dmg = getDammage _unit

_dmg2 = getDammage driver _unit

_dmg3 = getDammage gunner _unit

_damage = _dmg + 0.0015

_damage2 = _dmg2 + 0.0008

_damage3 = _dmg3 + 0.0008

_unit setDammage _damage

(driver _unit) setDammage _damage2

(gunner _unit) setDammage _damage3

drop ["cl_fire" , "" , "Billboard" , 1 , 1.5 , [_xPos,_yPos,_zPos + 2] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [2,4] ,[[(0.4 + random 0.7),(0.4 + random 0.7),(0.4 + random 0.7),random 0.5],[(0.4 + random 0.7),(0.4 + random 0.7),(0.4 + random 0.7),random 0.5]], [0] , 0.2 , 0.2 , "" , "" , ""]

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos + 4)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.05

? _time > 1 : goto "BURN"

goto "FIRE"

#BOOM

_xPos = getPos _unit select 0

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_unit setFuel 1

boom1 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

boom2 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

_unit setFuel 0

_unit setDammage 1

Exit

ROTOR FAILURE SCRIPT

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

; "Rotor Failure" script by Bobcat

; [unit] exec "rotorfailure.sqs"

; Unit = unit affected

; Note: The script has a lot of randomness to add some realism. Sometimes the chopper may hit the ground and explode outright

; while other times it will land and the occupants will be killed or injured. If the chopper hits anything while it is spinning,

; it will be destroyed. Another script will be made for cinematics (a player cannot be killed). This script is optomized for MP/SP

_unit = _this select 0

_i = 55

_i2 = 0

_rate = 0

_unit vehicleChat "WARNING! ROTOR FAILURE!"

_rMsg = random 3

? _rmsg > 0 and _rmsg < 1 : _unit sideChat "OH SHIT! WE'RE HIT, WE ARE HIT!!!"

? _rmsg > 1 and _rmsg < 2 : _unit sideChat "OH NO! WE ARE GOING DOWN!!!"

? _rmsg > 2 and _rmsg < 3 : _unit sideChat "THIS CANNOT BE GOOD.... OUR ROTOR HAS BEEN DAMAGED AND WE ARE GOING DOWN!!!"

"_x allowFleeing 0" forEach crew _unit

_rnd = random 2

_typeRnd = random 2

_velRnd = 2 + random 4

? _rnd > 0 and _rnd < 1 : _factor = 2 + (random 2)

? _rnd > 1 and _rnd < 2 : _factor = -2 - (random 2)

#LOOP

_crewCount = count (crew _unit)

_xPos = getPos _unit select 0

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

? not(alive _unit) : Exit

? getPos _unit select 2 < 0.7 and _typeRnd < 1.1 : goto "LOOP2"

? getPos _unit select 2 < 0.55 : _unit setVelocity [0,0,0]; goto "QUIT2"

_unit setDir (getDir _unit + _factor)

_unit setVelocity [(velocity _unit select 0),(velocity _unit select 1),-(8 + _velRnd + _rate)]

_rate = _rate + 0.07

~0.0001

goto "LOOP"

#LOOP2

_crewCount = count (crew _unit)

_unit setDammage 0.7

_rnd2 = random 4

_unit setFuel 0

? _i > 1 : _unit setVelocity [0,0,-0.5]

? _i < 1 : goto "QUIT"

? _crewCount <= _i2 : goto "CONT"

? _rnd2 < 2.5 : ((crew _unit) select _i2) setDammage (0.6 + random 0.25)

? _rnd2 > 2.5 : ((crew _unit) select _i2) setDammage 1

#CONT

_i = _i - 1

_i2 = _i2 + 1

~0.01

goto "LOOP2"

#QUIT

~2 + random 4

"_x leaveVehicle _unit" forEach crew _unit

Exit

#QUIT2

_unit setDammage 1

"_x setDammage 1" forEach crew _unit

boom1 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

boom2 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

Exit

**********************************************

REALPLANE

Consists of -

Everything that helicopter has except for rotor failure  tounge_o.gif . Also, a wheel brake script was added because my (ex) clanmates were having trouble on the runways  biggrin_o.gif .

MAIN SCRIPT

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

; Realistic Plane Damage Script by Bobcat

; RARRRRRRRRRRRRRRRRRRR!!!!!!!!!

; Must have a folder called "RealPlane" in your mission directory and must have the 4 other scripts along with it:

; "FuelLeak.sqs","OilLeak.sqs","PlaneFire.sqs","ElecMalf.sqs"

; To use, just select any airplane and in its INIT line put:

; [this] exec "realPlane\realPlane.sqs"

_unit = _this select 0

_cond = _this select 1

_unit setDammage 0

_fuelLeak = false

_oilLeak = false

_fireStart = false

_elecMalf = false

_fuelLeakDone = false

_oilLeakDone = false

_fireStartDone = false

_elecMalfDone = false

_damage = getDammage _unit

_unit addAction ["Wheel Brake","RealPlane\WheelBrake.sqs"]

#SENSOR

? _damage < getDammage _unit : goto "START"

~0.05

goto "SENSOR"

#START

? getdammage _unit <=0.1 : goto "RESET2"

? not(alive _unit) : Exit

? _fuelLeak and not(_fuelLeakDone) : [_unit] exec "RealPlane\FuelLeak.sqs"; _fuelLeakDone = true

? _oilLeak and not(_oilLeakDone) : [_unit] exec "RealPlane\OilLeak.sqs"; _oilLeakDone = true

? _fireStart and not(_fireStartDone) : [_unit,_cond] exec "RealPlane\PlaneFire.sqs"; _fireStartDone = true

? _elecMalf and not(_elecMalfDone) : [_unit] exec "RealPlane\ElecMalf.sqs"; _elecMalfDone = true

_rnd1 = random 5

_rnd2 = random 5

_rnd3 = random 10

_rnd4 = random 5

? _rnd1 < 1 : _fuelLeak = true

? _rnd2 < 1 : _oilLeak = true

? _rnd3 < 1 and speed _unit > 50 : _fireStart = true

? _rnd4 < 1 : _elecMalf = true

~0.05

#RESET

_damage = getDammage _unit

goto "SENSOR"

#RESET2

_damage = getDammage _unit

_fuelLeak = false

_oilLeak = false

_fireStart = false

_elecMalf = false

_fuelLeakDone = false

_oilLeakDone = false

_fireStartDone = false

_elecMalfDone = false

goto "SENSOR"

OIL LEAK SCRIPT

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

; "Oil Leak" script by Bobcat

; RRAAAAAAAARRRRRRR!

; [unit] exec "OilLeak.sqs"

; Unit = unit affected

_unit = _this select 0

_unit vehicleChat "WARNING! OIL LEAK DETECTED!"

#OIL

~random 5

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : Exit

_rnd = random 20

_rnd2 = random 6

? _rnd > 0 and _rnd < 2 : _unit action ["Engine off"]; _unit setFuel 0; _unit vehicleChat "ENGINE FAILURE! THE ENGINES ARE OUT!"; Exit

? _rnd > 0 and _rnd < 5 : _unit vehicleChat "ENGINE MALFUNCTION!"; goto "ENGINE"

#SMOKE

_xPos = ((getPos _unit select 0) + random 3 - random 3)

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_rnd = _rnd - 1

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos + 1.5)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.1

? _rnd > 1 : goto "SMOKE"

goto "OIL"

#ENGINE

_xPos = ((getPos _unit select 0) + random 3 - random 3)

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

? _rnd2 <= 0 : goto "SMOKE"

_unit action ["Engine off"]

_rnd2 = _rnd2 - 1

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos + 1.5)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.5 + random 3

goto "ENGINE"

FUEL LEAK SCRIPT

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

; "Fuel Leak" script by Bobcat

; [unit] exec "FuelLeak.sqs"

_unit = _this select 0

_unit vehicleChat "WARNING! FUEL LEAK DETECTED!"

#FUEL

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : Exit

_fuelLev = fuel _unit

_fuel = _fuelLev - 0.001

_unit setFuel _fuel

~0.1

goto "FUEL"

ELECTRICAL MALFUNCTION SCRIPT

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

; "Electrical Malfunction" script by Bobcat

; RAAAAAAARRRRRRRRRRRRRRRRRR!!!!!!!

; [unit] exec "ElecMalf.sqs"

; Unit = unit affected

_unit = _this select 0

_wepList = weapons _unit

_wepCount = count _wepList

_unit vehicleChat "WARNING! ELECTRICAL MALFUNCTION DETECTED!"

#ELEC

_wepListCons = weapons _unit

_rnd = random 30

? _rnd <= 1 : goto "WEPMALF"

? not(alive _unit) : Exit

? getdammage _unit <=0.1 : _i = 0; goto "QUIT"

_unit action ["Light off"]

~random 1

_unit action ["Light on"]

~random 1

goto "ELEC"

#WEPMALF

? count _wepListCons == 0 : goto "ELEC"

_wepRnd = random count _wepListCons

? _wepRnd > 0 and _wepRnd < 1 : _wepNum = 0

? _wepRnd > 1 and _wepRnd < 2 : _wepNum = 1

? _wepRnd > 2 and _wepRnd < 3 : _wepNum = 2

? _wepRnd > 3 and _wepRnd < 4 : _wepNum = 3

? _wepRnd > 4 and _wepRnd < 5 : _wepNum = 4

? _wepRnd > 5 and _wepRnd < 6 : _wepNum = 5

_wep = _wepListCons select _wepNum

_msg = format ["WEAPON %1 IS NOT RESPONDING",_wep]

_unit vehicleChat _msg

_unit removeWeapon _wep

_wepListCons = _wepListCons - [_wepNum]

goto "ELEC"

#QUIT

_wepCount = count _wepList

? _i > _wepCount : Exit

_wep = _wepList select _i

_unit removeWeapon _wep

_unit addWeapon _wep

_i = _i + 1

~0.1

goto "QUIT"

ENGINE FIRE SCRIPT

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

; "Plane Fire" script by Bobcat

; [unit] exec "PlaneFire.sqs"

; Unit = unit affected

_unit = _this select 0

_cond = _this select 1

_unit vehicleChat "WARNING! WARNING! ENGINE FIRE!"

#FIRE

? not(alive _unit) : goto "BOOM"

? getdammage _unit <=0.1 : Exit

_time = 60

_i = random 5

#BURN

_xPos = ((getPos _unit select 0) + random 3 - random 3)

_xPos2 = ((getPos _unit select 0) + random 2 - random 2)

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_ZPos2 = ((getPos _unit select 2) + random 3)

_time = _time - 1

? not(alive _unit) : goto "BOOM"

? getDammage _unit > 0.7 and _i > 4 : goto "BOOM"

_dmg = getDammage _unit

_dmg2 = getDammage driver _unit

_dmg3 = getDammage gunner _unit

_damage = _dmg + 0.0015

_damage2 = _dmg2 + 0.0008

_damage3 = _dmg3 + 0.0008

_unit setDammage _damage

(driver _unit) setDammage _damage2

(gunner _unit) setDammage _damage3

drop ["cl_fire" , "" , "Billboard" , 1 , 1.5 , [_xPos2,_yPos,_zPos2] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [2,4] ,[[(0.4 + random 0.7),(0.4 + random 0.7),(0.4 + random 0.7),random 0.5],[(0.4 + random 0.7),(0.4 + random 0.7),(0.4 + random 0.7),random 0.5]], [0] , 0.2 , 0.2 , "" , "" , ""]

drop ["cl_basic" , "" , "Billboard" , 120 , 25 , [_xPos,_yPos,(_zPos2 + 1.5)] , [1.5,1.5,0] , 1 , 0.185 , 0.155 , 0 , [3.5,40] ,[[0.1,0.1,0.1,0.2],[0.05,0.05,0.05,0.3],[0,0,0,0.3],[0,0,0,0.2]] , [0] , 0.2 , 0.2 , "" , "" , ""]

~0.05

? _time > 1 : goto "BURN"

goto "FIRE"

#BOOM

_xPos = getPos _unit select 0

_yPos = getPos _unit select 1

_ZPos = getPos _unit select 2

_unit setFuel 1

boom1 = "Heat125" camCreate [_xPos,_yPos,_zPos]

boom2 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

boom3 = "Shell125" camCreate [_xPos,_yPos,_zPos]

boom3 = "MortarShell" camCreate [_xPos,_yPos,_zPos]

_unit setFuel 0

_unit setDammage 1

Exit

WHEEL BRAKE SCRIPT

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

; "Wheel Brake" Script by Bobcat

; RAAAAAAAARRRRRRRRRR!

; this addAction ["Wheel Brake","RealPlane\WheelBrake.sqs"]

; Must have script in dir called "RealPlane" inside of your mission directory

; USE: For emergencies and "skating". Slows down the velocity of the plane by "locking" the wheels

; NOTE: There is no way to turn off the brakes once you have turned them on. They will be released once you have stopped.

_plane = _this select 0

_hitter = _this select 1

_actionId = _this select 2

? not(_hitter in _plane) : hint "You must be in the plane in order to use this action"; Exit

? not(_hitter == driver _plane) : hint "You must be the pilot in order to use this action"; Exit

? getPos _plane select 2 > 0.3 : _plane vehicleChat "YOU ARE TOO HIGH TO USE THE WHEEL BRAKES"; Exit

#LOOP

_plane removeAction _actionId

? speed _plane > 150 : _plane vehicleChat "SPEED IS TOO HIGH TO USE WHEEL BRAKES. MAX SPEED IS 150"; goto "STOP"

? speed _plane > 100 and speed _plane < 150 :_factor = 90

? speed _plane > 50 and speed _plane < 100 : _factor = 45

? speed _plane > 25 and speed _plane < 50 : _factor = 20

? speed _plane > 10 and speed _plane < 25 : _factor = 10

? speed _plane > 1 and speed _plane < 10 : _factor = 4

? speed _plane < 1 : goto "STOP"

_xVel = velocity _plane select 0

_yVel = velocity _plane select 1

_zVel = velocity _plane select 2

_plane setVelocity [_xVel - (_xVel / _factor),_yVel - (_yVel / _factor),_zVel]

~0.1

goto "LOOP"

#STOP

_plane addAction ["Wheel Brake","RealPlane\WheelBrake.sqs"]

Exit

I hope all of you like what I posted here and can have some use to what I gave. Will continue making more if I need to/people want me to. Post your comments,questions, or requests here if you'd like.

Share this post


Link to post
Share on other sites

I might just play around with that REALPLANE set of scripts. All that's missing is an audio file to go along with those vehicleChat alarm messages.

Share this post


Link to post
Share on other sites

Bobcat, nice collection of scripts!

Agree with GB that you should submit those to www.ofpec.com...

/Christer (a.k.a KeyCat)

Share this post


Link to post
Share on other sites

Very nice work, Bobcat!

Will the extraction/insertation and the 2 vehicle-drop scripts work in mp, too?

MfG MEDICUS smile_o.gif

Share this post


Link to post
Share on other sites
Very nice work, Bobcat!

Will the extraction/insertation and the 2 vehicle-drop scripts work in mp, too?

MfG MEDICUS  smile_o.gif

YES! They will. Use them just as you would in SP and indeed they do work. Its just fun setting off a trigger/cutscene to rain in some WGL jeeps and such. Did so on a mission on a while back and everyone loved it. The insertion/extraction ones work fine too, and help a lot in COOP missions where you need AI to drive biggrin_o.gif. Thanks everyone for your input and yes indeedy, I will submit these to OFPEC soon!

Share this post


Link to post
Share on other sites
YES! They will. Use them just as you would in SP and indeed they do work.

Very cool!

So you'll get a "double-THX" from my side tounge_o.gif

Share this post


Link to post
Share on other sites

Well, I gave REALPLANE a try. Basically it just caused a swifter failure of my plane - very swift, in fact. It was sort of like the scripted effect of the fuel leaking A-10 in the CWC campaign, where the pilot thereafter is captured by the Russians.

So this script very much affects gameplay.

Share this post


Link to post
Share on other sites
Well, I gave REALPLANE a try. Basically it just caused a swifter failure of my plane - very swift, in fact. It was sort of like the scripted effect of the fuel leaking A-10 in the CWC campaign, where the pilot thereafter is captured by the Russians.

So this script very much affects gameplay.

Well, heh, that is pretty much what it was supposed to do. Its for making flying missions that much more difficult. OFP, IMO, peached down the air combat to add to more playability but after a while, I think we all get "past" that and are better skilled. the REALPLANE set is to just make it hard again and make sure we are more cautious in enemy territory (just as they are IRL)

Share this post


Link to post
Share on other sites
Well, I gave REALPLANE a try. Basically it just caused a swifter failure of my plane - very swift, in fact. It was sort of like the scripted effect of the fuel leaking A-10 in the CWC campaign, where the pilot thereafter is captured by the Russians.

So this script very much affects gameplay.

Well, heh, that is pretty much what it was supposed to do. Its for making flying missions that much more difficult.  OFP, IMO, peached down the air combat to add to more playability but after a while, I think we all get "past" that and are better skilled. the REALPLANE set is to just make it hard again and make sure we are more cautious in enemy territory (just as they are IRL)

It would be nice to have some control over the speed or level of these failures, passed to the scripts as input variables.

That would give the mission maker full control over the damagae potential and leave the effects in place.

I tried your script with Diesel's A-10 and now that plane's reputation, for flying with missing wings and one engine, is dust.

So, being able to customize the effects per plane or mission would be very usefull.

Share this post


Link to post
Share on other sites

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

? getdammage _unit <=0.1 : goto "RESET2"

Just modify this line by increasing 0.1 to something bigger to increase the damage required before any of the random effects take place. The line is under #START.

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

? getdammage _unit <=0.1 : goto "RESET2"

Just modify this line by increasing 0.1 to something bigger to increase the damage required before any of the random effects take place. The line is under #START.

I'm sure I could figure out how to customize the script for my particular needs.

I'm just suggesting an overall enhancement where, rather than hard coding such values in the scripts, they could be passed to the scripts as variables.

Share this post


Link to post
Share on other sites

Bobcat,

Thanks for posting these scripts. I'm progressing in mission writing, and am on the verge of script writing, so these are very interesting. I would like to use something similar to your loadchopper.sqs, but have some questions if you don't mind. I'm probably just going to show how little I know about scripting, but here goes anyway....

The script:

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

loadchopper.sqs - helicopter lands,people get in, takes off

[heli,groupLeader] exec loadChopper.sqs

Code Sample  

; "Land and Load Chopper" Script by Bobcat

; RAAAAAAAAAAAAAAAAAAAAAARRRRR

_group = _this select 0

_chopper = _this select 1

~0.5

_chopper flyInHeight 2

_chopper lockWp true

_loadgrp = units group _group

_chopper setSpeedMode "limited"

~random 1

_i = 0

goto "START"

#START

_dir = getDir _chopper

_trpAmount = count _loadGrp

_chopper flyInHeight 0

? getpos _chopper select 2 < 7 :  _chopper setvelocity [(velocity _chopper select 0)-(velocity _chopper select 0)/20,(velocity _chopper select 1)-(velocity _chopper select 1)/20,(velocity _chopper select 2)]

? _i >= _trpAmount : goto "STOP"

? (_loadGrp select _i) in _chopper : _i = _i + 1

~0.01

goto "START"

#STOP

_chopper lockWp false

_chopper flyInHeight 50

_chopper setSpeedMode "full"

Exit

Given the order of your parameters in the exec line

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

[heli,groupLeader] exec loadChopper.sqs

is the variable assignment the right way round?

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

_group = _this select 0

_chopper = _this select 1

Then, working through the script, I can figure out what everything does....but I can't see which bit actually orders the troops to get in the helicopter. In the Unloadchopper.sqs, you have code which unassigns squad member (n) from the chopper, and then issues him a GET OUT order. Does it need an assign statement and then a GET IN order to get the troops to get in in this script?

Also, what function does the

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

_dir = getDir _chopper

line do in the script (I know what it does, but how does this script use the returned value?)

Then, is there a reason why the line

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

_trpAmount = count _loadGrp

is inside the loop, rather than being worked out once at the start. Does the value change as the soldiers get out of the helicopter?

Lastly, is there a reason behind using a delay of

~random 1

rather than

~0.5 ?

As I said, I am a fairly newbie at mission editing, and a complete newbie at scripting, so apologies if I've asked dumb questions but the above would help me to get a grasp of the basics.

I want to use a loadchopper type script in my latest Vietnam helicopter pilot mission I'm doing. The players (2) have to return to an LZ to make an emergency extraction of a platoon (4 seperate squads/groups) they've just dropped off who have been ambushed by the enemy. I'm trying to use the 'distance' command to find the nearest squad to any helicopter which lands, and then orders that squad to get in. I think I've cracked the logic....just about. I'm a programmer/analyst by trade, so its basically just about learning another programming language really. I thought Assembler was bad enough!

Thanks in advance for any help/pointers you can give.

Mart

Share this post


Link to post
Share on other sites

Great script collection bob!

May these script be used in addons when credits are given?

Share this post


Link to post
Share on other sites
Quote[/b] ]

[heli,groupLeader] exec loadChopper.sqs

uhh..oops! yes, follow your gut man!, it is [groupLeader,heli] exec "loadchopper.sqs"

Quote[/b] ]

Then, working through the script, I can figure out what everything does....but I can't see which bit actually orders the troops to get in the helicopter. In the Unloadchopper.sqs, you have code which unassigns squad member (n) from the chopper, and then issues him a GET OUT order. Does it need an assign statement and then a GET IN order to get the troops to get in in this script?

No. the script will automatically shove everyone out besides the gunner and the pilot out of the chopper in the unload script. The load script lets you tell it what group is getting in. The chopper will move and then the script will be activated by the waypoint (takes some moving around of the waypoint to get the right approach in landing) and then it will wait on the ground until that group is in before taking off again. EDIT:

The squad must be player controlled. Was intended for multiplayer. Will make an ai version....

Quote[/b] ]_dir = getDir _chopper

That was indeed another little spoof on my end. You can delete that line from the script. it doesnt do ANYTHING but I was planning on doing something else fancy and forgot about it.

Quote[/b] ]_trpAmount = count _loadGrp

I did that to make SURE the script works because they may get killed during the time each one is getting out and if even one does, it fucks up the whollllle process (the heli might not even take off).

I did that delay just to represent "realism" in a sense. I like using random anything when I can because I feel it is important to. makes it not the same every time its executed.

Not really that big of a deal. Just what I do

Quote[/b] ]

It would be nice to have some control over the speed or level of these failures, passed to the scripts as input variables. That would give the mission maker full control over the damagae potential and leave the effects in place.

I tried your script with Diesel's A-10 and now that plane's reputation, for flying with missing wings and one engine, is dust.So, being able to customize the effects per plane or mission would be very usefull.

Well.....yeh. I tried the same thing and his a-10 got mutilated. Keep in mind though that the script at the line....

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

#SENSOR

? _damage < getDammage _unit : goto "START"

~0.05

goto "SENSOR"

..... is detecting whenever he takes ANY DAMMAGE whatsoever (_ANY). he could be at 0.11 one sec, and the very next shilka round could be 0.12. This could either give him two effects, one effect, or none at all (in just 0.01 difference in dammage). Thus, when taking small rounds fire, it is VERY easy to just get torn apart into little tiny pieces.

I will think of a way to make it more dynamic as you suggested. expect a new post up here on that within the week or so, probably.

Quote[/b] ]

Great script collection bob!

May these script be used in addons when credits are given?

YES! Of course. Use em all you'd like (as long as Im in the credits, I love you! :P). Also, just keep in mind I am going to be getting into more batches of these soon as the school semester is ending. Also, for sure new control scripts of realplane and realchopper will be made as well!

Share this post


Link to post
Share on other sites
Quote[/b] ]

I will think of a way to make it more dynamic as you suggested. expect a new post up here on that within the week or so, probably.

That sounds good smile_o.gif . Can it be done with a formula?

Perhaps you can make the getdammage delay proportional to the reciprocal of the damage?

Something like:

_delay = (1 / (getdammage _unit)) * _k

where _k is a constant.

Share this post


Link to post
Share on other sites
Quote[/b] ]

That sounds good . Can it be done with a formula?

That was exactly what I was planning on doing. I could make it user defined with a "suggested" amount in the comments section. I dont have to change any of the other scripts besides the main controllers (realplane.sqs/realchopper.sqs)

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  

×