sticky expertise, power attack, etc

Discussions related to character builds and mechanics may occur here.

Moderators: Active DMs, Forum Moderators

Post Reply
a1b2
Posts: 70
Joined: Mon Jun 01, 2015 5:50 am

sticky expertise, power attack, etc

Post by a1b2 » Sun Jan 17, 2016 3:57 am

So this is more a builder question. but I'm trying to figure out how you made it sticky, or toggleable without doing a player tool or something like that? I've been reading online for how to do it and without a hak file, it seems the only ways that are even implied this is possible is with NWNX or using a playertool and when someone takes the feat disable the feet but tie a player tool into doing the combat stance.

Any builders or even normal people able to give me some insight on this?

User avatar
Septire
Posts: 446
Joined: Mon Sep 15, 2014 3:05 am

Re: sticky expertise, power attack, etc

Post by Septire » Sun Jan 17, 2016 5:41 am

On Arelith specifically? It's using the NWNX events plugin. There is a toggleModeHook function (though it could be a custom change done by Scholar Midnight and not included in the library by default) that basically captures when a mode toggle occurs and then "stickies" the mode on the character, which I assume (and this is an assumption only) freezes the memory address which retains the character's mode and prevents it from changing when you move or perform other actions. Think of it kind of like a gameshark or game genie.

NWNX is outside of my general knowledge of building/scripting for Arelith. You'll likely want to ask Scholar Midnight this particular question, I can't name anyone else off the top of my head who would definitely (at least with high accuracy) know the specifics on this.

For the other method, using playertool... I suppose you could code some specific bonuses for using a playertool, but what about the original feat? Would that just be removed off the character and replaced with a player tool? It doesn't seem as intuitive to me.

Hope this was at least somewhat helpful.

a1b2
Posts: 70
Joined: Mon Jun 01, 2015 5:50 am

Re: sticky expertise, power attack, etc

Post by a1b2 » Sun Jan 17, 2016 6:55 am

Thanks Septire, I just sent a message :)

User avatar
Liareth
General Admin
General Admin
Posts: 1167
Joined: Mon Sep 08, 2014 8:25 am

Re: sticky expertise, power attack, etc

Post by Liareth » Sun Jan 17, 2016 1:48 pm

We accomplish this using a custom NWNX plugin which I wrote. It requires two hooks. CNWSCreature::ToggleMode and CNWSCreature::SetCombatMode. There is no nwscript-side logic for this behaviour, though I did expose two events for the these hooks which scripts can subscribe to.

From memory . . .

ToggleMode is called when the user requests a combat mode, e.g. expertise. It validates that the mode can be applied by checking current weapons and feats.

SetCombatMode is called whenever the request in ToggleMode has been confirmed as valid. It is also called when performing an action that would typically clear your combat mode, for instance, moving.

The logic is fairly simple:

- When ToggleMode is called, verify that the mode can be toggled.
- If it can be, insert an entry into a map between the creature's memory address and the toggled mode. This is the "sticky map".
- In SetCombatMode, if the sticky map for that creature is clear, just use the existing behaviour.
- If it isn't clear (it has an entry), only allow the mode to be set if we're switching to the correct sticky mode. This ensures that the mode will never be modified from the sticky state unless ToggleMode is called first.

User avatar
Liareth
General Admin
General Admin
Posts: 1167
Joined: Mon Sep 08, 2014 8:25 am

Re: sticky expertise, power attack, etc

Post by Liareth » Fri Jan 29, 2016 1:26 pm

FYI, you (or anyone else who is interested) can now grab all of our NWNX code from branches in this repo: https://github.com/ScholarMidnight/nwnx ... t-objcache

a1b2
Posts: 70
Joined: Mon Jun 01, 2015 5:50 am

Re: sticky expertise, power attack, etc

Post by a1b2 » Wed Mar 02, 2016 12:05 am

Scholar Midnight wrote:FYI, you (or anyone else who is interested) can now grab all of our NWNX code from branches in this repo: https://github.com/ScholarMidnight/nwnx ... t-objcache
ooOOOoo!

Ohh :( sadface, it is 404'ed

Post Reply