Scripts / Oops, I did it again! Hidden object game anyone?

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Sep 2017 17:18 Edited at: 4th Sep 2017 08:56
So I went off to my caravan with every intention of further work on vehicle/mech scripts but as usually happens I ended up on a completely different track entirely.

My grandson loves those Big Fish games (we have hundreds of them!) where you have to find hidden objects so while watching him play I got to wondering if I could do the same in GG with a script and make it really easy to use.

The answer turned out to be yes to both and here is the result:



Not sure if the attached fpm will work as I've saved it on the new Beta but feel free to give it a try.

I've included the zone script as well as the fpm uses it.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
=VX=Doggy
15
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 4th Sep 2017 04:22
Very cool. I hope you finish the vehicle scripts though!
PM
=VX=Doggy
15
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 4th Sep 2017 04:59
scriptbank zip wont open.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Sep 2017 09:09
Oops, don't know what went wrong there but I've replaced it now.

I also fixed the object detection to work when the player is 'ducked'.

To make your own HOG simply attach the ho_findable.lua script to all the objects you want the player to find (make them always active and change the entity name to suit, i.e. if you have 20 different styles of teapot just call them all 'Teapot' so the script can display Teapot*20).

In the script there is a list of zones, defaulted to 2 zones called 'HOZone1' & 'HOZone2', use the zones.lua script to create as many zones as you need (see the zones thread for details on how to do that) and edit the list to match.


Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 4th Sep 2017 10:07
thank you very much this is brilliant
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
JPH-GAMES
3D Media Maker
9
Years of Service
Recently Online
Joined: 13th Feb 2015
Location: Belgique
Posted: 4th Sep 2017 16:48
Still a very beautiful work
great thanks to you AmenMoses
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 4th Sep 2017 17:16
This is really great! Thanks!
PM
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 5th Sep 2017 14:59
Wow Amen!!! Really... Really... Really... Great!!!!
Felicitations!!!
The game is a serious thing (El juego es una cosa seria)
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Sep 2017 04:57
Why yes you did. Another great addition. Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 6th Sep 2017 08:08
Nice work AM, very impressive.

If i wanted to add just the decal part to a normal E to pick up script, which parts would i need? I love the decal thing, but not sure how to add it to a normal pickup.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Sep 2017 09:29
@Belidos, the ho_decal.lua script has a function called ho_ShowDecal with 7 parameters:
x, y, z, - 3d position
xA, yA, zA, - 3d rotation
t - time to display in milliseconds

The 3d rotation is required because the RotateToCamera command only rotates in Y.

So simply add a call to that function from your pick-up script when you press E. Pass x,y.z of the entity and player angles i.e. g_PlayerAngX, g_PlayerAngY, g_PlayerAngZ.

So the code would look like:



The y + 20 bit is to raise the decal slightly as by default most objects have their y origin at the base so if they are sitting on the ground the decal would otherwise be sunk into the terrain. You may need to fiddle with the value depending on the decal you use. Also you may need to play with the 'Scale(e, 200)' line in ho_decal_init to make the decal you choose an appropriate size.

Make sure the decal is 'always active' btw otherwise when the player gets a certain distance from it it all stop working!
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 8th Sep 2017 08:19 Edited at: 8th Sep 2017 08:24
Great thanks Amen, i'll give it a go tonight when i get home. Hopefully it's as easy as you make it sound

It's also given me another idea for my pick up scripts, i've been using Rolfy's interactive scripts for the hand icon on pickups, but it's a little glitchy because it uses weapon switching and the hand is a custom weapon and sometimes it doesn't switch properly so you end up stuck with the hand icon shooting people lol, so i stopped using it and went back to E to pick up. But your script inspired me to realize i could simply use PasteSprite to move a hand sprite to the middle of the screen whenever it's over an object, woulds still need to use E to pickup, but would be a nice half way compromise

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
AceRimmer
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 10th Sep 2017 14:24 Edited at: 10th Sep 2017 14:42
Great!
Only small problem: no decal showing at first. everything else works a treat.

found this.
720402 : File Not Found (entitybank\\Decals\Decals2\strangepower.fpe) info:entitybank\\Decals\Decals2\strangepower.bin S:0MB V: (972,670

Fixed when I rearranged my folders to match the path above and place the decal on the map.

smug mode, little victories etc.
Posted as it might help someone else.
its like deja-vu, but all over again, again
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Sep 2017 18:21
Ah, yes I forgot I used a non-standard decal, for those who don't have that one just replace it with a decal of your choosing.
Been there, done that, got all the T-Shirts!
PM
Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 12th Sep 2017 00:27
Once again AWESOME!
Jim C
devlin
10
Years of Service
User Offline
Joined: 12th Feb 2014
Location:
Posted: 18th Sep 2017 16:49
Thank you
PM
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 2nd Nov 2017 13:38
Very Nice script. Awesome! Thanks a lot!
You know you watched too many of Lee's Live Brodcasts when you're at work and have an earwig from his twitch intro music....

By the way, I am a Modder, Soundtrack Composer and now Game Developer. Well, sort of.

Windows 10 64bit - Intel Core i7-2600 CPU @ 3.40GHz, 8,0 GB Ram, Geforce GTX 1050ti
Find some my work onYoutube:
(Music Channel) The German Music Dude: https://www.youtube.com/user/DeutscherVolker
(Games and Mods Channel ) DK Productions: https://www.youtube.com/channel/UCIqwvScXnJL_zNYqSsfTCqA



beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 29th Nov 2017 19:53
hello ! this script is just what i need for my Murmia game but for some reason i just cant make it work. i also do not really understand the zone thing that is mentioned. any help would be very much appreciated!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Nov 2017 20:36
Here is the link to the zones thread:

https://forum.game-guru.com/thread/218470#msg2584479

Basically you use waypoints to define named zones then within your scripts you can easily detect when the player or other object enters or leaves a zone.

The zones can be any shape and size and can even overlap each other.
Been there, done that, got all the T-Shirts!
PM
beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 30th Nov 2017 02:26 Edited at: 30th Nov 2017 02:38
many thanks for the quick reply!
i now got it working ! i had objects set to static that was why it did not work at first.

can i customize the cursor png image?
or even better have the cursor only appear if hovered over collectable objects ?

ah and i cant make the decal work for some reason...
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Nov 2017 08:25
The whole point of hidden object games is sort of defeated if you only show the cursor when over a hidden object so I assume you're using this in a different way.

For all my scripts I recommend entities are set 'always active', vsynch on in the ini file, and for things like decals set physics 'off'.

Customise as much as you want to.
Been there, done that, got all the T-Shirts!
PM
beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 30th Nov 2017 18:34
hey yeah you are right about that
thanks again for the help!!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 1st Dec 2017 19:19 Edited at: 3rd Dec 2017 17:31
hello
sorry for bumping this!

i want to add a sound-effect to the script - so in the moment of picking up an item it plays a sound effect.
any help on how to achieve this would be very much appreciated !

i´m trying to add the PlaySound(e,0) command to the hofindable script. looking at other scripts i figured it could maybe work.but i dont know where exactly to put it.
i have been trying to add the sound effect without luck.... anybody can help ?
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Dec 2017 09:21
Just put it at the point in the script where the decal is shown, i.e.:

| if delObj ~= nil then
| if ho_ShowDecal ~= nil then
| ho_ShowDecal(sox, soy, soz, sxA, syA, szA, 500)
| end
| Destroy(delObj)
| objects[delObj].found = true

In my copy that's at line 181-186.
Been there, done that, got all the T-Shirts!
PM
beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 4th Dec 2017 12:23 Edited at: 4th Dec 2017 17:17
i tried to insert the PlaySound(e,0) command at that place with several approaches but i´m doing something wrong.
i tried to squeeze the command in-between, at start, at the end of the lines. i replaced the whole thing with the playsound command.or it does nothing or it gives me an error.

there must be something very simple that i do not know.... yet
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Dec 2017 19:52
I assume you attached the sound to the object you are selecting if so try:

PlaySound(delObj, 0) just before the Destroy(delObj) line. I'm not sure if the sound will get cut off by the Destroy or not, to test that just comment out the Destroy temporarily.
Been there, done that, got all the T-Shirts!
PM
beanz
9
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 5th Dec 2017 11:17
hey thank you so much !! this works like a charm!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM

Login to post a reply

Server time is: 2024-12-23 00:42:37
Your offset time is: 2024-12-23 00:42:37