Jump to content

Recommended Posts

I'm working on my first custom voiced follower mod, and want to add certain voice lines that will only activate when the player is encumbered,

I've been able to use the conditions for many other things, like checking which items the player has in their inventory, the time of day, etc.

Though I can't seem to find a way to set encumbrance as a condition.

 

Anyone have any ideas how I could make that happen?

Link to comment
Share on other sites

I don't think this will be possible without some polling and scripting, as I don't see the condition IsOverEncumbered in the CK.

 

This is how I would do it. I would make a spell ability and put it on the player, that tracks the players carry weight with a global variable.

For an example, just call the global variable PlayerCarryWeightTracker

Put the condition on the spell's magic effect: GetActorValue CarryWeight != (check the Use global box and choose PlayerCarryWeightTracker)

Then, on the spell's magic effect, put this script:

 

Scriptname PlayerCarryWeightTrackerScript extends ActiveMagicEffect 

GlobalVariable Property PlayerCarryWeightTracker Auto 
Actor Property PlayerRef Auto 

;This magic effect starts whenever the players carry weight changes

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Utility.Wait(1)
    PlayerCarryWeightTracker.SetValue(PlayerRef.GetAV("CarryWeight"))
EndEvent

Then, in your dialogue, put the condition GetActorValue InventoryWeight >= (check the Use global box and choose PlayerCarryWeightTracker) and have it run on the player.

Link to comment
Share on other sites

I don't think this will be possible without some polling and scripting, as I don't see the condition IsOverEncumbered in the CK.

 

This is how I would do it. I would make a spell ability and put it on the player, that tracks the players carry weight with a global variable.

For an example, just call the global variable PlayerCarryWeightTracker

Put the condition on the spell's magic effect: GetActorValue CarryWeight != (check the Use global box and choose PlayerCarryWeightTracker)

Then, on the spell's magic effect, put this script:

 

Scriptname PlayerCarryWeightTrackerScript extends ActiveMagicEffect 

GlobalVariable Property PlayerCarryWeightTracker Auto 
Actor Property PlayerRef Auto 

;This magic effect starts whenever the players carry weight changes

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Utility.Wait(1)
    PlayerCarryWeightTracker.SetValue(PlayerRef.GetAV("CarryWeight"))
EndEvent

Then, in your dialogue, put the condition GetActorValue InventoryWeight >= (check the Use global box and choose PlayerCarryWeightTracker) and have it run on the player.

 

What a brilliant idea, thank you!

 

I followed your steps a few times, but sadly I couldn't get it to work. My follower just says the lines at random intervals, regardless of the player's inventory state.

I'm pretty sure it's because I made a mistake somewhere though, since up until this point I've only made house or cosmetic npc mods, so I don't have any experience with creating spells and the like.

 

I've taken a few screenshots of what I did, so that you might be able to spot my mistake.

 

(Screenshots part 1: Global Variable and Script)

Edited by ElbyDreamer
Link to comment
Share on other sites

It looks like your script isn't running, so your global variable is staying at 0.

 

In your script, get rid of the second line and the bracket "}" after EndEvent, then save / compile the script. Then you have to fill the properties. Click on the script in the magic effect, click Properties then click auto fill all. Both properties should be filled as you've already made the global variable.

 

To check if the script is running, you can add a debug.notification, like so.

 

Scriptname PlayerCarryWeightTrackerScript extends ActiveMagicEffect 

GlobalVariable Property PlayerCarryWeightTracker Auto 
Actor Property PlayerRef Auto 

;This magic effect starts whenever the players carry weight changes

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Utility.Wait(1)
    PlayerCarryWeightTracker.SetValue(PlayerRef.GetAV("CarryWeight"))
    Debug.Notification("Player Carry Weight Changed")
EndEvent

If the script is running, you should get a notification when you first load your game, and whenever your player's carry weight changes.

 

Oh, one more thing, I forgot you have to add the ability to the player. To do this what I typically do is put a script on a new quest that's start game enabled, like this:

Scriptname ED_CarryWeightInitScript extends Quest 

Spell Property ED_PlayerCarryWeight Auto 
Actor Property PlayerRef Auto 

Event OnInit() 
    Utility.Wait(1)
    PlayerRef.AddSpell(ED_PlayerCarryWeight) 
    Utility.Wait(1)
    Self.Stop() ;Stops this quest. 
EndEvent

Don't forget to fill the properties of the quest script too.

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...