Page 1 of 1

Questions about modding limitations for a project.

Posted: Thu Jan 12, 2017 1:25 pm
by PedroMoniz
Hello,

My name is Pedro Moniz and I am a student currently doing a thesis on character relationships.

I am looking for a game to start exploring and legend of grimrock 2 looks to be a good one, but I have some questions regarding limitations.

My objective will be to assign a member of the party as a leader and have the player roleplay him. For example, when a player picks a potion from the ground and gives it to his mage it is as if the leader of the part decided the mage should have the potion and gave it to him.

With this I will then introduce a relationship module where depending on the archetypes they have certain agendas and if the player respects those agendas the characters could get bonuses for their abilities.

The objective will be to have relationships applied as a game mechanic where the player can manipulate these in order to address certain challenges. For example, the barbarian does not like to wear armor but you decide to give him armor to wear, he may become pissed at you and start getting hit more but if you continue to treat him badly he starts to become a bit more dominant-unfriendly and steps back to let others take more hits.


So questions,

Can you assign a leader, which means to create a new variable. Also can I create a gui element in character creation to have the player assign it there.
Can I have custom variables in the characters to have my relationship bias towards the leader.
Can I see when an item is picked up and who gets it. It may be a bit hacky but can i do this? Can I also call functions on item given.
Can I differenciate between items and create new abstractions for them or do abstractions already exist. An example would be potions, an alchimist may want to carry potions with him so can I identify an item as a potion easly or would i need a bunch of ifs.
Can I see when a character is hit and call a function.
Can I see when a character hits an enemy and call a function.
Is it possible to differenciate between a miss and a hit.
Can I see if a character is low on hp and call a function.
Can I modify the characters to give them temporary buffs or debuffs.
Can I make a character be more targeted than others (I know there is a front and back row but I dont know how a target is decided in the front row). Can I simulate 4 rows?
Can I create lists of likes and dislikes depending on the class and race and skills to be added to the character.

Please note that some of these I may just limit in general, like only use humans and certain classes, so I can hack and force things a bit more if I have to.

In case things are not possible, I have also thought about just having an outside app that can read on data and react on changes like items given and hp drop or attack hit. I could then have this app apply changes to the characters stats.

Because my focus is an academic work I do not necessarily have to rely on the game for everything as long as I see what he is doing and influence the characters.

Thank you for reading and please give me some tips, from what I've seen this seems to be a great community.

Re: Questions about modding limitations for a project.

Posted: Thu Jan 12, 2017 3:44 pm
by Isaac
For the most part, I think yes. Most of that I think could be done in lua script with the available event hooks. However simulating four rows is likely to be very difficult, depending on whether or not you want full party member functionality. The engine does not support more than four characters [with two rows].

The engine does support user scripted UI graphics, and click surfaces. You can make a custom menu with buttons and arbitrary text, and images.

Re: Questions about modding limitations for a project.

Posted: Thu Jan 12, 2017 4:41 pm
by PedroMoniz
What about how a character is decided to receive an attack, is there a rule for it?

Basicly, do the npcs have priorities or is it just a random?

Re: Questions about modding limitations for a project.

Posted: Thu Jan 12, 2017 5:16 pm
by zimberzimber
Hello Pedro!
From my experience, there is no way to determine which champion gets hit until they get hit. Maybe there is and I just don't know about it though.
But in case there isn't, you could hack your way around it by canceling damage dealt to a hero, and then apply it through an external command.
For example - Damage received, if type is not pure, then pick champion based on certain rules, apply taken damage as pure after resistance calculations.

The priority is limited to the front row of the side from which the hit came, otherwise its random.
You can find more information here: viewtopic.php?f=22&t=13948&hilit=infodump

Good luck with your thesis! :D

Re: Questions about modding limitations for a project.

Posted: Fri Jan 13, 2017 4:22 am
by minmay
All of the features you mention are possible, and not especially difficult, except I'm not sure about this one:
PedroMoniz wrote:Can I simulate 4 rows?
Do you mean to change the "shape" of the party from 2x2 to 4x1? Because that can technically be done but it'll be lot of work and it won't be very clean.
PedroMoniz wrote:(I know there is a front and back row but I dont know how a target is decided in the front row)
It's decided by math.random(). 50% chance of hitting the left party member, 50% chance of hitting the right party member. This is true for both projectiles and orthogonal melee attacks. I think it's the same for diagonal melee attacks too, and the monster's facing is used as the direction of the attack for this purpose, but I'm not 100% confident and too lazy to test right now.

Re: Questions about modding limitations for a project.

Posted: Fri Jan 13, 2017 2:31 pm
by PedroMoniz
In the case there is not a way to change who is targeted, can I modify the targets before hand?

With this I mean, there is a random chance of selecting a target, but if I tell him there is only 1 target under certain conditions I may pre filter the targets before he chooses. And if there is only 1 target then I have what i need.

An example would be to have an enemy in front of me and attacking. Front line takes priority and it has targets A and B. When the pc asks what his targets are, I tell him it is A and B or just A or just B depending in certain conditions. I am assuming there is a function that identifies targets.

Is this something possible?

If not, the technique of getting damaged and then healing and applying that damage to another character also seems nice, although a bit too hacky.

Another possibility can be for a target to gain 100% dodge chance temporarily under certain conditions.
E.g. he gets attacked and has a friend so he gets 100% dodge and his friend gets less chance to dodge.

You talked about 50%, are there other variables when it comes to hitting?

Re: Questions about modding limitations for a project.

Posted: Fri Jan 13, 2017 7:44 pm
by minmay
Effectively changing who's targeted is not too hard. The only single-target attacks against the party are projectile items and MonsterAttackComponent melee attacks. For projectile items, you can use the PartyComponent.onProjectileHit hook to apply the damage to a champion other than the default one (the hook provides you with the damage and damageType) and return false (which stops the projectile from damaging the originally chosen champion). For MonsterAttackComponent melee attacks, in the onAttack hook you can use your own melee attack code and return false at the end of the hook (which stops the monster from making a real attack - the animation continues but it won't hit or damage the party).

My question was about party shape. Right now the party is a 2x2 rectangle. If you want to change this shape to, say, a 4x1 rectangle or a T-tetromino, you will need to reimplement large portions of the GUI to display the new shape, and it will not be clean at all.
PedroMoniz wrote:You talked about 50%, are there other variables when it comes to hitting?
It's always 50% when deciding which party member to attempt to attack. That attack can miss because of that party member's evasion, but it doesn't fall through to another party member when that happens.
PedroMoniz wrote:I am assuming there is a function that identifies targets.
There is but the user scripting interface isn't supposed to be able to change it.