Scripts / Using ammo quantity for custom counters

Author
Message
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 14th Mar 2019 01:37
Hey guys,

Since gameguru don't save together custom variables, I've been trying to use a Uzi ammo to give me a supply counter and go into save file.

I add this to the .FPE file of an item I wanted to be collected:

;Identity Details
isammo = 1
hasweapon = modern\uzi
quantity = 1

It's working fine, it's adding 1 pool amo for Uzi weapon. But I could not make my variable count this.

Here's my code:



GetWeaponPoolAmmo(e) don't work because "Supply" aint rising.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Mar 2019 13:50
yh it's supposed to be an index rather than entity number but still doesn't seem like it works (only GetWeaponAmmo(index) appears to return any value but that's only the current clip), you can use the currently held weapon info though
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 14th Mar 2019 13:53 Edited at: 14th Mar 2019 14:07
Thanks smallg for your reply. Guess I'll have to keep supplies "Account Bound"

Edit: I mean Account Bound, because if you get 10 supplies, save your game, and start a new one, you'll have 10 supplies since early game (Everytime you pick a supply, it writes in a file and save, and when you start a map it's forced to load.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Mar 2019 20:19
g_PlayerGunAmmoCount contains the ammo count of the carried weapon.

Here is an example of how to access the pool properly:

Been there, done that, got all the T-Shirts!
PM
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 14th Mar 2019 22:30
Thanks AmenMoses, but it's only working if I have the weapon wielded.

Cant make it works without using the weapon.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 15th Mar 2019 00:08
Can't make what work?
Been there, done that, got all the T-Shirts!
PM
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 15th Mar 2019 00:33
I used PlayerLives global instead. Now I can save the supplies a player can gather and save/loads. Thanks in advance.
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 24th Mar 2019 21:57
Custom variables do save and load as far as i can tell, as long as you make it a global variable ex. "g_supply". I atleast haven't had any problems with my custom variables not saving/loading when doing this.
PM
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 25th Mar 2019 00:25
@iiDenTiiTy do you carry variables trouh levels? or only use em in 1 level?
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 25th Mar 2019 00:29
Quote: "@iiDenTiiTy do you carry variables trouh levels? or only use em in 1 level?"


Gimme a minute and I'll give it a test
PM
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 25th Mar 2019 01:36
Aha, so it does not save the variables through levels sadly.. For a game engine that boasts "no coding needed" it surely has a lot of stoppers from making a game without the use of scripts, feel like this should be a pretty fundamental feature. However I digress, guess it would be possible to save the variables on a text file or something, so then right before jumping to a new level saving them, then loading them back up once on the next level.
PM
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 25th Mar 2019 02:22
Yea, I'm going to try to set it up. I forgot how to work with open, write and load commands but will read more about it soon. Ty for your reply
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Mar 2019 09:29
Quote: ""no coding needed""


That's a common misconception, gameguru does not boast that at all, it boasts that if you want to make a very basic game without coding then you can, but if you want more than the bare basics you have the option to script it. Which is exactly what gameguru does.

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.
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 25th Mar 2019 15:51
Quote: "That's a common misconception, gameguru does not boast that at all, it boasts that if you want to make a very basic game without coding then you can, but if you want more than the bare basics you have the option to script it. Which is exactly what gameguru does."


I mean, you're right it doesn't actually specify that you can create a complex game without knowing how to programme/code, but neither does it really specify that you can only make very basic games if you don't know or are not willing to learn programming/coding. Just feels like the "official" info and taglines associated with it are slightly misleading in my opinion, of course the consumer should always do some research on the product he is buying beforehand and then you would pretty quickly see the limitations of what you can do without scripting.

To clarify, I'm not ripping on the game engine itself. Even with the need to code to make a more than basic game, it is still one of the easiest game engines to use in my opinion. And if you put some effort into it and learn LUA you can make some pretty complex things with the script system. One of those very easy to learn, but difficult to master sort of thing.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Mar 2019 16:07
You don't have to do any coding, just use scripts that are already provided or any on the many given away on these forums or as a last resort you could always buy scripts from the store.

As for saving variables across levels, GG is aimed more for the multiple stand alone level type of game by default so yes if you want something different you will need to script it, a little word of warning though, if you save to a file you will dramatically increase the complexity of testing your game and also open up the possibility of users 'cheating' by editing the file themselves, for example if you stored ammo count in a file to load in a later level someone could simply edit that file prior to the level load and give themselves extra ammo.

Been there, done that, got all the T-Shirts!
PM
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 25th Mar 2019 19:00
Quote: "You don't have to do any coding, just use scripts that are already provided or any on the many given away on these forums or as a last resort you could always buy scripts from the store."

This is true, there are a lot of options out there that doesn't require you to actually script the game yourself if you want features that are not in the default scripts.

Quote: "if you save to a file you will dramatically increase the complexity of testing your game"

This I see and agree with^

Quote: "and also open up the possibility of users 'cheating' by editing the file themselves, for example if you stored ammo count in a file to load in a later level someone could simply edit that file prior to the level load and give themselves extra ammo."

This you can do with standard save files anyways, and seeing as these files would be updated right before a level switch and only pulled right after, it would be way easier to just use the savefiles for this purpose.

Anyways, cheating in a single-player game is pretty much piss easy in any game, because you are only ruining your own experience.
PM
Medmatheus
Reviewed GameGuru on Steam
8
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 25th Mar 2019 19:37
Going to make a rank and ingame achievement system, so player can level up and receive some perks as he do some stuff. If I'm sucessfull, going to post here the my scripts.
iiDenTiiTy
5
Years of Service
User Offline
Joined: 22nd Mar 2019
Location:
Posted: 25th Mar 2019 20:47 Edited at: 25th Mar 2019 20:51
First draft of a "variables carrying over between levels" system, seems to work ok, not tested in standalone.

Winzone that saves the variables to a .dat file in savegames folder:


Zone for loading the variables on next level, destroyed when run once.


EDIT, spotted an error, fixed.
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Mar 2019 21:19
I wrote a set of scripts to save and load custom variables quite some time ago on this forum, here's the link:

https://forum.game-guru.com/thread/217844#msg2577027


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: 25th Mar 2019 21:24
One option is to create a Lua script at runtime and save it in precompiled format, not only will it be difficult to edit for users but it will also load quickly when needed.

This is basically how the scripts are stored for the standalone, the precompiled version is saved to disk instead of the human readable version.
Been there, done that, got all the T-Shirts!
PM
Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 30th Mar 2019 01:01
You guy's and gals that put up free scripts for us to use. I want to say, Thank You very very much. Some of us don't have the time or knowledge to make our own scripts. You people are a life saver. Another big Thank You
Jim C
thughto
6
Years of Service
User Offline
Joined: 7th Mar 2018
Location:
Posted: 30th Mar 2019 07:22
Thank you for all the amazing scripts! You all rock! \m/
PM

Login to post a reply

Server time is: 2024-04-25 11:20:53
Your offset time is: 2024-04-25 11:20:53