Scripts / [SOLVED] using radar script and trying to count collected items

Author
Message
chromatic3d
12
Years of Service
User Offline
Joined: 7th Oct 2011
Location: rnd
Posted: 5th Dec 2020 20:28
I am using radar script and trying to count collected items. Radar works fine and items are removed from radar when found. However objects are still text prompted as found when you come back to same location. Not that big a deal but why if object was distroyed would it still be detected. Also I am trying to count object collected. I put a g_pres=g_pres+1 in main func of objective.lua but it keeps increasing when near where location was both before and after objective is removed. Is it okay to post the code even if I am only augmenting it and did not write the original? I also tried to put count in an exit part of objective.lua and it did not count at all. That seems strange that it would not. Am I missing something about lua here?

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

Go to answer
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Dec 2020 22:58
This post has been marked by the post author as the answer.
you have the objective item set to alwaysactive = yes which means the script will still run as it can't be destroyed
if you need the objective item to always be active for some reason you can swap state to make the script not run the unwanted code... i.e.




to count how many you have collected use a variable in the radar script (which does need to be alwaysactive = yes) like "objectives_collected = 0" then in the objective.lua above Destroy(e) put "objectives_collected = objectives_collected + 1"
then you can prompt / use that variable as you need
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
chromatic3d
12
Years of Service
User Offline
Joined: 7th Oct 2011
Location: rnd
Posted: 6th Dec 2020 00:45
Thank you smallg. I forgot to try that as I was using a lot of non static always active items. Still learning. I have used you fishing code in a game I will post in WIP soon. Waiting on funds to clear in my paypal so expect a donation in 1 to 3 more days.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Dec 2020 15:13
awesome to hear my scripts are coming in useful.. i think fishing would be a good one to update to Max - do you have any improvements you would like to see added or changed?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Dec 2020 18:48
no fishing script can be complete without some fish so for the first part i have rewritten the fish script to update it for Max - works much better imo (shown in GG classic as Max doesn't support water yet)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
chromatic3d
12
Years of Service
User Offline
Joined: 7th Oct 2011
Location: rnd
Posted: 8th Dec 2020 05:00
I have posted my WIP in the WIP thread. I have yet to move the text or rather use hide radar yet. I did not use fish lua only because the fish hid and they look great I want to see them so didn't take time to figure what I did wrong. This game is more of a screen saver or a xmas postcard than realistic. If fact I use only the expert bait and rod and it is still a little too hard for me. I would like to make it easier for younger kids. You made a great fishing game. It will take me some more time to add extra rods and figure where to place the bait. Also I wanted to add a fish total like the presents total to the hud. The new fish script looks great.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Dec 2020 16:24
Quote: " I would like to make it easier for younger kids. You made a great fishing game. It will take me some more time to add extra rods and figure where to place the bait. Also I wanted to add a fish total like the presents total to the hud. The new fish script looks great."

ok i will make sure to allow easy changing of the difficulty - i'm thinking this time i will do some direction based challenge - i.e. move the mouse left / right / up or down when prompted so i will probably just let you adjust the timers again before the fish escapes
here's a sneak peak of what i have so far

as you can see i need to add the actual part of catching the fish but i think it's looking good so far
might take a while for me to make a few fishing rods and models to go with it unless anyone else is feeling generous enough to join in or knows where i can find some to share?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
chromatic3d
12
Years of Service
User Offline
Joined: 7th Oct 2011
Location: rnd
Posted: 9th Dec 2020 06:13
That looks great. I have yet to model things. I got a rod from the store. I wanted to make sure I could make a good game before creating assets for a game. Should we move this to your scripting thread so more eyes will see it?

Login to post a reply

Server time is: 2024-04-26 17:07:09
Your offset time is: 2024-04-26 17:07:09