![]() |
|
|
||||||
| Operation Flashpoint: Dragon Rising - Mission Editing and Modding Chat Zone A little area for all you mission editors and modders to chat and discuss ideas. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
19-10-2009, 01:21 PM
|
#1 (permalink) |
|
Member
Join Date: Aug 2009
Posts: 81
|
Hello,
I've thrown together a map with 6 objectives. What I want to do is figure out how to make the objectives that are in progress turn to failed if the user decides to finish the mission by entering a trigger zone. A copy of my script is shown below: -------------------------------------------------------------------- ------------------Objectives + Mission Start------------------------ function onMissionStart() OFP:setObjectiveState("objective1", "IN_PROGRESS"); OFP:setObjectiveState("objective2", "IN_PROGRESS"); OFP:setObjectiveState("objective3", "IN_PROGRESS"); OFP:setObjectiveState("objective4", "IN_PROGRESS"); OFP:setObjectiveState("objective5", "IN_PROGRESS"); OFP:setObjectiveState("objective6", "IN_PROGRESS"); OFP:mountVehicle("players", "helo", "any", "OVERRIDE"); ----Helo Data OFP:setVehicleMountableStatus("helo", 1); ----Helo Data OFP:setVehicleMountableStatus("tanks", 0); ----Tanks mountable status OFP:addTimer("zoneTimer", 30000); ----Enemy timer Sec Obj 1 OFP:addTimer("zoneTimer2", 30000); ----Enemy timer Sec Obj 5 OFP:blockCommandAndReportFeedback(false); ----Annoying HQ messages end -------------------------------------------------------------------- ------------- Countdown for Air strike and Objective one ----------- function onEnter_triggerzoneart (zoneName, unitName) OFP:addTimer("arty",180000) OFP:setObjectiveState("objective1","COMPLETED"); OFP:displaySystemMessage("Message from HQ","Soldier, provide overwatch and await confirmation on use of JDAM support. This is HQ, out.") end function ontimer_arty() OFP:displaySystemMessage("Soldier, CAS support is now available. Use at your own disgression. This is HQ out.") OFP:enableAirStrike(0, "JDAM", true) OFP:enableEvent("offboardSupport") end -------------------------------------------------------------------- ---------------------------Objective Two --------------------------- function onDeath() if OFP:isAlive("tanks") == false then OFP:setObjectiveState("objective2","COMPLETED"); end end -------------------------------------------------------------------- --------------- Hele land collection and wait ---------------------- function onMount(vehicleName, unitName, echelonName) if OFP:isAllMounted("players") == true then OFP:rapidMove("helo", "heledrop", "OVERRIDE"); end end function onArriveAtWaypoint_helo_heledrop(entityName, waypointName) OFP:land("helo","OVERRIDE"); end function onLand_helo(HelicopterName) OFP:dismountVehicle("players","OVERRIDE"); end function onDismount_helo(vehicleName, unitName, echelonName) if OFP:isAnyMounted("players") == false then OFP:rapidMove("helo","pickup","OVERRIDE"); end end -------------------------------------------------------------------- --------------------------Objective Four --------------------------- function onTimer_zoneTimer() OFP:removeTimer("zoneTimer"); not_clear = OFP:isInTrigger("enemygroup", "zoneTimer") if not_clear == false then OFP:setObjectiveState("objective4", "COMPLETED") end OFP:addTimer("zoneTimer", 30000); end -------------------------------------------------------------------- --------------------------Objective Six ---------------------------- function onDeath_Han(victim, killer) if OFP:isAlive("han") == false and OFP:isAlive("zheng") == false then OFP:setObjectiveState("objective6","COMPLETED") end end -------------------------------------------------------------------- ------------------------ Objective Five ---------------------------- function onTimer_zoneTimer2() OFP:removeTimer("zoneTimer2"); not_clear = OFP:isInTrigger("enemygroup2", "zoneTimer2") if not_clear == false then OFP:setObjectiveState("objective5", "COMPLETED") end OFP:addTimer("zoneTimer2", 30000); end -------------------------------------------------------------------- ----------------------- Objective Three ---------------------------- function onEnter_end (zoneName, unitName) OFP:setObjectiveState("objective3","COMPLETED"); OFP:missionCompleted(); end -------------------------------------------------------------------- ----------------------- End ---------------------------------------- function onDeath(victim, killer) alive=OFP:isAlive("players"); if alive==false then OFP:missionFailed() end end Thanks, Rob |
|
|
19-10-2009, 01:30 PM
|
#2 (permalink) |
|
Senior Member
Join Date: Jul 2009
Posts: 172
|
I don't know if this will work, but it's wort a try:
At first, above all other script write obj1 = 0 obj2 = 0 obj3 = 0 obj4 = 0 obj5 = 0 obj6 = 0 Then, after all the OFP:setObjectiveState("objectiveX", "COMPLETED") events, write objX = 1 Then at the buttom write: function onEnter_triggerzone(zoneName, unitName) if obj1 = 0 then OFP:setObjectiveState("objective1", "FAILED") end if obj2 = 0 then OFP:setObj.... and so on.. |
|
|
19-10-2009, 01:44 PM
|
#4 (permalink) |
|
Senior Member
Join Date: Oct 2009
Posts: 172
|
You'll want
Code:
function onAllPlayersDead() OFP:missionFailedKIA() end Code:
function onEnter_end (zoneName, unitName)
if OFP:getObjectiveState("objective6") == "IN_PROGRESS" then
OFP:setObjectiveState("objective6","FAILED")
end
OFP:setObjectiveState("objective3","COMPLETED");
OFP:missionCompleted();
end
__________________
Download the Improved AI mod by TemplarGFX |
|
|
19-10-2009, 01:55 PM
|
#5 (permalink) | |
|
Senior Member
Join Date: Jul 2009
Posts: 172
|
Quote:
|
|
|
|
19-10-2009, 01:55 PM
|
#6 (permalink) | |
|
Member
Join Date: Aug 2009
Posts: 81
|
Quote:
|
|
|
|
19-10-2009, 02:04 PM
|
#8 (permalink) |
|
Senior Member
Join Date: Oct 2009
Posts: 172
|
"objective3" and "unitname" and such are strings.
Just use multiple if/thens within the function. Feeling lazy, so here's an example kinda sorta I wrote for someone else to show what it looks like: Code:
function onEnter_trigzone()
OFP:addTimer("Timer",1000)
end
function onTimerTimer()
if OFP:isAlive("Sabre1") == false then
obj = obj +1;
end
if OFP:isAlive("Sabre2") == false then
obj = obj +1;
end
if OFP:isAlive("Sabre3") == false then
obj = obj +1;
end
if OFP:isInTrigger("Sabre1","trigzone") == true then
obj = obj +1;
end
if OFP:isInTrigger("Sabre2","trigzone") == true then
obj = obj +1;
end
if OFP:isInTrigger("Sabre3","trigzone") == true then
obj = obj +1;
end
if obj == 3 then
OFP:missionCompleted()
end
OFP:setTimer("Timer",1000)
end
__________________
Download the Improved AI mod by TemplarGFX |
|
|
19-10-2009, 05:14 PM
|
#10 (permalink) |
|
Senior Member
Join Date: Oct 2009
Posts: 178
|
i was going to ask something but i wanted to let you get your prolem sorted before i hijacked your thread
![]() this is for anyone that may know it is the way cell wrote it better then using the simple if obj == 1 then, i mean is it more stable or able to add more ojectives then with the other. Last edited by norcal21; 19-10-2009 at 05:17 PM. |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|