View Single Post
Old 23-10-2009, 11:08 AM   #1 (permalink)
Adamdf
Member
 
Join Date: Oct 2009
Posts: 34
Default This is Driving me Mad!!!!! HELP!!!!

Basically iv managed to get spwaned AI to move to a waypoint, and iv managed to end a mission when Objectives are complete, however, i cant seem to get the 2 to work together, its driving me mad please help.

I have the 1st group of enemies spawn when i enter a trigger, 1st objective is Take them out, once they are all dead the 2nd wave should spawn and run to the waypoint, 2nd objective is take them out and the mission should end, but basically that aint happenin, and its driving me insane,

Heres the Script:

-- Script

function onEnter(triggerzone, player)
EnemySpawn = OFP:activateEntitySet("enemy");
OFP:addTimer("waiting", 2000)
end

function onTimer()
OFP:move("Echelon", "wp", "OVERRIDE")
end

function onDeath(victim, killer)
if OFP:isAlive("Echelon")== false then
OFP:destroyEntitySet("Enemy");
OFP:activateEntitySet("Enemy2");
OFP:addTimer("waiting", 2000)
end

function onTimer()
OFP:move("Echelon1", "wp1", "OVERRIDE")
end
end

Objstate = 0;
function onMissionStart()
OFP:setObjectiveState("obj","IN_PROGRESS")
OFP:setObjectiveState("obj2","IN_PROGRESS")
end

function onDeath(victim, killer)
if OFP:isAlive("Echelon")== false then
OFP:setObjectiveState("obj", "COMPLETED");
objstate =1;
end
end

function onDeath(victim, killer)
if OFP:isAlive("Echelon1")== false then
OFP:setObjectiveState("obj2", "COMPLETED");
objstate =1;
end
end

function onObjectiveCompleted(obj, obj2)
if OFP:getObjectiveState("obj") == "COMPLETED" and
OFP:getObjectiveState("obj2") == "COMPLETED" then
OFP:missionCompleted()
end
end
Adamdf is offline   Reply With Quote