Jump to content

Is there a way to assign an area of damage to an object?


Laerithryn

Recommended Posts

I have an object in creation kit that I want to assign an area of damage to. To be clear, I want either the object itself or the area it resides in give damage to the player character. Anyone know how to achieve this?

Link to comment
Share on other sites

If it's a static object, you can just add a trigger box or even a primitive (collision cube or collision sphere), add a script to it such as BWClightDamageScript, set your properties, size the box and if the player enters it their health will start dropping. A collision sphere would be nice for this. Centre the box/primitive at the same place as your object in CK.

 

I don't know how to assign proximity damage to an object without using the method I've stated, but it's dead simple to do it this way in CK and it's how Beth did all the light and lave damage.

 

If it's an interactible object (activator), it will need a script. I.e. if it damages the player until they reach it and 'turn it off'.

 

That's pretty simple too. Just do what I said before and add a script to the activator to disable the collision object that's doing the damage.

 

Hope that helps.

Link to comment
Share on other sites

If it's a static object, you can just add a trigger box or even a primitive (collision cube or collision sphere), add a script to it such as BWClightDamageScript, set your properties, size the box and if the player enters it their health will start dropping. A collision sphere would be nice for this. Centre the box/primitive at the same place as your object in CK.

 

I don't know how to assign proximity damage to an object without using the method I've stated, but it's dead simple to do it this way in CK and it's how Beth did all the light and lave damage.

 

If it's an interactible object (activator), it will need a script. I.e. if it damages the player until they reach it and 'turn it off'.

 

That's pretty simple too. Just do what I said before and add a script to the activator to disable the collision object that's doing the damage.

 

Hope that helps.

 

Greatly appreciate the response, and I'll have to give that a try. At the moment my object is a simple one you can pickup and place in your inventory and drop as any normal object. But I would like for it to have the player take damage the closer they get. As you mentioned above, proximity damage. Eventually, when the player actually closes the gap of distance (by having the right key or item in their inventory) to reach the object, I would like to make the object destructible in order to destroy it. For now I'll have to try your suggestions, thanks again!

Link to comment
Share on other sites

No probs.

 

The area I was thinking of is in the Thieves' Guild quests at the temple (to get the skeleton key). If you look at it, all Beth did was to place 2 collision cubes inside each other. The first does less damage, the smaller inside cube does more damage. That's why health drops slowly for a time and then the drop suddenly increases... the player has entered the inside collision cube.

 

Not Ideal, I know.

 

 

If you are like me you want the health drop to progressively increase with each step the player makes... I'm afraid I don't know how to do that.

 

Anyway, hope it's going OK for you.

Link to comment
Share on other sites

No probs.

 

The area I was thinking of is in the Thieves' Guild quests at the temple (to get the skeleton key). If you look at it, all Beth did was to place 2 collision cubes inside each other. The first does less damage, the smaller inside cube does more damage. That's why health drops slowly for a time and then the drop suddenly increases... the player has entered the inside collision cube.

 

Not Ideal, I know.

 

 

If you are like me you want the health drop to progressively increase with each step the player makes... I'm afraid I don't know how to do that.

 

Anyway, hope it's going OK for you.

 

Ok again, very much appreciated. I'll have to settle for the collision cubes in your suggestion. As you stated, not ideal, but will work in a pinch which is where I'm at currently. Just want to get it all done so I can upload the mod finally and take a break from it. I'm at the point where I'm starting not to care as this has been a huge learning curve for me.

Link to comment
Share on other sites

If this helps I wrote a script that causes damage when player enters a trigger box. The damage takes into account the player's level and stamina damage is an optional bool property. For what you asked about - having increased level of damage when player nears an object, then place a series of trigger boxes with increasing damage values.

 

Actor Property PlayerREF Auto
Float Property HDamValLvl1_10 Auto
Float Property HDamValLvl11_29 Auto
Float Property HDamValLvl30_49 Auto
Float Property HDamValLvl50plus Auto
Float Property SDamageValue Auto

Bool Property DoesDamageStamina = False Auto

EVENT onTrigger(ObjectReference akActionRef)
if akActionRef == PlayerRef
If PlayerRef.GetLevel() <= 10
PlayerREF.DamageActorValue("Health", HDamValLvl1_10)
EndIf

If PlayerRef.GetLevel() > 10 && PlayerRef.GetLevel() < 30
PlayerREF.DamageActorValue("Health", HDamValLvl11_29)
EndIf

If PlayerRef.GetLevel() >= 30 && PlayerRef.GetLevel() <= 49
PlayerREF.DamageActorValue("Health", HDamValLvl30_49)
EndIf


If PlayerRef.GetLevel() >= 50
PlayerREF.DamageActorValue("Health", HDamValLvl50plus)
EndIf

If DoesDamageStamina == True
StaminaDamage()
EndIf

endif
ENDEVENT

Function StaminaDamage()
;debug.notification("Stamina Damage Function")
PlayerREF.DamageActorValue("Stamina", SDamageValue)
EndFunction

 

Link to comment
Share on other sites

If this helps I wrote a script that causes damage when player enters a trigger box. The damage takes into account the player's level and stamina damage is an optional bool property. For what you asked about - having increased level of damage when player nears an object, then place a series of trigger boxes with increasing damage values.

 

Actor Property PlayerREF Auto

Float Property HDamValLvl1_10 Auto

Float Property HDamValLvl11_29 Auto

Float Property HDamValLvl30_49 Auto

Float Property HDamValLvl50plus Auto

Float Property SDamageValue Auto

 

Bool Property DoesDamageStamina = False Auto

 

EVENT onTrigger(ObjectReference akActionRef)

if akActionRef == PlayerRef

If PlayerRef.GetLevel() <= 10

PlayerREF.DamageActorValue("Health", HDamValLvl1_10)

EndIf

 

If PlayerRef.GetLevel() > 10 && PlayerRef.GetLevel() < 30

PlayerREF.DamageActorValue("Health", HDamValLvl11_29)

EndIf

 

If PlayerRef.GetLevel() >= 30 && PlayerRef.GetLevel() <= 49

PlayerREF.DamageActorValue("Health", HDamValLvl30_49)

EndIf

 

 

If PlayerRef.GetLevel() >= 50

PlayerREF.DamageActorValue("Health", HDamValLvl50plus)

EndIf

 

If DoesDamageStamina == True

StaminaDamage()

EndIf

 

endif

ENDEVENT

 

Function StaminaDamage()

;debug.notification("Stamina Damage Function")

PlayerREF.DamageActorValue("Stamina", SDamageValue)

EndFunction

 

 

Truly awesome of you Antstubell. Very much appreciated! Now to figure out how to implement your script.

Link to comment
Share on other sites

If this helps I wrote a script that causes damage when player enters a trigger box. The damage takes into account the player's level and stamina damage is an optional bool property. For what you asked about - having increased level of damage when player nears an object, then place a series of trigger boxes with increasing damage values.

 

Actor Property PlayerREF Auto

Float Property HDamValLvl1_10 Auto

Float Property HDamValLvl11_29 Auto

Float Property HDamValLvl30_49 Auto

Float Property HDamValLvl50plus Auto

Float Property SDamageValue Auto

 

Bool Property DoesDamageStamina = False Auto

 

EVENT onTrigger(ObjectReference akActionRef)

if akActionRef == PlayerRef

If PlayerRef.GetLevel() <= 10

PlayerREF.DamageActorValue("Health", HDamValLvl1_10)

EndIf

 

If PlayerRef.GetLevel() > 10 && PlayerRef.GetLevel() < 30

PlayerREF.DamageActorValue("Health", HDamValLvl11_29)

EndIf

 

If PlayerRef.GetLevel() >= 30 && PlayerRef.GetLevel() <= 49

PlayerREF.DamageActorValue("Health", HDamValLvl30_49)

EndIf

 

 

If PlayerRef.GetLevel() >= 50

PlayerREF.DamageActorValue("Health", HDamValLvl50plus)

EndIf

 

If DoesDamageStamina == True

StaminaDamage()

EndIf

 

endif

ENDEVENT

 

Function StaminaDamage()

;debug.notification("Stamina Damage Function")

PlayerREF.DamageActorValue("Stamina", SDamageValue)

EndFunction

 

 

Ok... I tried to input your script Antstubell on a trigger box, unfortunately it CTD every time I try it. Any ideas?

Link to comment
Share on other sites

I cant figure it out Antstubell, so in the mean time I fall back on Cumbrianlad's suggestion of simply using the BWClightDamageScript which works fine. Again, thank you for your effort and time just the same.

 

Now I just need to figure out how to make my object destructible. Then figure out how to replace the nif it uses for appearance with an alternate one showing the deactivated or destroyed state once it is destroyed.

 

Is it possible to give an object health points like a character? I wonder if an actor can use an object for its image or appearance, that would solve that issue?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...