Making fireplaces dangerous

Post » Tue Jun 19, 2012 9:56 pm

Hi.

Something that has always annoyed me is that the player can stand in a fireplace without taking any damage. I want to fix that with a script.
At first I thought I would use a modification of the Wall of Flames spell, but I have no idea how to link the spell to the fireplace or to my script..

The only "real progress" I have made is to find this:
http://www.creationkit.com/OnUpdate_-_Form
It seems to suit my need for a periodic event. -Now I just need it to constantly deal damage to everyone within a certain area, or withint a certain range of the object that the script is attached to.


I was thinking of another way to do this; would be to add some sort of "area marker" directly in the editor, kinda like the acoustic spaces.

Help appriciated.
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Tue Jun 19, 2012 3:23 pm

This is the script the blacksmith forges use.

scriptName  BlacksmithForge01 extends ObjectReferenceimport Debugspell property FlameDamage AutoEVENT onActivate ( objectReference triggerRef )	playAnimation("activate")endEventEvent OnTriggerEnter ( objectReference triggerRef )	if (triggerRef == Game.GetPlayer())		FlameDamage.Cast(triggerRef, triggerRef)	endIfendEvent
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Tue Jun 19, 2012 8:34 pm

I didn't know blacksmith forges dealt damage to the player if standing in it?

According to this:
http://www.creationkit.com/OnTriggerEnter_-_ObjectReference

"Event called when the object reference is a trigger volume and has been entered."
1. It seems like it only runs once, when they player enters the "trigger volume". Am I right?
2. What's a "trigger volume"?
3. How much damage does it do to the player?
4. If I want NPCs to take damage as well, do I just remove the "if -statement" in the OnTriggerEnter-Event?

EDIT: If I am right about question 1; I would like to: When the player enters the "trigger volume", start another event that updates periodically and deals damage to the player each time that event runs. And finally turn the second event off, when "OnTriggerLeave" in the first script.

EDIT #2: I found out what trigger volume is.
I also managed to make the area (trigger volume) that reacts when my player enters the region. -Now I just need to add the damage that the player recieves. I am guessing that I do this by somehow editting the value of the FlameDamage -property. Not sure how, yet.
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Tue Jun 19, 2012 9:47 pm

I didn't know blacksmith forges dealt damage to the player if standing in it?
They do when you first jump into one. They aren't continuous.

When you figure this out, any chance of adding damage to the steam geysers as well?
User avatar
Olga Xx
 
Posts: 3437
Joined: Tue Jul 11, 2006 8:31 pm

Post » Tue Jun 19, 2012 9:46 am

They do when you first jump into one. They aren't continuous.

When you figure this out, any chance of adding damage to the steam geysers as well?

I guess the damage were so small I never noticed it. I've been standing in tons of fires and whatnot while playing Skyrim, and never noticed a thing.

I believe it would be possible to add damage to anything if I get this working.

I managed to add a firecloak effect to the player when I stepped into the fire. Funny thing was all the enemies around me was burning while I was unharmed, standing in the fire. =)

EDIT: I have no managed to put the burning effects on my character when I step into the flames. It looks pretty cool. Still no damage is being dealt to my character, though. =(
User avatar
josh evans
 
Posts: 3471
Joined: Mon Jun 04, 2007 1:37 am

Post » Tue Jun 19, 2012 8:15 am

EDIT #3:
Here's what my script looks like now:


Scriptname BM_DangerousFire extends ObjectReference{A script that will make actors take damage when standing in flames, such as from fireplaces.}Spell Property BM_FlameDamage  AutoActor BM_TriggeringActorBool BM_KeepBurning = falseEvent OnTriggerEnter (objectReference triggerRef)	triggerRef = BM_TriggeringActor	BM_KeepBurning = true	RegisterForSingleUpdate(1)endEventEvent OnUpdate()	BM_FlameDamage.Cast(BM_TriggeringActor, BM_TriggeringActor)	if BM_KeepBurning		RegisterForSingleUpdate(1)	endIfendEventEvent OnTriggerLeave (objectReference triggerRef)	BM_KeepBurning = falseendEvent



I tested it by adding Debug.Notification() to each event, and they all work as intended. The problem is that my character isn't burning.
I believe it has to do with the information stored in the "BM_TriggeringActor -variable". I believe that that variable is somehow empty, I am guessing I'm not properly assigning the information to it in "OnTriggerEnter()".
I am also thinking that "Actor" might be the wrong type of variable. Would "Object Reference" work better?

I use "triggerRef" in "OnTriggerEnter()", but I saw on the wiki that they use "akActionRef" will switching these make a difference? (I don't know what either of those mean, to be honest.)
Source:
http://www.creationkit.com/OnTriggerEnter_-_ObjectReference

Help appriciated.
User avatar
TIhIsmc L Griot
 
Posts: 3405
Joined: Fri Aug 03, 2007 6:59 pm

Post » Tue Jun 19, 2012 6:56 pm

*bump*
User avatar
Matt Bigelow
 
Posts: 3350
Joined: Sun Sep 30, 2007 6:36 pm

Post » Tue Jun 19, 2012 3:42 pm

Ok some explanation of the Blacksmithforge script:

What it does is "cast" the spell that is referenced by the FlameDamage property on the player when he enters the trigger.

As you already found out how to create your own trigger and how to attach the script to it all you need to do now is create your own spell that puts a lasting flame damage effect on the player.

Alternately you can try using the OnTrigger() event instead of the OnTriggerEnter() event. OnTrigger() is triggered repeatedly aslong as a reference is inside the volume.

Actually the second alternative seems the better fitting one after rethinking.
User avatar
laila hassan
 
Posts: 3476
Joined: Mon Oct 09, 2006 2:53 pm

Post » Tue Jun 19, 2012 1:28 pm

Wow. Had I known that OnTrigger() runs constantly I would've saved a lot of time and trouble.
Thanks a lot for the help. The script now works as I want it to: Burning the actor for as long as he stays in the fire.
If anyone wants to know how this is done I'd be happy to help.

Is there a way to automatically attach a trigger volume and a script like this to all fireplaces in the cell, using a script? (So that I don't have to go through the entire Skyrim in search for fireplaces to manually attach this to.)


EDIT: Here's what it looks like:
http://www.youtube.com/watch?v=yboob5b_Lq4
User avatar
Rodney C
 
Posts: 3520
Joined: Sat Aug 18, 2007 12:54 am

Post » Tue Jun 19, 2012 5:42 pm

Whilst you appear to have found an alternative answer, I'll just point out that the the original script you posted above probably would have worked if not for this line ...

triggerRef = BM_TriggeringActor

triggerRef is the passed in reference. I think you meant to do this ...

BM_TriggeringActor = triggerRef as Actor

Also note the following from the wiki regarding OnTrigger ...

This event is sent repeatedly, so care should be taken not to tie up the script system unnecessarily with a long complicated handler. Try using the trigger enter and leave events instead.

In other words, although your script is likely not long and complicated, your original script might be the optimum solution, and only failed because you didn't adequately benchtest your script.

Edit: Correct my own mistake.
User avatar
rheanna bruining
 
Posts: 3415
Joined: Fri Dec 22, 2006 11:00 am

Post » Tue Jun 19, 2012 10:19 pm

triggerRef is the passed in reference. I think you meant to do this ...

BM_TriggeringActor = triggerRef as Actor

So all I was missing was the "as Actor" part for it to work?
I will modify and test my original script and see what happens.


EDIT: I tested it and it seems to work now. Thanks for your help.

Here's my final script:

Scriptname BM_DangerousFire extends ObjectReference{A script that will make actors take damage when standing in flames, such as from fireplaces.}Spell Property BM_FlameDamage  AutoActor BM_TriggeringActorBool BM_KeepBurning = falseEvent OnTriggerEnter (objectReference triggerRef)   BM_TriggeringActor = triggerRef as Actor   BM_KeepBurning = true   RegisterForSingleUpdate(1)endEventEvent OnUpdate()   BM_FlameDamage.Cast(BM_TriggeringActor, BM_TriggeringActor)   if BM_KeepBurning      RegisterForSingleUpdate(1)   endIfendEventEvent OnTriggerLeave (objectReference triggerRef)   BM_KeepBurning = falseendEvent

I guess this is as good as it gets.
Thanks for all the help. =)
User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Tue Jun 19, 2012 8:20 pm

i′m wondering how i can get this working ingame (attaching script to object ?), absolut script newbie, any help is greatly appreciated :thanks:

Backgound: I`m working on a new Worldspace, actually i′m building a lavafield, so objects are needed which cast damage to the player .. (maybe someone has an other advice or tip how to achive this)


Edit: solved, i just use the Hazard Boxes for fires
User avatar
bonita mathews
 
Posts: 3405
Joined: Sun Aug 06, 2006 5:04 am

Post » Tue Jun 19, 2012 3:04 pm

alternatively, on your TriggerLeave block you can call a UnregisterForUpdate to break the loop instead of the need for a control variable (i'm personally allergic to control variables and avoid them whenever possible, because i find them sometimes unreliable)
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am


Return to V - Skyrim