Get SaintAxe&Ror SpeechMaker Now And build your conversations easily ! |
This is a page that displays some short How-To to help using OFDR Mission Editor for basic mission editing.
These How-To are not the "best way" or are not endorsed by CodeMasters in any way. They are just the result of the long time I spent coding a lot of Single Player / Coop missions with simple and complex scripting (+ 115) .
Link : Official LUA Documentation
HOWTO 5 : Using Fire Support
This is a very simple mission that shows you how to use Fire Support (Artillery or Air support)
The scenario is :
The player look at Armudan Village and search for smoke. Smoke starts to indicate the next target that will be attacked by the use of Fire support programmatically. Finally, fire support is available for him and the player must manually destroy the containers by using fire support he wants.
Here is the complete level.lua :
-- -------------------------------------------------------- -- -- __ _ _ _ __ -- -- / _\ __ _(_)_ __ | |_ /_\ __ _____ /__\ ___ _ __ -- -- \ \ / _` | | '_ \| __|//_\\\ \/ / _ \/ \/// _ \| '__| -- -- _\ \ (_| | | | | | |_/ _ \> < __/ _ \ (_) | | -- -- \__/\__,_|_|_| |_|\__\_/ \_/_/\_\___\/ \_/\___/|_| -- -- -- -- -------------------------------------------------------- -- -- OFP Dragon Rising -- HOWTO 5 : Using Fire Support -- Author : Thierry Godin (SaintAxe&Ror) -- Web : http://sar.n1bus.eu -- Date de creation : 10/01/2012 function onMissionStart() OFP:displaySystemMessage("HOWTO 5 : Using Fire Support 1.0.0") OFP:displaySystemMessage("Thanks for playing SaintAxe&Ror mission") OFP:displaySystemMessage("Other stuff here = http://sar.n1bus.eu") OFP:displaySystemMessage("Have fun !") OFP:setInvulnerable("echSAR", true) OFP:addTimer("timerBomb1", 5000) end -- --------------------------------------------------------------- -- BOMB -- --------------------------------------------------------------- function onTimer_timerBomb1() OFP:removeTimer("timerBomb1") OFP:startParticleSystem("psSmoke1", 0) -- we start smoke 1 -- we call ArtilleryStrike OFP:callArtilleryStrike(1, "missilelauncher", "Mortar", "HE", "Single", 10000) OFP:displaySystemMessage("Call Artillery on Missile launcher South : HE/Single Shot") OFP:addTimer("timerBomb2", 30000) end function onTimer_timerBomb2() OFP:removeTimer("timerBomb2") OFP:stopParticleSystem("psSmoke1") -- we stop smoke 1 OFP:startParticleSystem("psSmoke2", 0) -- we start smoke 2 -- we call ArtilleryStrike OFP:callArtilleryStrike(1, "jeep", "HeavyMortar", "Smoke", "Harassing", 10000) OFP:displaySystemMessage("Call Artillery on Jeep South-East : Smoke/Harassing") OFP:addTimer("timerBomb3", 30000) end function onTimer_timerBomb3() OFP:removeTimer("timerBomb3") OFP:stopParticleSystem("psSmoke2") -- we stop smoke 2 OFP:startParticleSystem("psSmoke3", 0) -- we start smoke 3 -- we call ArtilleryStrike OFP:callArtilleryStrike(1, "tank", "HeavyMortar", "HE", "Tight", 10000) OFP:displaySystemMessage("Call Artillery on Tank South : HE/Tight") OFP:addTimer("timerBomb4", 30000) end function onTimer_timerBomb4() OFP:removeTimer("timerBomb4") OFP:stopParticleSystem("psSmoke3") -- we stop smoke3 OFP:startParticleSystem("psSmoke4", 0) -- we start smoke 4 -- we call AirStrike OFP:callAirStrike(1, "apc", "JDAM") OFP:displaySystemMessage("Call Air Strike on APC South-West : JDAM") OFP:addTimer("timerBomb5", 30000) end function onTimer_timerBomb5() OFP:removeTimer("timerBomb5") OFP:stopParticleSystem("psSmoke4") -- we stop smoke4 OFP:startParticleSystem("psSmoke5", 0) -- we start smoke 5 OFP:displaySystemMessage("Now, fire support is available for the Team Leader") OFP:displaySystemMessage("Press right-Shift and call fire support on the containers South-West") -- we enable Artillery Strike for the team leader OFP:enableArtilleryStrike(0, "Mortar", "HE", true) -- we allow an amount of shells for this type of Artillery Strike OFP:setArtilleryStrikeCount(0, "Mortar", 2) OFP:enableArtilleryStrike(0, "HeavyMortar", "HE", true) OFP:setArtilleryStrikeCount(0, "HeavyMortar", 5) OFP:enableArtilleryStrike(0, "Howitzer", "HE", true) OFP:setArtilleryStrikeCount(0, "Howitzer", 1) -- we enable also Air Strike for the team leader OFP:enableAirStrike(0, "Small", true) -- we allow an amount of bombs for this type of Air Strike OFP:setAirStrikeCount(0, "Small", 2) OFP:enableAirStrike(0, "Large", true) OFP:setAirStrikeCount(0, "Large", 2) OFP:enableAirStrike(0, "JDAM", true) OFP:setAirStrikeCount(0, "JDAM", 1) end function onPlaceableKill_container(placeable, attacker) -- When container is destroyed, game is over OFP:addTimer("timerEnd", 20000) end -- ------------------------------- function onTimer_timerEnd() OFP:missionCompleted() end function onAllPlayersDead() OFP:missionFailedKIA(); end
1. The first thing you have to do :
When building a mission by using OFDR Mission Editor is to put the Artillery and Air Support element on the map .
If you forget that first step, Fire Support will never work on your map.
Even if you plan to use Fire Support several times or in several locations, you do need to put only one Fire Support element on the map.
Fire Support element is in Create panel -> System -> Mission -> Artillery and air support
2. Using Fire support in the mission :
You can call for Air Strike or Artillery Bombardment programmatically when you need it. Simply add in a function or and event the lines below :
OFP:callArtilleryStrike(1, "missilelauncher", "Mortar", "HE", "Single", 10000)
callArtilleryStrike(Army, Target, AmmoSize, AmmoType, FormationType, HitTime)
Army: 0 US, 1 PLA,
Target: The target for the strike to attack (This can be anything – vehicles, people, buildings, etc.).
AmmoSize: The size of the ammunition: Mortar, HeavyMortar or Howitzer.
AmmoType: The type of the ammunition: Smoke, HE (Illumination does not work).
FormationType: The formation of the strike: Barrage, Scattered, Tight, Harassing or Single.
HitTime: The time of delay before the artillery are released.
OFP:callAirStrike(1, "apc", "JDAM")
callAirStrike(Army, Target, AmmoType)
Army: 0 US, 1 PLA,
Target: The target for the strike to attack (This can be anything – vehicles, people, buildings, etc.).
AmmoType: The type of the ammunition: Small, Large, JDAM.
3. You can also allow the fireteam leader to call support himself:
Support will be available by pressing Right-Shift on keyboard.
In the code below, I set the amount of available strikes programmatically, but you can set this by selecting the Fire Support element on the map, then go in Modify panel and set each support type.
-- we enable Artillery Strike for the team leader OFP:enableArtilleryStrike(0, "Mortar", "HE", true) -- we allow an amount of shells for this type of Artillery Strike OFP:setArtilleryStrikeCount(0, "Mortar", 2) OFP:enableArtilleryStrike(0, "HeavyMortar", "HE", true) OFP:setArtilleryStrikeCount(0, "HeavyMortar", 5) OFP:enableArtilleryStrike(0, "Howitzer", "HE", true) OFP:setArtilleryStrikeCount(0, "Howitzer", 1) -- we enable also Air Strike for the team leader OFP:enableAirStrike(0, "Small", true) -- we allow an amount of bombs for this type of Air Strike OFP:setAirStrikeCount(0, "Small", 2) OFP:enableAirStrike(0, "Large", true) OFP:setAirStrikeCount(0, "Large", 2) OFP:enableAirStrike(0, "JDAM", true) OFP:setAirStrikeCount(0, "JDAM", 1)
Important : Do not forget to set the first parameter to 0 if the fireteam leader is in US Army otherwise the support will not be available for him
Note : When playing COOP online with friends, only the Fireteam Leader can call Fire Support
Download
Download MSSN file : SAR_HT5_Bomb.zip
