Scripts / [SOLVED] Coin Collect Game and radar.

Author
Message
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 20th Jul 2022 15:41
I'm trying to add the coins that you need to collect from the Coin Collect cartoon demo that came with game guru. I thought I'd reach out for help here.

Coin Collect script:
function coincollect_init(e)
end

function coincollect_main(e)

PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 then
PlaySound(e,0)
CoinCount=CoinCount+1
Destroy(e)
end

end


------------------------RADAR objective script:
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

The author of this post has marked a post as an answer.

Go to answer
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 20th Jul 2022 15:51
No luck with this try:

haveAddedObjective = {}
function coincollectRADAR_init(e)
haveAddedObjective[e] = 0
end

function coincollectRADAR_main(e)
if haveAddedObjective[e] == 0 then
if addObjective ~= nil then
addObjective(e)
end
haveAddedObjective[e] = 1
end
PlayerDist = GetPlayerDistance(e)

if PlayerDist < 80 then
PlaySound(e,0)
CoinCount=CoinCount+1
PromptDuration("You have reached an objective",3000)
Destroy(e)
end
end
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Jul 2022 16:29
This post has been marked by the post author as the answer.
looks like it should be fine but no capital letters in script name or init() / main() function names
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 21st Jul 2022 14:04
smallg, that was it! Thank you. I changed RADAR to radar.

Thanks!!

Login to post a reply

Server time is: 2024-04-20 00:21:37
Your offset time is: 2024-04-20 00:21:37