Spell conditionals not working?

Post » Wed Jun 20, 2012 9:27 am

Currently running into an issue. I'm working on making it so wearing heavy armor dynamically reduces your speedmult depending on your player skill level for Heavy Armor.

I got the magic effect working properly. It's a basic SpeedMult changer. Currently, for debug purposes, the only way to add this effect is through the console. When I add it through the console, it works perfectly.

However, it's a global change. When I try to change the conditional statments on the effect to only happen if the player HasKeyword = HeavyArmor and ArmorCuirass the game refuses to add it to the player. If I just have it so the spell effect is conditional to the keyword HeavyArmor, it still doesn't work (the console refuses to add it to the player).

Even if I am no wearing any armor, or a full suit, or just some pieces, it won't work as long as I have a conditional statement in there. The moment I remove it, it works fine (but also it goes on 24/7, when I just want the spell effect to kick in when the player wears armor).

Any help?
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Tue Jun 19, 2012 7:43 pm

For starters, have the effect apply a hit effect just so you know whether it's really working or not. I say this because the SpeedMultiplier as a magic effect is actually rather buggy and requires the carryweight to be adjusted afterwords, or the player to open inventory before it kicks in. Alternatively, check your inventory and then see if the speed multiplier kicks in. If that's the problem...

The best way to handle that might be to make your effect a scripted one. Modify the speedmult via your script, and directly after that modify the carryweight down one and then back up one. Both are Actor Values.

-MM
User avatar
Sammygirl
 
Posts: 3378
Joined: Fri Jun 16, 2006 6:15 pm

Post » Tue Jun 19, 2012 8:21 pm

SpeedMult work perfect, that's not the issue I'm having. The problem is, once I start to add conditonal statements through either the spell effect or the perk it is applied from, I get an error when I try to manually add the spell to my player via console saying "Did not add XXX spell". BUT if I don't use conditionals at all, it works perfect. So the game just refuses to add a spell, not that the spell isn't working as is.

And I know about the game never checking speed until inventory is managed. The effect I want only deals with players having heavy armor, so the player would either have to use the inventory or level up for the change to kick in on my spell effect, and both of which I'm pretty sure causes the game to check what the speedmult is.
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Wed Jun 20, 2012 3:54 am

Any help? :(
User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Wed Jun 20, 2012 7:15 am

make sure you are using WornHasKeyword instead of HasKeyword.

because equipping armor does not give the player the keywords, the keywords are on the armor itself. if you use HasKeyword, the spell is looking for the player to have those keywords (which it does not)
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Tue Jun 19, 2012 9:35 pm

Oh! Thank you. I'll try that right away. I was basing "HasKeyword" on the fact that all the perks that relate to armors point to that one. Seeing as I'm having the conditionals take effect in my spell and not the perk, that's probably why it wasn't working.
User avatar
ijohnnny
 
Posts: 3412
Joined: Sun Oct 22, 2006 12:15 am

Post » Tue Jun 19, 2012 10:40 pm

That worked perfect, thanks.

But now I'm having the same problem but with the perk :tongue:

I've got my spells hooked up into one perk. The spell effects work great now (if I have the right piece of heavy armor on, it activates, and if I don't it doesn't). The issue is I've got my perk set with the conditions that the GetActorValue of Heavy Armor is less than 10 (for example). In other words, the perk should theoretically only work when I have less than 10 HA skill. But this isn't the case- the perk is always working 100% of the time, reguardless of the player skill level. Perhaps it's because I add the perk in via a script, and the conditonal statements only apply if you manually "perk into" it? If so, how would I get perks to have conditonals yet make them just *apply* to the player?

I want to avoid making a performance intensive script that just checks OnUpdate every second or so what the skill level is, because not only is this buggy (it doesn't work in-menus, and when speedmult changes when out-of-menu nothing happens) but it is also easy for the game to miss an update if FPS is low and it would be performance intensive to do this for EVERY spell effect/perk out there.
User avatar
Rex Help
 
Posts: 3380
Joined: Mon Jun 18, 2007 6:52 pm

Post » Wed Jun 20, 2012 5:13 am

giving the player the perk via script will bypass the conditions. its sort of the same as cheating a perk in the console (like console-adding daedric smithing before any of the other requirements, the daedric perk still works 100% despite the conditions)

it sounds like your system would work better if managed through the Story Manager using a Skill Increase event to listen for the right skill level for heavy armor (this avoids setting up a constant OnUpdate loop)
User avatar
Izzy Coleman
 
Posts: 3336
Joined: Tue Jun 20, 2006 3:34 am

Post » Wed Jun 20, 2012 4:21 am

Story manager? Guess I'll have to look up how that works :P

Thanks for all your help, it gives me a nice direction to head to.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Tue Jun 19, 2012 11:52 pm

alternatively (if the story manager is overkill for what you are doing), you can set up multiple perks and have the level restricted conditions on the spell effect themselves.

like for example, say up to level 10 you have slow speed
level 10+ - 30 = medium speed
level 30+ = fastest speed.


so make 3 perks that are all given to the player at the same time, each one having the speed multipliers accordingly

then in your spell conditions, have restrictions set like

WornHasKeyword ArmorHeavy == 1 AND
GetActorValue HeavyArmor >= 1 AND
GetActorValue HeavyArmor < 10 AND

etc.


all spells will be active at the same time, but the effect will only apply when the player's skill level falls into the bounds of the conditions

IMO the story manager is a much cleaner way of doing it, and you have much more flexibility with scripts through use of quests, but as such it is much more involved and takes more setting up, and may not really be necessary if your end goal is not going to be as complex.
User avatar
Amy Smith
 
Posts: 3339
Joined: Mon Feb 05, 2007 10:04 pm

Post » Tue Jun 19, 2012 10:11 pm

I've got my spells hooked up into one perk. The spell effects work great now (if I have the right piece of heavy armor on, it activates, and if I don't it doesn't). The issue is I've got my perk set with the conditions that the GetActorValue of Heavy Armor is less than 10 (for example). In other words, the perk should theoretically only work when I have less than 10 HA skill. But this isn't the case- the perk is always working 100% of the time, reguardless of the player skill level. Perhaps it's because I add the perk in via a script, and the conditonal statements only apply if you manually "perk into" it? If so, how would I get perks to have conditonals yet make them just *apply* to the player?

Are these conditions set up here?

[img]http://wiki.tesnexus.com/images/f/fa/Perk_window.png[/img]

As in the main perk conditions box, not in an entry point condition.
If so they will only affect when the perk can be chosen on the level up screen.

The affect you're trying to achieve should be possible by putting that GetAv check on the Magic Effect's conditions.
User avatar
Shiarra Curtis
 
Posts: 3393
Joined: Thu Jan 04, 2007 3:22 pm

Post » Tue Jun 19, 2012 10:58 pm

Yes, that's where I'm putting it. Good to know. Shame there is literally no documention relating to this type of stuff :P

I'll look into story manager and if that doesn't work out good then I'll probably do what Ameythyst suggested with just having my skill check happen in the actual spell itself vs. perk. Not sure why I didn't do that before, actually..
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Wed Jun 20, 2012 1:45 am

Hmm I can't make heads or tails of the story manager in how it actually works and how to actually use it - tutorial doesn't really explain anything other than that it controls radient quests and fills in aliases for such quests. Don't know how that actually happens though.

Gonna just try adding the conditions to the actual spell :)
User avatar
Tanya
 
Posts: 3358
Joined: Fri Feb 16, 2007 6:01 am

Post » Wed Jun 20, 2012 10:37 am

More updates: Conditionals working perfect on my "first level" (under 10 skill = spell ability kicks into gear). I have a perk that adds the spell effects to the player, and the spell effects only kick on when the player has below 10 skill, and is wearing X piece of heavy armor. Once those conditions are met, speedmult is altered.

However, my 2nd level spell (between 10-20 skill) doesn't work at all. It is set up exactly like the first perk - the perk is added to the player on script start, and the perk's abilities are to trigger the conditionalized spell effects. The spell effects are conditionalized just like the first set of spell effects, except their skill level is between 10-20 skill. I even tried getting rid of the skill conditionals on it entirely but only the first "perk" or spell abilities only go into effect. Nothing happens if my skill is between 10-20, but I do get the first perk's spell effects activating sucessfully when my skill level is below 10.

I'm wondering if the game simply loads that first perk first, and since the 2nd perk's spell abilities technically alter the "same stat" (even though it's not set to activate at the same time as the first perk), it just throws it out entirely.

EDIT: Solved it. Simply put, it was due to dirty saves :P This is a good lesson to acknowledge that scripts don't properly apply/change on save files with mods already installed. If there are any updates to said mod on a save you have with that mod enabled, be sure folks to completely uninstall (including the script files), load a clean save, then save with this clean save in order to properly update ;)
User avatar
x a million...
 
Posts: 3464
Joined: Tue Jun 13, 2006 2:59 pm

Post » Wed Jun 20, 2012 2:45 am

about the dirty save issue, the best way to test this kind of thing, especialy with scripts involved, is to not load any saves at all, just COC in the console on the main title screen (some world or interior cell, like COC Riverwood)

and if you need to test conditions based on skill level, you can use the console command player.advskill heavyarmor ### (whatever number amount, use small increments so that you don't skip over levels)
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Wed Jun 20, 2012 7:54 am

Yeah, that's what I've been doing.

Sadly gonna have to cut a lot of what I wanted due to limitations. Got it all working yes, but then I ran into a bad bug - if I wear light armor (which should not intiiate any spell effects for the armor) with any heavy armors, the "light armor" gets counted as a heavy armor and it causes the spell effect to trigger.

Because apparently, WornHasKeyword = a global thing. So if one spell checks if the WornHasKeyword == Boots and WornHasKeyword == ArmorHeavy, normally if you put light armor boots on with nothing else, it would work perfect (as the light armor boots would fail the "heavy armor" check and not start the spell effect).

However, if I have for example heavy armor guantless on as well as the light armor boots, the check would pass for the boots. Since technically I AM wearing heavy armor somewhere on my body, even though it's not the boots that are heavy.

As far as I can tell there's no way around this - wearing any heavy armor anywhere will cause the spell effect to trigger for all armors. Going to instead just restrict this to the cuirass and nothing else (initially I planned on having a the effect apply for each piece of heavy armor, now I know this isn't possible).

Of course the alternative is to create a custom keyword for each and every piece of heavy armor item in the game (i.e. something like KeywordHeavyGauntlets for heavy gauntlets), then have my spell conditions check if this custom keyword is being used. This is what the Fists of Steel perk does, it references a custom keyword made specifically for that perk that is applied to only the heavy armor gauntless. However the big issue with this method (other than it being rather more time consuming to implement) is that it wouldn't work with mods at all, which I'm rather not-okay with.

Perhaps I'll do a combo between the two? Add keywords to all the vanilla armors and have my spell effects look for them, except for the cuiass which would simply check if the armor is heavy and a cuirass. That way the most important and impacting piece (the cuirass) would still work with mods.
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Wed Jun 20, 2012 2:49 am

there is also WornApparelHasKeywordCount which you can set to a value of >= 2 for heavyarmor to check that the player is wearing at least 2 heavy pieces, but then again that would fail if the player is wearing just a heavy cuirass (which it should probably still pass, right?)

i highly advise against editing every heavy armor in the game by adding keywords (which btw, will still not work if you leave out the cuirass - it's edit all or none)


this is something that requires scripts. and you would need a quest with a player alias to attach the script (in which case you would be better off with the story manager again). granted, this is a lot of work, but IMO far less work than editing the hundreds of vanilla armors (which would leave a ridiculously large incompatibility footprint on your mod). the advantage of having a script is it can combine AND conditions and compare them against other combined AND statements with an OR. that is something you cannot do with the built in condition system.


there is no real easy way to do what you describe, but i think you can manipulate the apparelcount condition to better narrow down the pass/fail for which armors are equipped. it won't be perfect, but i think it could work for the majority of scenarios
User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Wed Jun 20, 2012 3:28 am

I wanted to avoid scripting though because it's performance intensive with a lot of it going on, and it's very buggy in low FPS situations. Not to mention scripts don't work when in menus and such :\

The magic effect system is nice because it's very transparent and easy to get predictable results with it. Most importnatly, it works properly - affecting things like speedmult is a nightmare in scripting because changes don't actually take into effect until you use inventory, level up, etc. Seeing as scripts don't run when in menus, that would mean any changes I did to my apparel while in menu wouldn't be detected by the script until AFTER i left it. But by then it's too late because the game won't adjust my speed as I'm not in a menu, leveled up, etc.

I still can't make heads or tails on how I'm supposed to use the story manager to actually do what I want to do, since the tutorial (once again) doesn't really explain how it actually works at all and just gives you a general overview of what it CAN do. It sounds like the SM events are hard-coded in the game and as such it's not going to be possible to add your own, but I could be wrong.

My work around was going to be so it detects how many of X keywords you are wearing with "HeavyArmor" in them while also checking if you are using a cuirass, starting at two keywords and working up to four apparel counts. I thought about just checking the cuirass material type and nothing else, but once again the problem here is if I happen to be wearing steel boots but a fur armor, then the fur armor would still trigger the effect due to me wearing "steel" somewhere on my body.

It's not perfect, because if you technically wear heavy armor boots, gauntlets and a helmit with a light armor cuirass it would trigger the slowdown effect, but that's a pretty specific situation, and technically there's "enough" heavy armor on you to make it somewhat believeable that you'd be slowed down depending on your skill level.

Would adding keywords to the vanilla armors though reallly cause any compatibility issues? I don't think it would since I'm not actually changing anything with it, I'm just giving them new keywords. As far as I'm aware, changes with vanilla items between two mods just merge the changes together, except if they over-write the same exact things, in which case whatever is loaded last is changed. Is this not the case? I.E. if my mod just added keywords and another mod did something else to damage/etc, would mine (if loaded last) overwrite mod #2's damage values, even though I didn't change or do anything to em?
User avatar
Chad Holloway
 
Posts: 3388
Joined: Wed Nov 21, 2007 5:21 am


Return to V - Skyrim