Go Back   Codemasters Forums > Action, RPG and Strategy Games > Operation Flashpoint: Dragon Rising > English > Operation Flashpoint: Dragon Rising - Mission Editing and Modding Chat Zone
Sign In
Register on CodeM

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.

Reply
 
LinkBack Thread Tools Display Modes
Old 19-10-2009, 01:21 PM   #1 (permalink)
Member
 
Join Date: Aug 2009
Posts: 81
Default How to fail in progress objectives upon entering mission complete trigger zone.

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
Rob-London is offline   Reply With Quote
Old 19-10-2009, 01:30 PM   #2 (permalink)
Senior Member
 
Join Date: Jul 2009
Posts: 172
Default

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..
xDumDumx is offline   Reply With Quote
Old 19-10-2009, 01:42 PM   #3 (permalink)
Member
 
Join Date: Aug 2009
Posts: 81
Default

so for example:

function onDeath()
if OFP:isAlive("tanks") == false then
OFP:setObjectiveState("objective2","COMPLETED") obj2 = 1;
end
end
Rob-London is offline   Reply With Quote
Old 19-10-2009, 01:44 PM   #4 (permalink)
Senior Member
 
Join Date: Oct 2009
Posts: 172
Default

You'll want

Code:
function onAllPlayersDead()
OFP:missionFailedKIA()
end
and
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
Cellus is offline   Reply With Quote
Old 19-10-2009, 01:55 PM   #5 (permalink)
Senior Member
 
Join Date: Jul 2009
Posts: 172
Default

Quote:
Originally Posted by Cellus View Post
You'll want

Code:
function onAllPlayersDead()
OFP:missionFailedKIA()
end
and
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
Yeah ,listen to him. That's easier..
xDumDumx is offline   Reply With Quote
Old 19-10-2009, 01:55 PM   #6 (permalink)
Member
 
Join Date: Aug 2009
Posts: 81
Default

Quote:
Originally Posted by Cellus View Post
You'll want

Code:
function onAllPlayersDead()
OFP:missionFailedKIA()
end
and
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
What would the string look like if I wanted to add multiple objectives?
Rob-London is offline   Reply With Quote
Old 19-10-2009, 02:00 PM   #7 (permalink)
Senior Member
 
Join Date: Jul 2009
Posts: 172
Default

Quote:
Originally Posted by Rob-London View Post
so for example:

function onDeath()
if OFP:isAlive("tanks") == false then
OFP:setObjectiveState("objective2","COMPLETED") obj2 = 1;
end
end
Yup, but obj2 = 1 should stand on the next line
xDumDumx is offline   Reply With Quote
Old 19-10-2009, 02:04 PM   #8 (permalink)
Senior Member
 
Join Date: Oct 2009
Posts: 172
Default

"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
Cellus is offline   Reply With Quote
Old 19-10-2009, 05:10 PM   #9 (permalink)
Member
 
Join Date: Aug 2009
Posts: 81
Default

Cellus,

What would I do without you?!?!??!! Dude, honestly thanks a ton! Would you like to play my new map once it's completed?


Regards,

Rob
Rob-London is offline   Reply With Quote
Old 19-10-2009, 05:14 PM   #10 (permalink)
Senior Member
 
norcal21's Avatar
 
Join Date: Oct 2009
Posts: 178
Default

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.
norcal21 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.