Scripts / Free RPG Scripts - made by Krupar

Author
Message
KruparGames
6
Years of Service
User Offline
Joined: 2nd Apr 2018
Location:
Posted: 3rd Apr 2018 21:49 Edited at: 4th Apr 2018 06:52
Hi guys,
I have been playing around with Game Guru for about a month now. I am very new to scripting but have made some RPG scripts that may help you develop your own games. I will divide my scripts into a few forum posts as there are a lot of aspects to them which need explanation.
First of all I would like to mention a few things:
1. Yes, you can use and modify those scripts in any way you like.
2. Yes, you can use them in your own projects free of charge.
3. I am not a professional scripter and will not create scripts per request.
4. I know they are not perfect but as long as they work it's fine with me.

Ok, now that's out of the way let's go!

I will start with my RPG Menus script. What does it cover?
- 3 Menus - for character, journal and inventory
- Journal can track 7 quest lines at a time and displays propper messages according to quest phase.
- Inventory contains only weapons and potions
- Potions system included (weak potion, regular potion and strong potion). Also contains potions cooldown time.
- Simple dev values display (handy for creating quests and debugging)
- leveling system
- Current weapon slot tracker
- It works with current GG save system

Here is the script itself:



So how do you use it:

1. Custimize starting values
At the top of the script you have values that are marked as "Feel free to edit". They are pretty well explained there so there is no need for me to do the double work. Just make sure you set the value: player_health_limit to what you have set the player's health in Entity Edit mode in the engine.
I have set it to 360 as this seems to be a good value for an RPG taking the red low health screen into account.
When using this script player health will never go above the value you set there. So this will be somehow static for the entire game.

-- ADDED INFO (WILL BE BETTER EXPLAINED IN LATER POSTS)
(in order to achieve difficulty level enemies will give you more damage over time, they will have more health and weapons you pick up will have different damage values depending on the weapon level - you will be only allowed to pick up weapons on your level or lower.)

2. Journal
This one is the most complicated so lets explain. Journal starts in the script on line 426 "-- QUEST MENU".
What you need to know before editing this part (and you will have to in order to create a full game with this).
1. There are 7 Quest Lines available to be active at any given time.
2. Positions of Journal Entries is fixed, each entry can be only 1 line long.
3. Each line can be 80% of the screen width long.

Ok then. There is a set value for each quest. Those are:
g_quest_1_value
g_quest_2_value
g_quest_3_value ... etc. all the way up to 7.

You can display different message based on the quest value. The idea is that with each quest phase this value raises by 1.
Also all quest values are set to 0 by default when the game starts.

So for example:


This means that if quest 1 value is 0 following message will appear on screen.
1. QUEST 1 NAME
Message when quest_1_value is 0

Later when the quest phase changes and g_quest_1_value is set to 1 (for example: you talk to a quest giver or find an item that changes the quest value) you can add a different text. For example:



This would display:
1. QUEST NAME
Message when quest_1_value is 1

You will have to change the messages and quest name between the " " and this will display your progress.
There are already sample messages created for each quest line for values 0 and 1.

All quest lines are marked with "-- Quest line 1" ,"2", "3" ... etc. in the script.

So to add new message for the next quest phase you need to copy this short if statement as in the above example and change one value.

The next one would be:


3. Inventory
You don't actually change anything here. It just works for Custom Weapons and Potions I created.
It displays how many potions you have, which weapon you carry in which slot and each weapons level.

Here is the script for weapon level 1:


And weapon level 3:


(I added 2 weapon level scripts to make it easier for you to analyze how to change them for any level)

also here are the potions:

Weak Potion


Normal Potion


Strong Potion



4. Leveling system
This is pretty simple and does not need explanation also. For each level you need to gather +100 XP. This means.
To get to level:
2 - you need 100 XP
3 - you need another 200 XP
4 - You need another 300 XP
etc.

So in this case to get to level 4 you need 100+200+300 XP = 600 XP

5. So how to put this into your game?
1. add the scripts somewhere to Game Guru scriptbank folder:
DiskLetter:\Steam\steamapps\common\Game Guru\Files\scriptbank

2. Attach the rpg_menu script to any object on the map
3. Set the object to:
Static - No
Always Active - Yes

It needs to be always active because otherwise it will work only around this object.

To add custom RPG weapons:
Just place any weapon in the editor and change the script to the custom one.

To add potions
You need to set the object Static to No
It could work with any object really but I advise to use it with something that fits .

[KNOWN BUGS]
1. The slot tracker may not catch the weapon change and replaces the wrong weapon in the inventory.
2. I have not found any solution to disable or track mouse wheel weapon change so you have to use keys 1-9 to change weapons - Otherwise replacing the weapon will always change the wrong one.
I do not know how to fix this but maybe someone on the forums will be able to help.
3. For some reason the sound doesn't play when you Level up.

This is all I have for you for now. I know it is very long post but also hope I went in depth to the level that anyone will be able to edit those scripts and put them in their games.

I will be happy if you give me feedback as I have more in store for you including: Custom RPG Radar, AI quest givers, Readable notes, Enemies crafted to work with those scripts setup and radar, zones that save and load RPG values when changing levels, Escort Quest scripts setup and Items that change quest values when picked up.

If you like this please let me know what should I post next.

Thanks,
Krupar

PS. I have asked support if it is ok to share modified stock GG scripts on the forums. I have received a Yes message so please contact me if there are any doubts about this post or scripts attached.

Attachments

Login to view attachments
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 3rd Apr 2018 23:06
Very nice, I'll take a look when I get time.

Just one thing, because the scripts are quite large scripts it might be best to upload them in an attachment rather than rely on people copy/pasting them from the code boxes, the reason I say that is because the code boxes on here are a little buggy and generate invisible characters when copy/pasted, so they don't always work, and it's a nightmare trying to find where they're broken.

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.
JPH-GAMES
3D Media Maker
9
Years of Service
User Offline
Joined: 13th Feb 2015
Location: Belgique
Posted: 3rd Apr 2018 23:06
Welcome to GG KruparGames, thank you for the script and thank you for the beautiful explanation.
will surely serve a lot of people

Intel Pentium CPU G3220 3.000 GHz , 8 GB Ram , NVIDIA GeForce GTX 745 2GB , Windows 10 64-bit.
GameGuru , S2Engine HD , Shoot EM Up , CopperCube 5 , Clicteam Fusion 2.5 , Platfinity .
tdreisinger
6
Years of Service
User Offline
Joined: 23rd Jan 2018
Location: Indiana
Posted: 4th Apr 2018 01:21
Thank you for the simple explanations and examples. Especially important to old dogs that struggle with new tricks.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 4th Apr 2018 11:17
Cheers m8 It's nice to see people donating useful scripts so others can use them in thier projects
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 4th Apr 2018 14:51
Krupar, you can see that not only do you have ease in the creation of scripts but they are a great passion for you. You can see the clarity of a teacher to advise on its use and the kindness of compartilos is praiseworthy. A new smallg or AmenMoses in the forum ??? It only remains to congratulate him for the work and solidarity with those who are not very good with scripting (for example who writes).
Needless to say that what you need and can collaborate with me and of course in all the people of the forum ... is a forum with excellent people!
Lo probaré y por supuesto te daré información sobre lo que vea... es MUY importante el feedback!
Big hug and greetings!
The game is a serious thing (El juego es una cosa seria)
KruparGames
6
Years of Service
User Offline
Joined: 2nd Apr 2018
Location:
Posted: 4th Apr 2018 22:49
Hi guys,
Thanks for the feedback. I see that this is getting some traction.
Belidos, as per your advise I have edited the first post and added the scripts as an attachment. I did not know about the forum script box issue so all future scripts will be also attached.

Well then. Let's continue with the RPG Scripts .

So the next big thing in all RPG games are Characters and AI which you can interact with. So in here you will get to know how to place talking AI.
The main goal of this post is to create a talking AI (Civilians and Quest Givers).

Those characters will:
1. Follow waypoints
2. Change quest values (phases)
3. Talk to you (can be set to different messages based on quest value)
4. They are invincible. In order to make the game creation easier I have set them in a way that whenever their health goes lower than 500 it sets back to 500. (This prevents players from killing key characters). If you have a weapon that deals more damage than 500 it might kill them though so be careful.

This might seem to be a little bit complicated but it really isn't. Just focus for a moment and you will surely get it!

Let's start with a simple AI that talks to you and everytime you approach him he always tells the same thing.

Here is the script:


What you need to know:
At the top of the script there are values marked as "Feel free to edit".
They set 3 key things in those custom character.
1. Character name
2. Colour of the character on radar (I have not yet introduced this script for radar but keep calm. I will publish it in later posts.)
3. Talking speed value. This works as a prevention from running through dialogue too fast. The larger this value is the longer you have to wait for the text to change. Also the text will not change automatically, you will have to press "E" for each text change. The value is important if you hold "E". 100 seems to be a good enough value but you can modify it for your taste.

So the next part would be editing what the character actually says. The best way to think about it is that you edit blocks.
On line 113 you have -- TEXT BLOCK 1 marking. It goes all the way down to line 146 -- END TEXT BLOCK 1.

In order to modify the text you will also need to understand why it changes at all. So the system is as follows.
1. If you press "E" there is a special talking value that changes by +1.
2. A timer starts from 1 and grows over time
3. When timer reaches 100 it resets to 0
4. Then you can press "E" again and the value will again change by +1.

So the special value is the key to change the dialogue lines. And in this case it is called ai_civilian_disp_text.

Let's focus on this for now.



So what does this mean and how can you edit this?

Up here you have a snippet of the full code starting from line 114. Let's divide this into parts.
if PlayerDist < 100 then - this means that this part of the script activates if Player is closer to the character than 100.

Then you have the following statement:


Here are the key components. Remember that everytime you press "E" the ai_civilian_disp_text value changes by +1?
This says that when the ai_civilian_disp_text value is equal to 1 it displays following text: "This is the 1st line I say."

The next time you press "E" the value will change to 2.

So back to the main script (line 121) - The next statement is:


You will have to copy this statement over and over, change the value to 3, 4, 5, 6 etc. and add your own text. You can add pretty much as many lines as you want and the character will say them in order.

Great! We have a first talking character.

Let's move to quest givers which are working in the same manner.

Here is a sample quest giver code.



At the top you have the same 3 key character values as described before. All explained let's move on.

This character is different because it changes quest values. Here text blocks will become really important.
There is however one key change in the quest giver blocks and it is line 115.



This means that in this block you will have everything that this character says when:
Player Distance is closer than 100 -- AND -- g_quest_1_value is set to 0

g_quest_1_value is as you should know from previous post a quest phase value. So in this case if this value is set to 0 then the character will say whatever statements you have below.



You can edit those changes however you wish - based on what you learned with civilian script.
The key change is where the last statement is.



Those lines are explained in the code so I will not do this again.

So in order to change different quest lines values you have to change g_quest_1_value to one of the following:
g_quest_2_value
g_quest_3_value
g_quest_4_value etc. (remember as in the RPG Menu script? all the way up to 7)

So a few things to end this!
1. How do you create multiple talking characters and quest givers?
Each character needs to have his own talking script attached. Please do not duplicate those at I have experienced some issues with this.
The steps to make a new script for the next character (on example of the quest giver script):
1. Make a new copy the script file.
2. Open the file and look for the ai_quest_giver_1_init function
3. Copy everything between function and _init (in this case "ai_quest_giver_1")
4. Do a mass replace of the text ai_quest_giver_1 with something else. eg. ai_quest_giver_2. This needs to be changed in every part of the script so please use the text editor option "replace all".
5. Save the file.
6. Change the new script file name to the newly set name (in this example ai_quest_giver_2)

2. How do you edit this for a next quest giver if I don't want him to change quest value until certain actions have been completed?
You have control of the messages that the character is displaying.
In the first text block change the line:
if PlayerDist < 100 and g_quest_1_value == 0 then

This line tells the character to say certain text lines when quest value is 0.
So for the next one you can set what he says when it is lower than some other value. For example:

if PlayerDist < 100 and g_quest_1_value < 4 then

This means that if quest value is lower than 4 he will say this.

The second block would start with:

if PlayerDist < 100 and g_quest_1_value == 4 then

This means that only if the value is set to 4 he will say whatever is in the text block.

3. What should you remember about?
Remember to always create a proper Journal entry for each quest phase in the RPG Menu.

This is all about friendly characters. The next step will be quest items so stay tuned!

--

I think that's all about the characters. If you experience any issues or have questions please let me know.

Thanks,
Krupar

Attachments

Login to view attachments
PM
KruparGames
6
Years of Service
User Offline
Joined: 2nd Apr 2018
Location:
Posted: 6th Apr 2018 21:52
Hi guys,
Time for an update in the RPG Scripts I have created. There are a few more things that I want to share with you and now they will be less complicated. In this post I will cover:

1. Quest Item that changes quest value when picked up
2. Setting up a quest delivery to quest giver + how to add XP to player
3. Custom RPG Radar
4. RPG Notes
5. AI Enemies
6. Zones for saving RPG Values and loading them on a new map

Since those are a lot simplier I will make it as short as possible

1. Quest Item that changes quest value when picked up



How do you proceed with this script:
Everything is marked with a green text on lines 9, 30 and 37.
You will have to change the quest value at which you want the item to be possible to pick up. You can also add a "comment" that the player will give if the quest is not in motion but the player found this item.

2. Setting up a quest delivery to quest giver + how to add XP to player

I might have not mentioned how important text blocks are in the previous post so I will fill in the blanks now.

Each quest phase needs to have it's own text block. This way the character will react according to the quest phase.
You can just copy text blocks one under the other - It is well shown when you compare ai_civilian and ai_quest_giver.
Quest giver has 2 text blocks that are directly below each other. There is no limit to the number of text blocks so you could create one character that gives you a lot of quests during the game.

So here is the text block that you would want to put as a quest delivery phase.
Let's think about it this way:
1. You talk to the character and he gives you the quest (g_quest_value changes from 0 to 1)
2. when g_quest_value is 1 the phase is to get the item. When you get the item the phase changes from 1 to 2.
3. 2 is the point where you have to give back the item. When you deliver it to the quest giver it changes to 3.

So here is a text block for this scenario



3. Custom RPG Radar
It is really simple. You implement it the same way as the menu script.
Set the item to:
Static: No
Always active: Yes

You attach this script to the object and this will show the custom RPG radar displaying characters in the colors as you can set them in the scripts. Described well in the AI scripts in the Feel Free to change values part (2nd post)



4. RPG Notes

Here is the script for a simple not that only shows text. Attach this script to a parchment or a piece of paper and set the item Static: to "No"



This is very easy to do.
Also here is a note that could change a quest value:



5. AI Enemies

This is very simple. You just attach it to any modern GG character instead of the stock script.
What this allows you is to set a static damage value and display the character on the radar in a specified color.



6. Zones for saving RPG Values and loading them on a new map

So you can create basic quests now and we all know that GG in not working very well with big Open World maps. In order to achieve better optimization I have created scripts that save and load RPG Values (Weapons, Potions, Level etc...),

Save zone script:


Load Zone:


So how you use it?

The Save zone also acts like a win zone. You put it on a map and attach this custom script. when player reaches it, there is a custom file created called mdm.dat (Map Data Migration).
The load zone loads values from this file on the next map. Just put a trigger zone on a new map where the player spawns. It will automatically load them again.

---
That's all for today!
I will have one more thing for you and this is the Escort quest and instructions how to set this up.
I hope this is all understandable. Please let me know if you have any questions.

Thanks,
Krupar

Attachments

Login to view attachments
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Apr 2018 00:45
Very nice work thank you very much for these
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
tdreisinger
6
Years of Service
User Offline
Joined: 23rd Jan 2018
Location: Indiana
Posted: 7th Apr 2018 02:53
I am so grateful for your posts Krupar. You are exceptional at teaching, thank you!

Login to post a reply

Server time is: 2024-12-22 19:31:29
Your offset time is: 2024-12-22 19:31:29