Hi Nuncio, this may help...
-- use to add objectives to your level
haveAddedObjective = {}
--g_KillCount = 5
function collectable_objective_init(e)
haveAddedObjective[e] = 0
end
function collectable_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
TextColor(34,84,4,"You found a time anomaly. Press E to repair." ,255,255,255)
if g_KeyPressE == 1 then
g_KillCount = g_KillCount + 1
PlaySound(e,0)
SetEntityHealth(e,0)
Destroy(e)
end
end
-- Prompt("Kills " .. g_KillCount)
end
I had to change a few things to get it to work and deleted some code which I'm guessing is not needed as they were not global variables. I change the function and init names so rename file to collectable_objective.lua
All you need to do now is add this code to your collectable, in the properties set Static Mode: No.
No need for any other script or floor decal under the collectable.
Now test.
If you want the collectable to stay in area for next time then don't use the Destroy(e) command use a Hide(e) on a timer. Then it should come back after a set amount of time using Show(e).
If you need to change the colour of objective / collectable icons on the radar then watch DVader you tube videos here:
Using the radar script - How to use and configure by DVader
This is also a good thread
How can erase the Objectives on the radar? by Old Larry
I hope this helps.
Dark Base 900 Pro OJ: Rampage V Ed.10, i7 6950x non-OC, DDR4-3333 64 GB RAM, Win 10/64, Asus Strix GeForce 1080 x 2 MDA mode, Water cooled with an old Victorian cast iron radiator and a industrial leather belt driven fan - That's what you call Steampunked.
Laptop - M17xR3