Aller au contenu

Photo

Script to Fireball OnUserDefined


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
FaerzressSparkles

FaerzressSparkles
  • Members
  • 219 messages

For one of my areas, I have these triggers laid out where a player can cause a fireball to explode in that area under certain conditions.

 

If a creature carries a torch, casts a flame-based spell, or otherwise brings fire into this area, I want it to explode.

My question is, what is the best way to go about this? I was thinking there must be built in scripts that can be made to make this idea work via "OnUserDefined," but if not, I guess I will work on writing another script for this sometime.

 

Any input will be appreciated!



#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages

I doubt my input will be much help, but here are my thoughts.

 

Since it is a special portion of an area my first thought is to put a trigger around the perimeter that sets a variable upon entry and resets it upon exit. It would also initiate a heartbeat style script that checks to see if anyone in the party is holding a torch as long as the party is within the trigger (check the variable set by the trigger). You could alternatively create an on equip script for the torch that checks if the equipper is in the trigger (check the variable set by the trigger) and respond accordingly, but that script wouldn't catch someone entering the trigger who is already holding a torch, so unless you want your trigger script to do that check also I think the heartbeat script is a better way to go.

 

I don't have any ideas about how to tell if someone is casting a flame based spell though. Read up on the spell hooks I guess. I haven't done any of that myself.

 

Regards



#3
Loki_999

Loki_999
  • Members
  • 430 messages

Trigger with on-enter event or heartbeat would work for the torch.  Not sure about the casting of the spell though without editing the actual spell to check to see if in one of those special areas.

 

You could add a variable to the PC on-enter and remove it on-exit.  Then have the fire based spell check for that variable.  Crap solution though.  

 

No idea how you could code it otherwise.



#4
kevL

kevL
  • Members
  • 4 070 messages

a fella could set up a persistent AoE (DJ's fave method, i believe - very reliable)

say, an invisible VFX_PERSISTENT.2da entry, that supports onEnter, onExit, and onHB scripts. Apply it to an iPoint at the gas leakage and kaBOOM.



#5
FaerzressSparkles

FaerzressSparkles
  • Members
  • 219 messages

Thanks for the input guys! You all have good suggestions on how to do this, I will think about each one and go from there.

 

Right now I have a script that checks for the torch and if it is "true", a fireball is cast on that creature. Of course, this does nothing for the spells. Anyway, thanks again for the suggestions!



#6
kevL

kevL
  • Members
  • 4 070 messages

btw, to check for fire-based spells: I think you'd have to use a spellhook, and write a subfunction for it that detects spell casts and targets that you'd want specifically as triggers,

 

it's all complicated and a project-in-itself, but ultimately it is doable  :)



#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

There is a column in spells.2DA called 'ImmunityType'. It would be safe to assume that any spell that has a value of 'Fire' in that column does fire damage. You could use spellhooking in a particular area to extract the 'ImmunityType' value from the 2DA for each spell ID, then react accordingly when a value of 'Fire' is returned.

 

What about electrical damage? Any electrical discharge large enough to do damage to an enemy could also ignite something.