Scripts / Difficulty Menu Script

Author
Message
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Jan 2017 07:47 Edited at: 26th Jan 2017 08:21
Here's a very basic script using sprites and cursor as a difficulty menu for your game, it's very basic, only changing the players current hitpoints and the number of lives they have, i'm not 100% how well it will transfer across levels as i haven't tested it yet, but i'm pretty sure that jumping to a new level will retain the lives and health, so you should only need to use it in your first level.

Just open up the zip attached and drag the scriptbank folder into your gameguru\files folder, it will put everything where it needs to go.

Then in the editor, place a barrel, make it static = no, and always active = yes, and add difficulty_menu.lua (you will find it in scriptbank\dmenu)

You can see it working on the beginning of my video below:



Here's the code:



Note:

I forgot to mention, it doesn't adjust the max health, just the current health, so if you set your health in your player marker to 100 and choose easy you will get 300/100 displayed, i haven't been able to work out how to change the max health as the player starter marker overrides the script.

There is a variable referenced in there called g_player_max_health or something like that, it won't actually do anything for you because it's a variable i use in my health pack scripts to stop health packs healing over the max health (i forgot to take it out when i posted it).

You're probably better off making your own health HUD and displaying just current health or making a % based health bar so it doesn't look odd.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.

Attachments

Login to view attachments
TechCo
User Banned
Posted: 26th Jan 2017 05:17
Can I modify this?
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 05:57 Edited at: 26th Jan 2017 08:07
You can do what you like with it, as long as you don't try to sell it and pass it off as your own (you can include it in a commercial game though)

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 08:22
I forgot to mention, it doesn't adjust the max health, just the current health, so if you set your health in your player marker to 100 and choose easy you will get 300/100 displayed, i haven't been able to work out how to change the max health as the player starter marker overrides the script.

There is a variable referenced in there called g_player_max_health or something like that, it won't actually do anything for you because it's a variable i use in my health pack scripts to stop health packs healing over the max health (i forgot to take it out when i posted it).

You're probably better off making your own health HUD and displaying just current health or making a % based health bar so it doesn't look odd.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
gd
7
Years of Service
User Offline
Joined: 21st Jul 2016
Location: Small Darkroom with no red light
Posted: 26th Jan 2017 10:21
Hi Belidos, I love your hud menu system looking great.
As this is based on a survival game would it not be a good idea to add weight to the system. Carrying a car battery around for a period of time would burn a lot of energy which would add to fatigue. Maybe consider this also to add more realism, just an idea.
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 SLI 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


A new competition running for GG
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 10:31 Edited at: 26th Jan 2017 10:36
Quote: "Hi Belidos, I love your hud menu system looking great.
As this is based on a survival game would it not be a good idea to add weight to the system. Carrying a car battery around for a period of time would burn a lot of energy which would add to fatigue. Maybe consider this also to add more realism, just an idea."


This thread's not really a thread for talking about my HUD, it's for giving away my difficulty menu script, the video is just the only one that i had to hand with the difficulty menu in it. If yu want to talk about my WIP stuff, i have a thread in the WIP board, i'd welcome any thoughts, ideas, criticisms, tips, etc you have over there

As to the battery thing, the car battery obviously isn't going to be the real model, this video is just testing the mechanics, and that was the only battery model i had at hand at the time, i mean c'mon using a car battery for a torch? LOL! Likewise i won't be expecting people to collect whole cases of tinned food, they're just place holder models.

You can see a more accurate version of that set of quests in my newer video:


And before you ask, the inventory panels, and the journal panels toggle on and off using the I and J keys, they're only on all the time in the video to demonstrate the changes inside them as you pick things up and complete quests, so no they don't get in hte way and make the screen area too small :p

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
TechCo
User Banned
Posted: 26th Jan 2017 11:35
thanks belidos for your permission.
Mouaa
User Banned
Posted: 26th Jan 2017 18:56
@Belidos
I see lot of repetition , only values change lol


if g_MouseX>49 and g_MouseX<61 then
if g_MouseY>59 and g_MouseY<66 then
if g_MouseClick==1 and d_menu==1 then
DeleteSprite(cursor_sp)
UnFreezePlayer()
DeactivateMouse()
SetPlayerHealth(100)
SetPlayerLives(1)
PromptDuration("You have selected Hard Difficulty: 100 Health, 1 Life",6000)
d_menu=2
g_player_hp_max = 100
end
end
end


Can't you make some library or simply make it a function with some parameters ?
I think we could take your example to make some hight level library functions to make menus, easier and faster, if it has not been done.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2017 20:02 Edited at: 26th Jan 2017 20:07
Quote: "Can't you make some library or simply make it a function with some parameters ? "


I wish I could, but I don't have a clue how, and I'm not really a scripter, tables and libraries make my head hurt lol, this was just the easiest way to do it without having to wrap my head around stuff I will never be able to understand. I'm more than open to suggestions, hence why I asked the question in your distance thread, i'm trying to learn, but i'm getting old and the ole brain doesn't work as well any more

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
Mouaa
User Banned
Posted: 27th Jan 2017 10:35
@Belidos
When i'll get to make menus and use your example i'll try to make some high level functions, and why not make menus screen resolution independant.
TechCo
User Banned
Posted: 27th Jan 2017 12:10
belidos how you do that control image and how you changed text position to middile
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 27th Jan 2017 12:46
To resize the images (sprites) them just look in the section clearly headed:

--sprite size

To move the sprites around, find the lines starting with:

PasteSpritePosition

The two numbers at the end of each line are the X and Y position (in a % of the screen) of the top left corner of the sprite.

To move the text, just find all instances of:

TextCenterOnX

and change the numbers after it.

The first number is the X position (it's a % of the screen), the second number is the Y position (again a % of the screen), the third number is the font style (there's 7 styles if i remember right)

On the lines that say:

TextCenterOnXColor

The last three numbers are the Red Green Blue values for changing the font colour.


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 28th Jan 2017 16:34 Edited at: 28th Jan 2017 17:06
Nice Script and really usefull. Also a nice starting point for some expansions like enemy AI difficulty....

Functions are really usefull to keep your script nice and clean
Little tutorial:
https://www.tutorialspoint.com/lua/lua_functions.htm

and how your script look if you use it:


also you could define some multiplier like difficult is health *1, middle is health*2 and so on. Then you can safe a lot more lines.

I hope this helps you a little bit
(Not sure if it works, just some thoughts)
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Jan 2017 18:37
Nice script Belidos!
Today I got the chance to test it, and it works ok.

Quote: "so if you set your health in your player marker to 100 and choose easy you will get 300/100 displayed, i haven't been able to work out how to change the max health as the player starter marker overrides the script. "


I think it has to do with gameloop.lua script.



3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Len the man
8
Years of Service
User Offline
Joined: 12th Jun 2015
Location:
Posted: 28th Jan 2017 20:15
Great script...

I'm still trying to learn enough about scripting to be able to set a maximum health limit, if that's possible. I have seen many games that don't go above 300 health points.

I know enough to change a few minor numbers in a script to alter a few things, but beyond that, I get baffled very quickly.
PM
TechCo
User Banned
Posted: 29th Jan 2017 01:45
thank you belidos

Login to post a reply

Server time is: 2024-04-26 04:23:10
Your offset time is: 2024-04-26 04:23:10