Difference between revisions of "Talk:Portal:Scripting"
→Script Question
imported>DragoonWraith |
imported>DragoonWraith |
||
Line 82: | Line 82: | ||
:Also, indenting is always a good idea. Anyway, to give you a very ''general'' answer to this, my approach would be to use an invisible, persistent activator to cast a silent, invisible scripted spell when he dies, and to continue to do so every few seconds until everything hit by the spell returns false on a [[GetCombatTarget|<tt>GetCombatTarget == player</tt>]] check (i.e. there are no actors in range that are considered to be in combat with the player). Once that happens, you can freely resurrect the guy. If you need more ''specific'' instruction than that, I suggest that you start a thread on the {{Forums}} - while we're happy to help here with general scripting questions, walking you through an entire script would be a little much for this page. Feel free to link to any thread you start, though, and I'll take a look at it. I think this is a really cool idea and I don't think I've heard of any companion with this feature. | :Also, indenting is always a good idea. Anyway, to give you a very ''general'' answer to this, my approach would be to use an invisible, persistent activator to cast a silent, invisible scripted spell when he dies, and to continue to do so every few seconds until everything hit by the spell returns false on a [[GetCombatTarget|<tt>GetCombatTarget == player</tt>]] check (i.e. there are no actors in range that are considered to be in combat with the player). Once that happens, you can freely resurrect the guy. If you need more ''specific'' instruction than that, I suggest that you start a thread on the {{Forums}} - while we're happy to help here with general scripting questions, walking you through an entire script would be a little much for this page. Feel free to link to any thread you start, though, and I'll take a look at it. I think this is a really cool idea and I don't think I've heard of any companion with this feature. | ||
:Oh, also, you don't need to use <tt>Necromancer.Resurrect</tt> (and in any case I'd recommend a more unique EditorID, but that's probably just my history modding ''Morrowind'' talking) - assuming this script is attached to the Necromancer (which it must be for <tt>[[OnDeath]]</tt> to work correctly), you can just use <tt> | :Oh, also, you don't need to use <tt>Necromancer.Resurrect</tt> (and in any case I'd recommend a more unique EditorID, but that's probably just my history modding ''Morrowind'' talking) - assuming this script is attached to the Necromancer (which it must be for <tt>[[OnDeath]]</tt> to work correctly), you can just use [[Resurrect|<tt>Resurrect 1</tt>]] (you need the 1 to have him play the animation of sitting up; not doing so causes a crash IIRC), without the <tt>Necromancer.</tt> part. This is because functions always assume the reference they're attached to if none is given. | ||
:[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 00:17, 5 August 2010 (EDT) | :[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 00:17, 5 August 2010 (EDT) |