gangsterlax Posted April 4, 2011 Share Posted April 4, 2011 I need a script effect for an npc, that makes it cast a wide area fire damage spell after a 5 second countdown,kills it,then removes the corpse. Strange request I know but is it possible? The only timed explosion effect I've seen is in Frantic's 'Black Powder Bombs' Link to comment Share on other sites More sharing options...
fg109 Posted April 5, 2011 Share Posted April 5, 2011 (edited) I'm not exactly sure what you mean... Do you want a script for the NPC, or a script for the spell? I'm not sure how to do it with only a spell script, since spell scripts stop running once the target is dead, so I don't see how to use it to disable the body (to remove the body). Since you say you want to make the NPC cast the spell, what do you want to trigger the spell cast? As in, how do you want to make it start casting the spell? Through dialogue, a spell, getting within a certain distance, etc? If you want to have a spell that, when you cast it on an NPC, causes the NPC to start a countdown then explode, here's a way to do it. You'll need to make a custom spell (I'll just call it AoEFireSpell) that covers a large area and does a lot of damage. You'll have to make an activator and put in somewhere on the map, make it a persistent reference, and name it (I'll just call it activator). Then you'll need to make a second spell, this one should have a 5 second duration, and should have a script effect. Script for second spell: scn spellscript ref self short stimer float ftimer Begin ScriptEffectStart set self to GetSelf activator.MoveTo self set ftimer to 5 set stimer to 5 End Begin ScriptEffectUpdate set ftimer to (ftimer - GetSecondsPassed) if (ftimer < stimer) && (stimer != 0) Message "%.0f..." stimer set stimer to (stimer - 1) endif End Begin ScriptEffectFinish Message "0!" activator.Cast AoEFireSpell self set activator.target to self activator.Activate Player, 1 self.Kill End Script for activator: scn activatorscript ref target short initialize float timer Begin OnActivate set initialize to 1 End Begin GameMode if initialize == 0 Return endif set timer to timer + (GetSecondsPassed) if timer >= 3 set timer to 0 set initialize to 0 target.Disable endif End Edited April 5, 2011 by fg109 Link to comment Share on other sites More sharing options...
gangsterlax Posted April 5, 2011 Author Share Posted April 5, 2011 ty for the reply This would be a script exclusive for an npc , not a spell. The player will cast a spell, summoning the npc and simultaneously causing a 5 second countdown to start. (so the script will start once the player summons the npc) After 5 seconds are up, the script will make the npc cast an explosion spell, the script will then kill the npc, and remove the corpse. hopefully that resolves some confusion. ----------------------------------- Heres how the 'heat seeking part works' I have a scripted summon spell which conjures 5 bats these bats have 100 aggression, 0 responsibility, 100 speed (so that they can locate other npc's from far away) and are evil. These bats will be added to a custom faction so that they do not attack one another. When summoned into the game, the bats attack anything living except for the player, and cause npc's to attack them without warning. If there is nothing around to fight, the bats will hover around the player (so one must be careful with this spell or the bats will explode on their master) Link to comment Share on other sites More sharing options...
fg109 Posted April 5, 2011 Share Posted April 5, 2011 (edited) OK, so you want to script these summoned bats to explode 5 seconds after being summoned. I think the countdown should be handled by your summon spell, because otherwise you would have 5 different scripts trying to display messages at the same time. Here's what I would use for the script: scriptname batscript ref self short control_var float timer Begin GameMode if (GetDisabled) Return endif if (GetDistance Player < 500) && (control_var == 0) set control_var to 1 endif if (control_var == 1) set timer to (timer + GetSecondsPassed) if (timer >= 8) self.Disable set control_var to 0 set timer to 0 Return elseif (timer >= 5) && (GetDead == 0) set self to GetSelf Cast AoEFireSpell self self.Kill Return endif endif End This assumes that when you summon them, they start out fairly close to you. You'll still need to make a custom "AoEFireSpell". Edited April 5, 2011 by fg109 Link to comment Share on other sites More sharing options...
gangsterlax Posted April 5, 2011 Author Share Posted April 5, 2011 awesome thank you Link to comment Share on other sites More sharing options...
gangsterlax Posted April 5, 2011 Author Share Posted April 5, 2011 oops looks like their may be a problem, the script skips to straight to killing the bats without exploding. I'm not certain, but perhaps i put the script in the wrong spot? I've tried: -In the creatures script slot -as separate script effect within the summon spell -as an ability The bat summon is a script as well, the one thing i haven't tried yet is combining the explode script within the bat summon script Link to comment Share on other sites More sharing options...
fg109 Posted April 5, 2011 Share Posted April 5, 2011 (edited) Sorry, I forgot that there's a delay between telling something to cast a spell, and actually having them cast it. Change the bottom of the script to this: if (control_var == 1) set timer to (timer + GetSecondsPassed) if (timer >= 5) set self to GetSelf set control_var to 2 Cast AoEFireSpell self Return endif elseif (control_var == 2) set timer to (timer + GetSecondsPassed) if (timer >= 8) self.Disable set control_var to 0 set timer to 0 Return elseif (timer >= 6) && (GetDead == 0) self.kill endif endif Edited April 5, 2011 by fg109 Link to comment Share on other sites More sharing options...
Nealus Posted April 11, 2011 Share Posted April 11, 2011 (edited) Interesting idea, but that will fit for mecha-style bats or dwemwer spiders more, IMOAlso, there was exploding mudcrab with bomb in Midas Magic. As I can remember, it explode when someone kills it.Maybe it's better to trigger explosions when bat attack somebody, not after 5 secs? Edited April 11, 2011 by Nealus Link to comment Share on other sites More sharing options...
Recommended Posts