Aller au contenu

Photo

[SOLVED] Script Help - Walking into fire does damage


1 réponse à ce sujet

#1
DaSkee

DaSkee
  • Members
  • 19 messages
I have some fire in the level in the mod that I'm working on and I would like to make it so that walking into the fire causes damage and a fire effect.

I'm guessing I should set up a trigger around the fire and then put a script on that trigger. However, I can't figure out for the life of me how to do this script. I've been trying to add the "EffectDamage" effect to a triggered event, but its not working. Can anyone help with this?

Modifié par DaSkee, 17 mars 2010 - 02:02 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
command wait doesn't do what you think it does. Commands are actions you assign to creatures using AddCommand. By looping, you're applying the damage to the creature over and over again. Scripts always executre instantly and fully, there is no way to delay the actions within them, other than using a delayed event which I'll go into later. Also, even if command wait did effect the script, checking nCheck like that within the loop would be pointless becuase you're not updating it's value each cycle.

If you want to do damage over time, there's two ways. One is to apply a damage over time effect to the creature. This is quite easy to do, but will keep doing damage even if the creature leaves the trigger. You could use the exit event of the trigger to remove all damage over time effects on the creature that were created by the trigger. The damage over time event would eventualy expire though, even if the creature didn't leave the trigger, but you could give it a very long life.

The other way would be to use a delayed event which calls itself, creating a heartbeat. In the spawn event, do something like this (I'm going from memory, the paramater order or naming might be off):

DelayEvent(1.0, OBJECT_SELF, Event(EVENT_TYPE_CUSTOM_EVENT_1));

Then create an case for that event type, and in it call that same line of code. Grab all the creatures within a certain radius, check if they are in the trigger, and apply the damage. If you only care about party members, then loop through those instead. The only drawback to this method would be if you have a lot of these triggers in an area, it might start to cause slowdown.

If you've got access to the main campaign (single player) resources, there's a trigger in the night version of redcliffe that you could look at as an example. I think it's named arl101tr_fire_trap or something similar.

Modifié par DavidSims, 07 mars 2010 - 06:43 .