How do I make a 2nd objective color in the Radar? Say my game has 2 objective types... and I want the radar to reflect 2 types...
Also I have no coding or scripting experience at all... Zero, Zilch...
Example
Barrel1 = objective.lua (yellow) <- This I can do
Barrel2 = objective2.lua (white) <- This I can not do
What I think I know:
- Create ''radar-white.png' in the scriptbank\radar folder
- Add 'radarImageWhite = 0' in the radar.lua header
- Add 'radarImageWhite = LoadImage ( "scriptbank\\radar\\radar-white.png" )' in the radar.lua function radar_int
- My guess is I need to write a 'function addObjective2 (i)'
2 Questions
1) How do I write the function for a 2nd objective in the radar.lua?
function addObjective (i)
g_objectiveCount = g_objectiveCount + 1
radarObjectives[g_objectiveCount] = i
radarObjectiveSprites[g_objectiveCount] = CreateSprite( radarImageYellow )
SetSpriteSize ( radarObjectiveSprites[g_objectiveCount] , 0.5 , -1 )
SetSpriteOffset ( radarObjectiveSprites[g_objectiveCount] , 0.25 , -1 )
SetSpritePosition ( radarObjectiveSprites[g_objectiveCount] , 200 , 200 )
end
2) How would I write an objective_2.lua and reference my new objective2 function in the radar.lua.
haveAddedObjective = {}
function objective_init(e)
haveAddedObjective[e] = 0
end
function objective_main(e)
if haveAddedObjective[e] == 0 then
if addObjective ~= nil then
addObjective(e)
end
haveAddedObjective[e] = 1
end
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 150 and g_PlayerHealth > 0 then
PromptDuration("You have reached an objective",3000)
PlaySound(e,0)
SetEntityHealth(e,0)
Destroy(e)
end
end
Thank you in advance for your assistance.