Jump to content

Sirgallyhave

Premium Member
  • Posts

    56
  • Joined

  • Last visited

Nexus Mods Profile

About Sirgallyhave

Profile Fields

  • Country
    Canada
  • Currently Playing
    Modding

Recent Profile Visitors

6612 profile views

Sirgallyhave's Achievements

Contributor

Contributor (5/14)

  • Reacting Well
  • Dedicated
  • First Post
  • Collaborator
  • Week One Done

Recent Badges

0

Reputation

  1. Just in case someone else runs into this thread in the future and wonders what I did originally, a way to get an actor to pay attention to a script that extends ReferenceAlias is to add something to the inventory of that actor, like an amulet you give a unique name and ID in the CK. For example, if you need an actor to do something that uses data or functions in a ReferenceAlias script if the actor enters a trigger, you could do this: Armor property my_custom_amulet auto event OnTriggerEnter(ObjectReference akActivator) Actor actor_ref = akActivator as Actor if actor_ref actor_ref.AddItem(my_custom_amulet) actor_ref.EquipItem(my_custom_amulet) endif endevent Then in the ReferenceAlias script attached to the actor via an alias, watch for items being equipped: Armor property my_custom_amulet auto event OnObjectEquipped(Form akBaseObject, ObjectReference akReference) Armor armor_base = akBaseObject as Armor if !armor_base && akReference ;got a persistent ref? armor_base = akReference.GetBaseObject() as Armor endif if armor_base && armor_base == my_custom_amulet ;do whatever needs doing here endif endevent
  2. Agreed, it's what I've ended up doing. I need the ReferenceAlias objects to put AI packages on various actors to get them to come to my homestead and sit at whatever table for breakfast, lunch or dinner. I figured I could kill two birds with one stone by having a script on each alias do the outfit management, but a magic effect is the way to go in this case and it's what the Luxury Suite does in its pools/spas too, so I know it works. Thanks for responding.
  3. It's a good idea. Thanks for taking the time to respond. I don't think I'll do it in this case but I'm definitely going to keep it in mind for other uses in the future because it could come in really handy.
  4. Thanks for the prompt response, Peter. There really isn't anything to post from the script other than the examples I gave above. It's really just one line of code that will either make or break everything. I can either cast from ObjectReference (or potentially ObjectReference.GetBaseObject()) to something that allows me to gain access to the ReferenceAlias containing the reference (the result of GetReference()), or I'm going to have to search through a ton of different aliases every time actors enter various big trigger box areas to find out which alias each actor is in, which is likely going to cause stuttering in the game when many different actors are coming and going. The script each RefererenceAlias attaches saves the gear the actor is wearing, then strips them to prepare them to be equipped in a custom outfit. That script (the ReferenceAlias one) has a function called Undress() that I want to call from OnTriggerEnter but I can't figure out how to get access to a ref alias script when all I know is the actor's ObjectReference from OnTriggerEnter events. It's a large script that'd make no sense if I posted it because it's part of a big custom outfit system that itself is part of a mod like the Luxury Suite. I'm just stuck on one line of code and it's just a matter of whether it's possible to get at the ReferenceAlias an Actor is "in" (forced ref) via the attached script or something else that I'm not thinking of (an inventory object, keyword or faction from the alias), or I'm going to have to do it the slow way of searching tons of different aliases from the top-down every time someone enters or leaves various trigger boxes. The actors are potentially employees of the residence, who should stay in their uniforms and not wear custom outfits (like a random Daily-Wear outfit) in the trigger areas. Others are guests from around Skyrim, others are residents of the estate, and the player and his or her followers go in other ReferenceAlias objects spread across multiple quests that I don't want to have to search through because it'll be slow. This is the third time I've redesigned the whole system just because I can't figure out how to store what gear (and outfit) is equipped on each actor before equipping custom outfits. I was using arrays with one array holding each actor's ref ID, another holding the original outfit the Actor is wearing, but it's not enough. Followers end up with gear that isn't in outfits, and my mod is mainly driven by followers the player puts in his game and then invites to parties and whatnot at my version of the Luxury Suite. I think I'm going to have to go back to using a spell to get the script attached to actors who enter various trigger areas. It's what the Luxury Suite does, and is what I originally did months ago, but it's slow and scripts attached to spells lag due to multithreading. Though I suppose it's no worse than scripts attached to ReferenceAlias objects.
  5. I have a quest with a bunch of ReferenceAlias objects. Inside each ReferenceAlias is an Actor set with a forced ref. During the game, those Actor objects go into a trigger box via AI packages (or maybe it's PlayerRef or a follower) and I need to get access to the ReferenceAlias the Actor is in. I only have: event OnTriggerEnter(ObjectReference akActivator) Every Actor in these ReferenceAlias objects has a script attached that extends ReferenceAlias. I need access to the script attached to each Actor via the ReferenceAlias. Is there a way to cast ObjectReference akActivator to the ReferenceAlias script? MyRefAliasScript myVariable = akActivator as MyRefAliasScript won't compile because we can't cast an ObjectReference type to a ReferenceAlias. How do I do this? I'm using Skyrim v1.6.1170.0 and SKSE is no problem. I can cycle through every alias in the quest using SKSE's GetNthAlias() to compare GetReference() to akActivator. But it'd be slower than casting to get access to the attached script from akActivator, if it's doable.
  6. Thanks for the clarification. I've seen that too. I'm looking at the Creation Club fish tanks because they use an Activator Parent on a container linked to a trigger (Activator) in front of each fish tank. The containers are under the floor in the void, so they can't be activated directly. The Activators being used (trigger box, ccBGSSSE001FishTankLargeAct and ccBGSSSE001FishTankSmallAct for large and small fish tanks respectively) have no scripts on them at all and nothing is linked to them other than the containers ccBGSSSE001_FishTankSmallChest and only via Activate Parent. So, the script attached to each container can't access the trigger to block activation because we can't get Activate Parent links through scripts (that I know of). They don't have a Linked Ref to the Activator, so the script attached to each chest can't block activation on the trigger because they don't have access to the trigger. All I can see are Activators (trigger boxes) in front of each fish tank with no scripts on them, so no blocking of activation. They activate the containers via Activate Parent on the container references, and those scripts don't block activation or have any access to the activators. It's baffling. When I put an Activator Parent on a container, it won't open whether a script is attached or not, and I can't even get the container to open with a Papyrus call to Activate() even though I'm positive the event is being received by the container. A debug message tells me that OnActivate is being triggered but Activate() won't work if there's an Activate Parent on the container reference... except when I look at the CC fish tanks, it's exactly what they do and it works fine. I must be blind. I have to be missing something. Maybe someone who's figured it out will post at some point and the mystery will be solved. But I think we've pretty much exhausted it for now and your suggestion works fine, so thanks.
  7. That's what I ran into when I was googling around initially. Someone mentioned enabling Parent Activate Only which is a checkbox on the Activate Parent tab. I thought maybe turning that on would fix things by blocking activation on the chest itself, but it had no effect, unfortunately, and the Creation Club containers don't do it. The way they deal with it in the CC fish tanks is by putting the containers in the void, so the player can't activate them directly. They put Activators (trigger boxes) in front of the fish tanks (which are just static objects) and make the trigger boxes the Activate Parent for each tank with the actual containers under the floor in the void, so no one can get at them to activate them directly. It's so strange that it works when I can't see any difference between how the CC containers are doing things to how I'd set things up before. In any case, your suggestion worked and that's what matters (to me) the most, so I can get back to work. Thanks again for taking the time to help out, I appreciate it and your suggestion works perfectly.
  8. I noticed that and tried it because I couldn't see any other difference. It shouldn't matter when akActionRef is PlayerRef / Game.GetPlayer(). But I did change it to self.Activate(Game.GetPlayer(), true) (and without true) and still no luck. Good suggestion though.
  9. Thanks for the suggestion, @xkkmEl. That did the trick and I don't know if I would have thought of it before clawing my eyes out. lol I still wonder how the Creation Club fish tank containers manage to open when they use Activate Parent links to activators in front of each tank.
  10. I'm not sure what's going on either, @dylbill. Thanks for the example, that's exactly what I'd expect. Activate Parent on a reference just allows a different activator to activate something, which is how doors get activated from levers and such. That's working. I have a regular Activator (trigger) in a specific location and I can activate it fine. It then does send the activation event to the script attached to the container. I.e. in the script on the container using the Activate Parent, this debug message gets logged: ;this script is on the container with the Activate Parent event OnActivate(ObjectReference akActionRef) Debug.Trace("OnActivate begins") ;this is being logged, so the event is triggering self.Activate(akActionRef, true) ;nothing happens endevent I ran into several other posts stating the same thing when I was looking for a solution (that Activate() is doing nothing) and no one seems to know what's going on. I'm missing something but I don't know what. In the same mod, I've got a Creation Club fish tank not far away with an Activate Parent activating a container via an Activator Parent and it's working fine. I put a barrel on the floor to test, then put an Activator (trigger) beside it and set that trigger as the Activate Parent on the barrel and the barrel won't open when no script should even be necessary. Activate Parent should simply pass the OnActivate event from the trigger to the barrel and it does but I can't get the barrel to open when Activate Parent is used. I need the visual/manual inventory UI so the player can put stuff into the barrel (or whatever container) and take stuff out. I then check what's in there when OnClose is triggered, but the inventory UI never opens.
  11. I'm perplexed again. With Skyrim v1.6.1170.0 and the Creation Kit 2.0 v1.6.1130.0 I'm trying to activate a container via an Activate Parent. I know we're not supposed to be able to do it. The wiki says under References, "Containers appear to be bugged and cannot be activated through any activate parent." But the Creation Club fishing tanks in the Hearthfires homes use containers that players open via Activators in front of the tanks via Activate Parent in the container reference (under the floor). All I can see happening in the OnActivate event handler in the (decompiled) script attached to each CC fishing tank container (ccBGSSE001_FishTankContainerScript.psc) is self.Activate(Game.GetPlayer(), true). After that, the next thing in OnActivate is UpdateFish() which looks to me like the OnItemAdded() event handler and AddFish() function have already finished and the container has been closed. But when I try Activate(Game.GetPlayer(), true) in my own script's OnActivate() event handler attached to the same type of container (without Betheda's script attached), nothing happens. I need the container to open and for the player to be able to put stuff in or take stuff out of the container, so I can watch for that via the OnItemAdded event. I know I can probably use a dummy NPC (Actor) as the container with ShowGiftMenu() or OpenInventory() (which I can't get to work on a container), but I'd rather use what the CC fish tanks are using, an invisible container in the void. Has anyone figured this out? I also saw open player inventory from script (uses Input.Tapkey()) and will probably go with that method if no one knows how the fish tanks are managing to get Activate Parent to work. I'm missing something but I can't figure it out, so it must be something simple right in my face that I'm not noticing. lol This is the decompiled CC script Bethesda attaches to one of the orange containers bookcases use:
  12. I don't know how likely it is that someone will run across this in the future and wonder how I solved the issue. But I always get frustrated when people leave threads open without explaining how they solved things, so I'll explain just to close the topic. I ended up using GlobalVariable types (one per race/creature type, like one global to hold the setting for wolves, another for bears, etc.) that I dropped into a FormList. The list can be accessed from scripts that extend ActiveMagicEffect and scripts attached to MCM quests for player configuration of settings just by putting a property in each script: FormList property my_globals_list auto You can drag and drop GlobalVariables from the CK Object Window into FormLists and then the list can be accessed like an array: GlobalVariable one_setting = my_globals_list.GetAt(offset) as GlobalVariable That's what I did to solve this, so I can access the globals (the settings my MCM allows players to change) from the script on the magic effect and from the script on my MCM quest. In testing I've done, it's over ten times slower than using an int[] to store settings, but I think it's probably as fast or faster than using a JSON. Using JContainers would be better though since it'd allow players to configure the settings one time and then they could access the same settings from multiple save games.
  13. Oh, interesting. I had no idea Wait() released the locks. That's good to know. I also didn't think of just copying the array in OnEffectStart. That's a good suggestion but in this case, I'm in and out of that event one time just to set the creature's aggression, or to disintegrate it, and I never need to access the OnEffectStart in the script on any one creature again. So I'd probably spend more time copying the entire array than just accessing it one time (the setting could be at index [0]) to find out what to do with a given creature. Hmm. I just realized I should probably put wolves at index [0] instead of where I have them now in alphabetical order at the end of the array. lol I've never used JContainers or JSON in anything. I'll take a look, thanks for the link.
  14. Thanks for the tips. I'm storing akCaster in a local variable right off the bat in OnEffectStart. I'm not really using OnEffectFinish other than for debugging just curious to see when it's triggered. All I have to do is get the Actor from akCaster into a local and then I do whatever to wolves, bears and such as per the setting and that's that. The issue I'm having now is that I can't get an ActiveMagicEffect into a property. I need access to the script attached to my ActiveMagicEffect in my MCM script because the script attached to the magic effect has the array of ints in it for the settings (whether a creature should be made cowardly, disintegrated, disintegrated and leave an ashpile to loot, or keep its default behavior). I can't figure out how to get access to the int[] that I store those settings in. It's simple if I put the array in the MCM script. Then, I can access that array in the magic effect itself by referencing my MCM quest to get the attached script (and the int[] property). But that causes bottlenecks. The game waits whenever it has to access data or a function in another script. It's why I put the settings (the int[]) in the ActiveMagicEffect script itself, so the settings are right there and I don't have to access another script which can cause huge delays. My Magic Effect that attaches the control script has a condition check to ensure the object is in CreatureFaction, so hopefully when NPCs spawn for civil war stuff, my mod won't crash the game. I only need to operate on actors that are in CreatureFaction so I hope the game will notice that condition in the magic effect and not attach the script to anything that isn't in that faction. But this is just getting mind-boggling (as usual around Skyrim). Reference aliases don't trigger any events when they get filled, so they're useless to me. So I either modify base objects like EncWolf directly attaching my script to them, or I use the magic 'cloak' example from Dynamically Attaching Scripts. If I do that, I have to use a script that extends ActiveMagicEffect... and if I do that, I can't get access to the int[] storing the setting for each creature type in my MCM script making the settings impossible to change. Typical Skyrim modding. It seems to be how everything goes. Edit: I'm going to have to change how I'm doing this. I get that ActiveMagicEffect doesn't exist until the spell is cast and it operates on a specific actor. And the wolves and whatnot my script operates on often don't exist when the game loads. They spawn as the player character moves around, so there's no script to reference from the perspective of the CK. If I use GlobalVariable types to store my settings, I can put the globals into a list and then I can access the settings (get at the different globals) from the magic effect script and my MCM script. It's just much slower to use a list of globals than to use an int[]. I have to be able to index the setting per creature type (bear, wolf, etc.) according to what gets matched in a Race[] I'm checking akCaster.GetLeveledActorBase().GetRace() against. That's why I'm using Race array. It's fast but when I get a match, I only have an array index to work with and that's why I moved my settings from globals to an int[]. But that doesn't seem do-able, so I'll have to go back to using globals and put the global (the MCM setting) for each race my system handles in a FormList that matches the Race array I'm checking. I've done that before, so I know it's possible. But it's slow to access FormLists as opposed to just indexing an int[] and I'm worried my mod is going to bog down the game.
  15. Cool, thanks for the summary. I switched to a MagicEffect and it seems to be working fine but I haven't done a lot of testing yet. Thanks for taking the time to give me a hand with this. I appreciate it.
×
×
  • Create New...