R3V0LUTI0N4 Posted August 9, 2018 Share Posted August 9, 2018 I currently am using a quest and during the OnInit() event I use RegisterForRemoteEvent() to then add the OnDeath event for Takahashi so that I can run a certain script when Takahashi is killed. Is there a way to apply this to all vendors in an easy way or will I have to do it manually for each vendor? ObjectReference Property PTakBox Auto Const MandatoryEvent OnQuestInit() RegisterForRemoteEvent( PTakBox.GetActorOwner().GetUniqueActor(), "OnDeath") EndEventEvent Actor.OnDeath(Actor akSender, Actor akKiller) if akSender == PTakBox.GetActorOwner().GetUniqueActor PTakBox.RemoveAllItems(akTransferTo = akSender) endIfendEvent Link to comment Share on other sites More sharing options...
Magicockerel Posted August 9, 2018 Share Posted August 9, 2018 You can give the player a cloak via an ability that applies a script to all actors that meet certain conditions. There are several different mods and vanilla features that use this method. An example of a vanilla feature would be the power armor targeting HUD modification. Instead of an ability, this uses an enchantment, but you can easily substitute it for an ability that you give to the player via a perk. The forms go:EnchPA_TargetingHUD (an enchantment on the object mod) PA_TargetingHUD_Cloak (a cloak that the enchantment grants) DetectLifeCloakSpell (a spell that the cloak applies) DetectLifeCloakEffect (a script that the spell applies to the actors that meet the specified conditions)Keep in mind that DetectLifeCloakEffect uses a script effect archetype so that it can apply the effect shader without doing anything else. You could either add a script on top of the effect shader, or remove the effect shader and add the script. A better example would be the locational damage mod. I say better because it works in the way that you want it to work, without having to make those changes I mentioned. The forms work in a similar way:BLD_Cloak (an ability on the player instead of an enchantment on an object mod) BLD_CloakApplyEffect (a cloak that the ability applies to the player) BLD_ApplyScript (a spell that the cloak applies) DetectLifeCloakEffect (a script that the spell applies to the actors that meet the specified conditions)So if you set up something like this, all you would need is a set of conditions that allow the spell to identify just the vendors (e.g. a keyword, a conditional property, a faction, etc.) - I would check the WorkshopParent aliases, which would likely apply something that you can check for to just the vendors. Make sure to create a new perk that has the first spell as an ability, and to add that perk to the player via a quest or something. Link to comment Share on other sites More sharing options...
SKKmods Posted August 9, 2018 Share Posted August 9, 2018 There is a super easy way to get the quest story manager to do this stuff for you ... 1. Create a new Formlist and drag all the Actor references you want from the cell view list into it. 2. Quest - Alias - ReferenceCollection - Max Initial fill 255 - Find Matching reference - Conditions (this can take some messing around to get the right factions, keywords and whatnot so I use lists): 2a GetIsObjectType: Actor2b IsInList: Your form list 3. Attach a new script to the alias that will run against any and all members: Event OnDeath(ObjectReference akVictimRef, Actor akKiller) Self.RemoveRef(akVictimRef) ; do all your other stuff here EndEvent Link to comment Share on other sites More sharing options...
R3V0LUTI0N4 Posted August 10, 2018 Author Share Posted August 10, 2018 You can give the player a cloak via an ability that applies a script to all actors that meet certain conditions. There are several different mods and vanilla features that use this method. An example of a vanilla feature would be the power armor targeting HUD modification. Instead of an ability, this uses an enchantment, but you can easily substitute it for an ability that you give to the player via a perk. The forms go:EnchPA_TargetingHUD (an enchantment on the object mod) PA_TargetingHUD_Cloak (a cloak that the enchantment grants) DetectLifeCloakSpell (a spell that the cloak applies) DetectLifeCloakEffect (a script that the spell applies to the actors that meet the specified conditions)Keep in mind that DetectLifeCloakEffect uses a script effect archetype so that it can apply the effect shader without doing anything else. You could either add a script on top of the effect shader, or remove the effect shader and add the script. A better example would be the locational damage mod. I say better because it works in the way that you want it to work, without having to make those changes I mentioned. The forms work in a similar way:BLD_Cloak (an ability on the player instead of an enchantment on an object mod) BLD_CloakApplyEffect (a cloak that the ability applies to the player) BLD_ApplyScript (a spell that the cloak applies) DetectLifeCloakEffect (a script that the spell applies to the actors that meet the specified conditions)So if you set up something like this, all you would need is a set of conditions that allow the spell to identify just the vendors (e.g. a keyword, a conditional property, a faction, etc.) - I would check the WorkshopParent aliases, which would likely apply something that you can check for to just the vendors. Make sure to create a new perk that has the first spell as an ability, and to add that perk to the player via a quest or something.Thanks alot! I appreciate it. I'll have to give it a go. Link to comment Share on other sites More sharing options...
R3V0LUTI0N4 Posted August 10, 2018 Author Share Posted August 10, 2018 There is a super easy way to get the quest story manager to do this stuff for you ... 1. Create a new Formlist and drag all the Actor references you want from the cell view list into it. 2. Quest - Alias - ReferenceCollection - Max Initial fill 255 - Find Matching reference - Conditions (this can take some messing around to get the right factions, keywords and whatnot so I use lists): 2a GetIsObjectType: Actor2b IsInList: Your form list 3. Attach a new script to the alias that will run against any and all members: Event OnDeath(ObjectReference akVictimRef, Actor akKiller) Self.RemoveRef(akVictimRef) ; do all your other stuff here EndEvent Thanks! I'll have to try this. Link to comment Share on other sites More sharing options...
SKKmods Posted August 10, 2018 Share Posted August 10, 2018 With the right story manager conditions you can get the quest alias to fill totally automagically with any X (say vendors) that happen to be in the game, which is great as it allows for DLCs and other mods no hard coding. The challenge is finding the right conditional attributes or incantations for this stuff. Whilst the generic wasteland and workshop traders are all in the DialogueMechantsFaction, there is no common vendor faction / keyword / linkref to test that includes uniques, so they need to be driven by a fixed lookup list. Memo: having a standard IamaVendor (don't shoot me) keyword would be super useful for many of my mods. Link to comment Share on other sites More sharing options...
Recommended Posts