News:

SMFNew Installed

+-+-

User+-

Welcome, Guest.
Please login or register.
 
 
 

Login with your social network

Forgot your password?

Site Stats+-

Members
Total Members: 728
Latest: Cho
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 10932
Total Topics: 795
Most Online Today: 389
Most Online Ever: 854
(September 18, 2024, 07:49:37 am)
Users Online
Members: 0
Guests: 184
Total: 184

Author Topic: Perks!  (Read 6330 times)

0 Members and 34 Guests are viewing this topic.

Perks!
« on: »
I seem to recall Kva3imoda asking about perks here - http://torchmodders.com/forums/kva3imoda's-playground/perks/

I've revisited this a few times, and after a lot of trial and error (and much head scratching) I am very happy to report that I have managed to get the entire perk system up and working - and it's very cool :)

It works like this - after some pre-defined condition is met, players get awarded perk points. These are similar to skill and stat points, except they are used to 'purchase' perks rather than get assigned to skills or stats. Perks are very special 'abilities' or 'features' not normally accessible to players in the game and work a bit like passive skills that have no costs or player impact - they merely provide benefits that you cannot obtain through effects or affixes. It seems the perk functions are hardcoded to a very specific list (see below).

You can then use these perk points to purchase perks from a number of them in a menu. You can define how many perks are available to the player at any time, and you can even assign tasks to each perk that must be completed before the perk becomes active for the player (even if it has been 'purchased').

As proof of concept, I currently have a perk UI running as an extra menu below the journal menu. I have one perk set up that, once assigned, will give you extra gold each time you gain fame (currently it's 10% of the fame you earn also gets given to you in gold). I have it set up so that there's a list of perks, but you can only have one active at any time - you can select from a list of available perks which one to have active by toggling them on and off. Even when this perk is purchased and assigned, it only works (becomes active for the player) once the task has been completed - in this case, for testing purposes, you only have to kill one monster. And it all works :)

It will need a bit more work to be a decent addition to the game though...

First, I cannot find out how the game engine awards perk points. Despite my best attempts, I cannot find out how and where the game changes the static stat PLAYER PERK PTS TO SPEND (I do know it bears no relation to stat points, skill points, experience or fame). So in light of this, I created my own dynamic stat to substitute it which I can control based on conditions I specify, such as completing a quest, discovering an area, reaching a level or amount of fame etc etc. I even thought about merging this with an achievements mod or linking it up to Steam achievements and awarding perk points based on gaining achievements. So this is a non-issue as we can still access and use the system :) Note that I haven't tried assigning perk points in the player editor as with other starting stats as I'm pretty sure you can only use dynamic stats in that way.

Second, I can currently only make use of one perk - the one Runic conveniently left in the PERKS folder. If you open that file, it represents a good template for creating your own (note that you can only specify one task, TASK0, and one reward for completing that task, REWARD0). I tried porting the perks from TL1 to no avail as they are coded very differently and in a form that TL2 does not parse or recognise.

To complete this, it would be really helpful if somebody with the un-encrypted .exe file (the DRM-free version) could use a hex editor and search for strings that are used in the perk system so we could figure out any other functions that may be coded. A good starting point would be to search for PLAYERKILLS to determine what other task conditions there may be, and FAMETOGOLD to determine if there are more rewards that can be given. In TL1, some of these (unused) perks were also employed to trigger skills, effects and bonuses so if we can figure this out it could become a very powerful addition to the game.

Once I can clean this up a bit and polish the UI I'll upload a compiled mod that shows it all in action, right now it's a mess but works so I'm posting this out of pure excitement! It does look pretty cool, as I have used the skill tree menus from the beta that to me look very fitting for this purpose and are vastly different from the stock released game. In the meantime, any thoughts and input are welcome.
« Last Edit: November 18, 2015, 12:51:57 am by DeeZire »

Share on Bluesky Share on Facebook


Re: Perks!
« Reply #1 on: »
Hey DeeZire, you totally got my attention!
For a mod with advanced content I'll post about soon I'm looking for different extensions like achievements and the Perks would fit in perfectly!

So you can only have 1 Perk at the time or can this be preset somehow?
Also did you figured out the conditions a little more?
<STRING>TYPE:PLAYERKILLS
<INTEGER>COUNT:0
what else is possible?
Can they stack/save? like after killing "2" monsters i get double reward etc...

There is a PERK subfolder in the Affixes but i dont understand its content :)

I'm looking forward for your "perktestmod". keep it up!
some projects in progress

Re: Perks!
« Reply #2 on: »
No they don't stack - each perk is exclusive. You can however have as many perks as you like active at any one time (provided you have 'purchased' them and have completed their tasks).

We still have to figure out what else is possible for them - hence my request for somebody to peek through the .exe for any strings that might give us a hint.

What I do know is that there is no limit on how many there can be as the way I have configured everything means that the game simply reads every file in the media\perks directory and adds them to the list of perks you can choose from :)

Here is a template I used for a perk.dat file (comments annotated);-
Code: [Select]
[PERK]
<TRANSLATE>NAME:Any String For The Name Of The Perk // this is what's parsed and displayed in the game
<TRANSLATE>DETAILS:Converts each point of Fame earned into gold. // as above, this is the description for the perk
<STRING>ICON:skill_slash // having trouble with this, I need to figure out the variable used to parse it
<STRING>ICON_DISABLED:skill_slash_gray // same here so I am explicitly stating an icon in the UI file
<INTEGER64>GUID:-3134059470467886625 // needed
[TASK0]
<STRING>TYPE:PLAYERKILLS // we need to figure out what other TYPEs exist for TASK0
<INTEGER>COUNT:10
<STRING>UNIT: Warbeast // kill 10 Warbeasts
[/TASK0]
[REWARD0]
<STRING>TYPE:FAMETOGOLD // we need to figure out what other TYPEs exists for REWARD0
<INTEGER>FAME:1
[/REWARD0]
[/PERK]

Re: Perks!
« Reply #3 on: »
heeyyyy great work Deezire! This is exciting news!

Let's hope Chthon reads this soon and has time to do his hex magic ;)


Re: Perks!
« Reply #4 on: »
I am very happy to report that I have managed to get the entire perk system up and working - and it's very cool :)
Congrats DeeZire!  :) Yes, it's really cool.

hex magic ;)
:D

Re: Perks!
« Reply #5 on: »
heeyyyy great work Deezire! This is exciting news!

Let's hope Chthon reads this soon and has time to do his hex magic ;)

Chthon is traveling. Chthon will attempt hex magic in a few days.

Re: Perks!
« Reply #6 on: »
Oh snap!  This is cool.

Re: Perks!
« Reply #7 on: »
Turns out I had a copy of the exe on my laptop.

PLAYERKILLS and FAMETOGOLD each appear once. Here's the nearby strings:

PERKNOTACTIVE
PERKACTIVE
PLAYERSTAT
MEDIA/PERKS/
PETKILLS
MAINPETKILLS
PLAYERKILLS
GOLDTOFAME
FAMETOGOLD
MAINPETEFFECT
PETSEFFECT
PLAYERARMOREFFECT
PLAYERWEAPONEFFECT
PLAYEREFFECT
MAINPETAFFIX
PETSAFFIX
PLAYERARMORAFFIX
PLAYERWEAPONAFFIX
PLAYERAFFIX
REWARD0 [this might be just REWARD; can't tell if the final 0x03 is part of the string]
TASK
TASK0 [this might be just TASK; can't tell if the final 0x03 is part of the string]
CONDITIONAL
ACTIVATIONCONDITIONAL

And these are nearby, but I don't think they're part of the same block:

WEAPONTYPE
TIMERUPDATE
« Last Edit: November 18, 2015, 09:53:43 am by Chthon »

Re: Perks!
« Reply #8 on: »
Wow, thanks for this, real fast progress already, I can get to work trying that lot!

More good news - I figured how to read the icons from the .dat files properly into the UI, so now all working well.

Re: Perks!
« Reply #9 on: »
needs testing, but I came across the UI Hud which contains a small ListWindow for the Buff Icons from skills. Under properties the Game system is set to "Effects".
The systems dropdown also contains "perks" so I guess it's possible to show Perks as buffs in a second Listwindow?!
some projects in progress

Re: Perks!
« Reply #10 on: »
Yes, that's the game engine system you use to display perks which I've made use of, there's a fair bit more to it than that though I'll post the workings of it as soon as I can tidy things up and make sure it's all working as it should do. So far so good though!

Re: Perks!
« Reply #11 on: »
did some research on Static Stats for something else when the "PERK" sprung into my eye...

PLAYER PERK PTS TO SPEND

maybe you have some use for it
some projects in progress

Re: Perks!
« Reply #12 on: »
OK, so it's a little bit rough round the edges but here's a simple mod that let's you see it in action. Once you get it, you will see where I am going with this;-
https://drive.google.com/file/d/0B5w_m-h6MlfvV0V1M25vSVV3R0k/view?usp=sharing

Instructions for use
Unpack the mod then open it in GUTS. Set your character to Embermage, don't have a pet, and go into game mode (I've only done the UI for Embermage so far). In the skills menu, you will see a new tab for perks (4th one along) - click this and you will see the perks menu. I have configured this with 5 available perks but only the 'Filthy Lucre' one will actually do anything right now as it's the only one I have configured a reward for.

Perks in blue are available perks - you can choose from any or all of these to be active at any time. Perks in red are your active perks - the ones you have chosen to be active, i.e. you will get the benefits from them provided you have completed the task it needs. The way the system works is that you have to toggle perks between available and active.

Click one to select it (it will go brighter to indicate it is selected) then click the red button at the bottom. The chosen perk will now show in the upper part of the menu in red to indicate it is now active. Any currently chosen perks - whether in the available list or the active list - will always be displayed brighter and only one perk can be selected in this way at any time. To remove an active perk, select it (it will go brighter) then click the red button and it will be removed from your active perks and return to available perks - hope this makes sense, but as I said it is a little rough. Put simply, it has no text label but the red button is the 'toggle this perk' button ;)

Now to the good bit - make sure you have no perks in your active list. Spawn a Warbeast then kill it. In the available perks list, you will now see that you have completed the task for the Filthy Lucre perk. Before you make it active, spawn any champion and kill it. You will see that you get the fame a usual. Now make the Filthy Lucre perk active and spawn another champion and kill that - you will get the fame again, but you will now also get 10% of that fame added to your gold :)

How it all works
It's a bit complicated so I'll do my best to explain as it's took me ages to figure all this out! It's mainly all down to the UI handling. The perks UI (my 4th tab here) requires a number of elements to function. First, it needs two list windows - one contains the active perks and must have the widget name ACTIVEPERKLIST to function. The second contains the available perks and must have the widget name PERKLIST to function. You will notice that these lists use the game system PERKS to handle their contents, and are also filtered to contain the unit type PERK only. Finally, it also needs the PerkMenuController which handles the toggling of the perks between those two lists. In turn, the PerkMenuController needs two further UI elements - one UI for an active perk (my red ones) and one UI for an available perk (my blue ones). Those UIs also need another element that handles their tooltips. These are all in the UI folder in this mod.

To function correctly, the available and active perk UI layouts must be toggle buttons. Inside these, several elements must be present in order for them to display the info from your perk .dat files. To display the icon, you must use an image with the widget name PERKICON. To display the name of the perk, you must use a text element with the widget name PERKNAME. To display the perk description you must use a text element with the widget name PERKDETAILS. Finally, to display any effects you assign through REWARD0 (see below) you must again use a text element with the widget name PERKEFFECTS.

To make your own perks, you need a .dat file in the MEDIA\PERKS folder. You can look at the ones in this mod to see their structure. The way the system works is that all of these .dat files are read by the game and the perks defined in this folder will all be listed in the UI list above that has the widget name PERKLIST. In other words, all defined perks in .dat files in the MEDIA\PERKS folder are automatically assigned as available perks (unless there's a conditional on the perk - see below).

The .dat files also need certain elements;-
<TRANSLATE>NAME: the name of the perk, read and displayed with the UI widget PERKNAME
<TRANSLATE>DETAILS: the perk description, read and displayed with the UI widget PERKDETAILS
<STRING>ICON: the icon used for the perk, read and displayed with the UI widget PERKICON
<INTEGER64>GUID: each perk is technically a unit type, so each one needs it's own unique ID

Perk .dat files must then define a task (TASK0), a reward (REWARD0) and can also have a condition. Task types can be one of the following but there's only really 3 types - kill something (or a number of somethings), complete a quest or meet a stat value;-
PLAYERSTAT - a stat condition must be met
PETKILLS - the players pets must kill a number of enemies
MAINPETKILLS - the players main pet must kill a number of enemies
PLAYERKILLS - the player must kill a number of enemies unaided by any pets
QUESTCOMPLETE (to be tested) - the player must complete a quest

Reward types can be one of the following but there are really only 3 types - get an affix, get an effect or do something with gold and fame;-
GOLDTOFAME - convert gold collected into fame as well
FAMETOGOLD - convert fame gained into gold as well
MAINPETEFFECT - apply an effect to the players main pet
PETSEFFECT - apply an effect to all of the players pets
PLAYERARMOREFFECT - apply an effect to the players armor
PLAYERWEAPONEFFECT - apply an effect to the players weapon
PLAYEREFFECT - apply an effect to the player
MAINPETAFFIX - apply an affix to the players main pet
PETSAFFIX - apply an affix to all of the players pets
PLAYERARMORAFFIX - apply an affix to the players armor
PLAYERWEAPONAFFIX - apply an affix to the players weapon
PLAYERAFFIX - apply an affix to the player
* by convention, affixes applied by perks should be in the MEDIA\AFFIXES\PERKS folder.

I have not yet figured out the conditional block, but there are two types - CONDITIONAL and ACTIVATIONCONDITIONAL which are used to make the perk available (or not) based on another perk being active (or not) or a stat being met (which I am presuming to be the stat PLAYER PERK PTS TO SPEND).  I've also still got to figure out how to make proper use of the other reward types but this shouldn't be too difficult with a bit more trial and error.

So what this very small and simple mod does it enable the whole perks system so you can see how it works and links it to a kind of achievement system too without any of that overly complex mess that I've seen elsewhere. Completing a task earns you an achievement in the form of a perk - a very nice feature for the endgame and beyond, not entirely dissimilar to a Paragon points system or whatever but a lot more engaging.

Let me know what you think so far, and please feel free to play about with the .dat files and let me know how you get on trying to get other tasks, rewards and hopefully conditionals working :)
« Last Edit: November 20, 2015, 03:24:29 pm by DeeZire »

Re: Perks!
« Reply #13 on: »
great! will test it soon to give some feedback
some projects in progress

Re: Perks!
« Reply #14 on: »
Fantastic Deezire! Ima try this one out (by the weekend :( )


 

Recent Topics+-