Jump to content

[LE] Code optimization questions


Recommended Posts

 

 

You have no idea how much time I've wasted on trying to find a better way to access the entire inventory. It'll help a ton with another mod I'm working on. If I alter one form in the list though, will it alter every instance, or just a random one? Specifically, I'm changing armor and damage ratings on equipment.

 

 

Set operations performed on a non-ObjectReference Forms (e.g. Weapon, Armor, etc) I believe will change all instances of it throughout the game. AIUI they're also prone to unintended consequences. I haven't personally used them much, though, so I can't speak to if the ones you're intending to use have those issues.

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

I can't figure out how the doomTowerPerk is recognizing locks. Everything else is fairly self-explanatory, and I think I could probably make the necessary changes fairly easily, but if I don't understand the how it recognizes a lock, I can't redirect it to mannequins.

 

Edit: Still not sure how it's doing it, but I think I know how I can do it. I just have to figure out how to get a papyrus fragment to compile when it won't let me define a property necessary for compilation until after it's been compiled.

Edited by jacobpaige
Link to comment
Share on other sites

 

 

 

You have no idea how much time I've wasted on trying to find a better way to access the entire inventory. It'll help a ton with another mod I'm working on. If I alter one form in the list though, will it alter every instance, or just a random one? Specifically, I'm changing armor and damage ratings on equipment.

 

 

Set operations performed on a non-ObjectReference Forms (e.g. Weapon, Armor, etc) I believe will change all instances of it throughout the game. AIUI they're also prone to unintended consequences. I haven't personally used them much, though, so I can't speak to if the ones you're intending to use have those issues.

 

Ah, yes, if it affected all the NPCs too then that would be bad. I expect my current approach has the same problem and I've just not tested for it. I may have to give up on that mod :(

Link to comment
Share on other sites

It would seem that I was right the first time. The papyrus fragment problem wasn't hard, but I still can't figure out how to get the perk to recognize that I've clicked on a mannequin. I've tried GetIsRace == ManakinRace and GetIsInList [MannequinActivateTrigger, PlayerHouseMannequin], but neither work. I'm really not sure what else I can do to distinguish them, and I still don't see how doomTowerPerk is identifying locks.

Link to comment
Share on other sites

It would seem that I was right the first time. The papyrus fragment problem wasn't hard, but I still can't figure out how to get the perk to recognize that I've clicked on a mannequin. I've tried GetIsRace == ManakinRace and GetIsInList [MannequinActivateTrigger, PlayerHouseMannequin], but neither work. I'm really not sure what else I can do to distinguish them, and I still don't see how doomTowerPerk is identifying locks.

 

This is because what you activate with stock mannequins is not the mannequin itself, but an activator called MannequinActivateTrig, which passes the activation along to the mannequin processes. Also, make sure you're looking at the correct condition list: There's the condition list for choosing the perk at all, on the main perk screen, and the condition list on the perk entry point, which (for the Tower stone) will have two tabs, 'Subject' and 'Target'. In doomTower's case, the subject tab has the cooldown condition and the Target tab contains the conditions that a. the target needs to be locked and b. can't be a Master or Key lock.

Link to comment
Share on other sites

 

It would seem that I was right the first time. The papyrus fragment problem wasn't hard, but I still can't figure out how to get the perk to recognize that I've clicked on a mannequin. I've tried GetIsRace == ManakinRace and GetIsInList [MannequinActivateTrigger, PlayerHouseMannequin], but neither work. I'm really not sure what else I can do to distinguish them, and I still don't see how doomTowerPerk is identifying locks.

 

This is because what you activate with stock mannequins is not the mannequin itself, but an activator called MannequinActivateTrig, which passes the activation along to the mannequin processes. Also, make sure you're looking at the correct condition list: There's the condition list for choosing the perk at all, on the main perk screen, and the condition list on the perk entry point, which (for the Tower stone) will have two tabs, 'Subject' and 'Target'. In doomTower's case, the subject tab has the cooldown condition and the Target tab contains the conditions that a. the target needs to be locked and b. can't be a Master or Key lock.

 

Well, that's why I added MannequinActivateTrig to the FormList. Just in case that was the problem. It still didn't work. Even the debug notifications didn't happen.

 

Ah, I totally didn't think to look at the target tab of doomTowerPerk. I'll give it another look.

 

Edit: I decided to assume that the script was simply not running because it knew that an activator can't cast a spell, so I was trying to refactor it to point at the mannequin that the activator belonged to. Unfortunately, I can't seem to find a way to ask it what it activates.

Edited by jacobpaige
Link to comment
Share on other sites

Maybe I'm just doing something wrong. Here's what I did that didn't work:

  1. Setup a quest to find the mannequins nearest the player (with a script on the player to start the quest).
  2. Setup a perk using the same options as doomTowerPerk, but with the condition on Target being isInList [MannequinActivateTrig, PlayerHouseMannequin] and with no requirements on the Subject.
  3. Added the code below as the perk fragment. It basically just resets the quest and then polls the aliases within the quest to try to figure out which one is the mannequin that owns the activator the player just pressed.

 

 

;BEGIN FRAGMENT Fragment_19
Function Fragment_19(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
MannequinEquipmentTradingQuest.Reset()
MannequinEquipmentTradingQuest.Stop()
MannequinEquipmentTradingQuest.Start()
Utility.Wait(0.01) ;give quest a chance to populate aliases

Actor mannequin
int index = 0

while(index < 3)
    mannequin = ((MannequinEquipmentTradingQuest.GetAlias(index)) as ReferenceAlias).GetReference() as Actor
    if mannequin && akTargetRef.isActivateChild(mannequin)
        EquipmentTradingSpell.Cast(mannequin, akActor)
        index = 4
    endif
    index += 1
EndWhile

if index == 3
    Debug.MessageBox("Could not find matching mannequin")
endif
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SPELL Property EquipmentTradingSpell  Auto  

Quest Property MannequinEquipmentTradingQuest  Auto  

 

 

 

But all of that does nothing. When I walk up to a mannequin and click on it, it just opens its inventory.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...