gob2 Posted November 23, 2016 Share Posted November 23, 2016 (edited) EDIT: Solved for now! Woo. Hi. I guess I posted this in the wrong place before. I hope this is the right board. I have a script for unique npcs that fires off fine; Scriptname DeadSpell extends Actor Const Spell property OnDeathSpell auto const{Cast this spell on death.} Event OnDying(Actor Killer)OnDeathSpell.Cast(self , self)EndEvent But for leveled lists you can't add scripts to templates I guess. I've read you need a workaround with a racial ability, but I'm having trouble wrapping my head around that one. Any help would be much appreciated. Edited November 29, 2016 by gob2 Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted November 23, 2016 Share Posted November 23, 2016 Should be able to create an actor with the Lchar as template and post the script into that one (if I'm understanding you correctly). Link to comment Share on other sites More sharing options...
gob2 Posted November 25, 2016 Author Share Posted November 25, 2016 Should be able to create an actor with the Lchar as template and post the script into that one (if I'm understanding you correctly). Thank you for your reply. Actually I'm looking to add scripts to existing leveled lists by adding abilities. I can link existing leveled lists to templates I've made but they don't seem to fire the scripts. For example, I'd like all non-legendary feral ghouls to run one version of the script, all non-legendary raiders another, etc. Link to comment Share on other sites More sharing options...
MasterMagnus Posted November 25, 2016 Share Posted November 25, 2016 (edited) You need to register the script to receive the event. Add this code to your script. Event OnInit() RegisterForRemoteEvent(Self,"OnDying")EndEvent This belongs on an Actor record, where in that context 'Self' will count as the Actor. *EDIT* oops changed that to OnDying() Edited November 25, 2016 by MasterMagnus Link to comment Share on other sites More sharing options...
gob2 Posted November 26, 2016 Author Share Posted November 26, 2016 You need to register the script to receive the event. Add this code to your script. Event OnInit() RegisterForRemoteEvent(Self,"OnDying")EndEvent This belongs on an Actor record, where in that context 'Self' will count as the Actor. *EDIT* oops changed that to OnDying() Thanks again. I'll give that a try. Link to comment Share on other sites More sharing options...
gob2 Posted November 28, 2016 Author Share Posted November 28, 2016 You need to register the script to receive the event. Add this code to your script. Event OnInit() RegisterForRemoteEvent(Self,"OnDying")EndEvent This belongs on an Actor record, where in that context 'Self' will count as the Actor. *EDIT* oops changed that to OnDying() Thanks again. I'll give that a try. I've tried to add that to the script, and link the template to a leveled list, but no dice. http://imgur.com/a/l8ywf I'm going to try to make a dynamic script from the following tutorial (hopefully Fo4 and Skyrim are similar enough) and I'll tell you how it goes :)https://www.creationkit.com/index.php?title=Dynamically_Attaching_Scripts Link to comment Share on other sites More sharing options...
MasterMagnus Posted November 28, 2016 Share Posted November 28, 2016 Your image shows a line OnDeathSpell.Cast(Self,Self). Do you have a property for OnDeathSpell() set up correctly on the script? Is the OnDeathSpell() record set up correctly and you've verified the spell works? Does the OnDeathSpell() only work on a living actor? Even though you're capturing OnDying(), might they have died before the execution of the spell completed? What does OnDeathSpell() do? Perhaps that is code better moved right into the OnDying() event? I'm not 100% on how spawning from a leveled list works, but I think using the LeveledListTemplate is fine. You have the script attached to the base record, every Actor that spawns from that record should have that script. Link to comment Share on other sites More sharing options...
gob2 Posted November 29, 2016 Author Share Posted November 29, 2016 Your image shows a line OnDeathSpell.Cast(Self,Self). Do you have a property for OnDeathSpell() set up correctly on the script? Is the OnDeathSpell() record set up correctly and you've verified the spell works? Does the OnDeathSpell() only work on a living actor? Even though you're capturing OnDying(), might they have died before the execution of the spell completed? What does OnDeathSpell() do? Perhaps that is code better moved right into the OnDying() event? I'm not 100% on how spawning from a leveled list works, but I think using the LeveledListTemplate is fine. You have the script attached to the base record, every Actor that spawns from that record should have that script. I think I got it for now. I had some syntax errors in my scripts, and I guess you can assign spell scripts to a template and it will carry over to leveled lists, but not scripts on the template. Now I need to find out how to merge it with other mods or dynamically add it to the game or something :) Thank you for the help. Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted November 29, 2016 Share Posted November 29, 2016 <snip>...and I guess you can assign spell scripts to a template and it will carry over to leveled lists, but not scripts on the template.That's why I said what I said 7 or so posts back. ;-) I'm not being helpful... Attempt to make this post helpful instead of snarky:Could attach that script to each individual" LVL" actor you want to have the script. Maybe could create a quest that starts game enabled, has a quest alias refcollection with a condition that looks for the keyword actortypeghoul (as an example), then applies the script to what it finds...?Not sure how optimized that would be, if it works at all. Or better yet, if this is an actual spell you've created, can add it to its own conditions. Link to comment Share on other sites More sharing options...
gob2 Posted November 29, 2016 Author Share Posted November 29, 2016 <snip>...and I guess you can assign spell scripts to a template and it will carry over to leveled lists, but not scripts on the template.That's why I said what I said 7 or so posts back. ;-) I'm not being helpful... Attempt to make this post helpful instead of snarky:Could attach that script to each individual" LVL" actor you want to have the script. Maybe could create a quest that starts game enabled, has a quest alias refcollection with a condition that looks for the keyword actortypeghoul (as an example), then applies the script to what it finds...?Not sure how optimized that would be, if it works at all. Or better yet, if this is an actual spell you've created, can add it to its own conditions. Sorry. I thought you were talking about applying an actor script directly to a lchar-reference template, rather than a spell or quest alias workaround. I'm pretty new at this. As it happens I attached an ondying script to a magic effect to an ability that can be added to actors. That script then fires off a spell and so far it works. Link to comment Share on other sites More sharing options...
Recommended Posts