My program doesn't have bugs. It just develops random features.

Difference between revisions of "User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (-)
(First revision of page, Checked for correctness.)
 
Line 1: Line 1:
==UltimateDestroyableEnvironment==
+
=UltimateDestroyableEnvironment=
 
by Crusha K. Rool
 
by Crusha K. Rool
 
{{infobox class
 
{{infobox class
| class   = UltimateDestroyableEnvironment
+
| class = UltimateDestroyableEnvironment
 +
| game = UT2004
 +
| engine = UE2
 +
| package = UltimateMappingTools
 
| parent1 = Decoration
 
| parent1 = Decoration
 
| parent2 = Actor
 
| parent2 = Actor
 
| parent3 = Object
 
| parent3 = Object
| game    = UT2004
+
| custom = yes
| engine  = UE2
+
| custom = yes
+
 
}}
 
}}
  
A StaticMesh that can change it's appearance when taking a certain amount of damage. Additionally it can play sounds, spawn KActors and use Emitter effects when it reaches the next ''Level of Destruction''.
+
Allows to set up an actor that gets more and more destroyed when it takes
 +
damage. That is done by having multiple versions of the StaticMesh that are
 +
differently high damaged.
  
 +
==Properties==
 +
===Property group 'Events'===
 +
====ResetEvent====
 +
'''Type:''' [[name]]
  
 +
Triggered if bReset is True, so that you can potentially do some updates on other things as well when resetting this actor.
  
===Property group 'UltimateDestructibleEnvironment'===
+
====WrongDamageTypeEvent====
====LevelOfDestruction====
+
'''Type:''' [[name]]
'''Type:''' [[array]]<[[User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment#Struct_.27_LevelOfDestruction.27|_LevelOfDestruction]]>
+
  
Define the different Levels of Destruction and the effects that are associated with them. See the struct below for more informations.
+
Triggered when an invalid DamageType damaged this actor.
  
====TotalHealth====
+
===Property group 'UltimateDestroyableEnvironment'===
'''Type:''' [[int]]
+
====bBlackList====
 +
'''Type:''' [[bool]]
  
'''Default value:''' 2000
+
If true, the DamageTypes in the array can NOT damage this actor.
  
The initial health of this actor.
+
'''Default value:''' True
 +
 
 +
====bReset====
 +
'''Type:''' [[bool]]
 +
 
 +
Reset this actor after the round ended or keep destruction the whole match?
 +
 
 +
====bResetEventOnlyWhenFinalDestruction====
 +
'''Type:''' [[bool]]
 +
 
 +
If True, only fire off the ResetEvent if an LOD with bFinalDestruction has been reached in this round.
  
 
====DamageTypes====
 
====DamageTypes====
'''Type:''' [[array]]<[[UE2:DamageType (UT2004)|DamageType]]>
+
'''Type:''' [[array]]<[[class]]<[[UE2:DamageType (UT2004)|DamageType]]> >
  
 
Which DamageTypes can affect this actor?
 
Which DamageTypes can affect this actor?
  
====bBlackList====
+
====LevelOfDestruction====
'''Type:''' [[bool]]
+
'''Type:''' [[array]]<{{tl|_LevelOfDestruction}}>
  
'''Default value:''' True
+
Determines the appearance of the Actor at different health levels.
  
If true, the DamageTypes in the array can NOT damage this actor.
+
====TotalHealth====
 +
'''Type:''' [[int]]
  
====VelocityDamageTreshold====
+
The initial health of this actor.
'''Type:''' [[float]]
+
  
'''Default value:''' 1000
+
'''Default value:''' 2000
  
How fast another actor that touches this one can be without causing damage. -1 to turn off.
+
====WrongDamageEventTreshold====
 +
'''Type:''' [[int]]
  
====VelocityDamageScale====
+
Trigger an event every time this much damage has been caused by a "wrong" DamageType.
'''Type:''' [[float]]
+
  
'''Default value:''' 0.03
+
'''Default value:''' 300
  
How much damage is taken in relation to the actual velocity?
+
===Internal variables===
 +
====AccumulatedWrongDamage====
 +
'''Type:''' [[int]]
  
====bReset====
+
This much of the wrong damage has been accumulated already.
 +
 
 +
====bFinalDestructionReached====
 
'''Type:''' [[bool]]
 
'''Type:''' [[bool]]
  
Reset this actor after the round ended or keep destruction the whole match?
+
Used by bResetEventOnlyWhenFinalDestruction.
  
 +
====CurrentLOD====
 +
'''Type:''' [[int]]
  
 +
This tells players who join the match in progress how the Actor currently looks like.
  
===Struct '_LevelOfDestruction'===
+
'''Default value:''' -1
====DestroyedStaticMesh====
+
'''Type:''' [[UE2:StaticMesh (UT2004)|StaticMesh]]
+
  
The new StaticMesh that is used at this LOD.
+
====i_temp====
 +
'''Type:''' [[int]]
  
====HealthLimit====
+
Counter.
 +
 
 +
====j_temp====
 
'''Type:''' [[int]]
 
'''Type:''' [[int]]
  
This LOD becomes active if the actors health drops below this.
+
Remember the current array for use in GainedChild.
  
 +
====OldLOD====
 +
'''Type:''' [[int]]
  
====StaticMeshScale====
+
Only change appearance if we receive a LOD value that is not the same as the old one.
'''Type:''' [[float]]
+
  
Scale the new StaticMesh by this value.
+
'''Default value:''' -1
  
====StaticMeshOffset====
+
====OriginalLocation====
'''Type:''' [[vector]]
+
'''Type:''' [[UE2:Object structs (UT2004)#Vector|Object.Vector]]
  
New location of the StaticMesh in relation to the original location.
+
Remember for calculating offset from default in each LOD.
  
====StaticMeshRotation====
+
====OriginalRotation====
'''Type:''' [[rotator]]
+
'''Type:''' [[UE2:Object structs (UT2004)#Rotator|Object.Rotator]]
  
New rotation of the StaticMesh in relation to the original rotation.
+
Remember for calculating rotation offset from default in each LOD.
  
====TriggerEvent====
+
====OriginalScale====
'''Type:''' [[name]]
+
'''Type:''' [[UE2:Object structs (UT2004)#Vector|Object.Vector]]
  
Trigger this Event once this LOD has been reached.
+
Just remember this too.
  
====bFinalDestruction====
+
====OriginalStaticMesh====
'''Type:''' [[bool]]
+
'''Type:''' {{cl|StaticMesh}}
  
Set this to True if you consider this the last stadium of the mesh in which it should disappear completely.
+
Remember for reset.
It still has the possibility to respawn in the next round.
+
  
====KarmaDeco====
+
====OriginalStyle====
'''Type:''' [[array]]<[[User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment#Struct_.27_DecoKActor.27|_DecoKActor]]>
+
'''Type:''' [[UE2:Actor enums (UT2004)#ERenderStyle|Actor.ERenderStyle]]
  
KActors to spawn at the destruction.
+
Don't ask.
  
====EmitterEffects====
+
===Default values===
'''Type:''' [[array]]<[[User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment#Struct_.27_Effects.27|_Effects]]>
+
{| class="list defaults"
 +
! Property
 +
! Value
 +
|-
 +
| [[UE2:Actor internal variables (UT2004)#bAlwaysRelevant|bAlwaysRelevant]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bBlockActors|bBlockActors]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bBlockKarma|bBlockKarma]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bCollideActors|bCollideActors]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bEdShouldSnap|bEdShouldSnap]]
 +
| True
 +
|-
 +
| [[UE2:Actor internal variables (UT2004)#bNetNotify|bNetNotify]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bNoDelete|bNoDelete]]
 +
| True
 +
|-
 +
| [[UE2:Actor internal variables (UT2004)#bStatic|bStatic]]
 +
| False
 +
|-
 +
| [[UE2:Actor internal variables (UT2004)#bWorldGeometry|bWorldGeometry]]
 +
| True
 +
|-
 +
| [[UE2:Actor properties (UT2004)#DrawType|DrawType]]
 +
| [[UE2:Actor enums (UT2004)#EDrawType|DT_StaticMesh]]
 +
|-
 +
| [[UE2:Actor internal variables (UT2004)#RemoteRole|RemoteRole]]
 +
| [[UE2:Actor enums (UT2004)#ENetRole|ROLE_SimulatedProxy]]
 +
|-
 +
| [[UE2:Actor properties (UT2004)#StaticMesh|StaticMesh]]
 +
| {{cl|StaticMesh}}'Albatross_architecture.Alb_crate1'
 +
|}
  
Emitter effects to play at the destruction.
+
==Structs==
 +
===_DecoKActor===
 +
You can spawn real chunks that are physics calculated when you destroy this Actor step by step.
 +
; {{cl|StaticMesh}} KActorStaticMesh : This StaticMesh will be used by the KarmaThing that is spawned.
 +
; [[float]] KActorMaxNetUpdateInterval : How often is the KActor maximally updated per second for online games. Should be about 0.5
 +
; [[UE2:KarmaParams (UT2004)|KarmaParams]] KActorParameters : Set the parameters for the new Karma object.
 +
; [[UE2:Object structs (UT2004)#Vector|Object.Vector]] SpawnOffset : Where does the KActor spawn in relation to the location of the StaticMesh?
 +
; [[UE2:Object structs (UT2004)#Rotator|Object.Rotator]] RotationOffset : Which rotation does the KActor have in relation to the StaticMesh?
 +
; [[float]] KActorLifeSpan : <!-- enter variable description -->
  
====DestructionSounds====
+
===_LevelOfDestruction===
'''Type:''' [[array]]<[[User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment#Struct_.27_Sounds.27|_Sounds]]>
+
Determines the appearance of the Actor at different health levels.
 +
; {{cl|StaticMesh}} DestroyedStaticMesh : The new StaticMesh that is used at this LOD.
 +
; [[int]] HealthLimit : This LOD becomes active if the actors health drops below this.
 +
; [[UE2:Object structs (UT2004)#Vector|Object.Vector]] StaticMeshScale : Scale the StaticMesh by this value. Values close to 0 are ignored.
 +
; [[UE2:Object structs (UT2004)#Vector|Object.Vector]] StaticMeshOffset : New location of the StaticMesh in relation to the original location.
 +
; [[UE2:Object structs (UT2004)#Rotator|Object.Rotator]] StaticMeshRotation : New rotation of the StaticMesh in relation to the original rotation.
 +
; [[array]]<{{tl|_DecoKActor}}> KarmaDeco : KActors to spawn at the destruction.
 +
; [[name]] TriggerEvent : Trigger this Event once this LOD has been reached.
 +
; [[bool]] bFinalDestruction : <!-- enter variable description -->
 +
; [[bool]] bReached : True if this LOD has been executed already.
  
Sounds to play at the destruction.
+
==Functions==
 +
===Events===
 +
====GainedChild====
 +
{{code|simulated event '''GainedChild''' ([[UE2:Actor (UT2004)|Actor]]&nbsp;'''Other''')}}
  
 +
'''Overrides:''' [[UE2:Actor events (UT2004)#GainedChild|Actor.GainedChild]]
  
===Struct '_DecoKActor'===
+
This is the only place where we can assign our custom KParam as KParam of the spawned KActor before the Karma physics are initilizing.
====KActor====
+
'''Type:''' [[class]]<[[UE2:KActor (UT2004)|KActor]]>
+
  
KActor to spawn.
+
====PostBeginPlay====
 +
{{code|simulated event '''PostBeginPlay''' ()}}
  
Create a subclass of KActor (or preferably Karmathing) in order to adjust it's properties.
+
'''Overrides:''' [[UE2:Actor events (UT2004)#PostBeginPlay|Actor.PostBeginPlay]]
  
====SpawnOffset====
+
Use the Health variable and keep TotalHealth as backup.
'''Type:''' [[vector]]
+
  
Where does the KActor spawn in relation to the location of the StaticMesh?
+
====PostNetReceive====
 +
{{code|simulated event '''PostNetReceive''' ()}}
  
====RotationOffset=====
+
'''Overrides:''' [[UE2:Actor events (UT2004)#PostNetReceive|Actor.PostNetReceive]]
'''Type:''' [[rotator]]
+
  
Which rotation does the KActor have in relation to the StaticMesh?
+
This updates the visuals and collision on the client to the current LOD when the variable changes on the server or when the player just joined.
  
====KActorLifeSpan=====
+
====TakeDamage====
'''Type:''' [[rotator]]
+
{{code|event '''TakeDamage''' ([[int]]&nbsp;'''NDamage''', [[UE2:Pawn (UT2004)|Pawn]]&nbsp;'''instigatedBy''', [[UE2:Object structs (UT2004)#Vector|Object.Vector]]&nbsp;'''hitlocation''', [[UE2:Object structs (UT2004)#Vector|Object.Vector]]&nbsp;'''momentum''', [[class]]<[[UE2:DamageType (UT2004)|DamageType]]>&nbsp;'''damageType''')}}
  
How many seconds does the KActor exist before it gets destroyed?
+
'''Overrides:''' [[UE2:Decoration (UT2004)#TakeDamage|Decoration.TakeDamage]]
  
0 means infinite, but it's recommended to avoid that.
+
Process damage on this actor and change it's appearance if a DamageLimit is reached.
  
 +
====Trigger====
 +
{{code|event '''Trigger''' ([[UE2:Actor (UT2004)|Actor]]&nbsp;'''Other''', [[UE2:Pawn (UT2004)|Pawn]]&nbsp;'''EventInstigator''')}}
  
===Struct '_Effects'===
+
'''Overrides:''' [[UE2:Decoration (UT2004)#Trigger|Decoration.Trigger]]
====Emitter====
+
'''Type:''' [[class]]<[[UE2:Emitter (UT2004)|Emitter]]>
+
  
Use this Emitter class for the effect.
+
Triggering will cause the actor to lose all health that is the difference to the next lower LOD, i.e. cause it to active the next LOD.
  
====xEmitter====
+
===Other instance functions===
'''Type:''' [[class]]<[[UE2:xEmitter (UT2004)|xEmitter]]>
+
====AssignKarmaThingProperties====
 +
{{code|simulated function '''AssignKarmaThingProperties''' ([[User:Crusha/UltimateMappingTools/UltimateDestructibleEnvironment#DynamicSpawnableKarmaThing|DynamicSpawnableKarmaThing]]&nbsp;'''KarmaThing''', [[float]]&nbsp;'''NewLifeSpan''', {{cl|StaticMesh}}&nbsp;'''NewStaticMesh''', [[float]]&nbsp;'''NewMaxNetUpdateInterval''')}}
  
Use this xEmitter class for the effect. This is used in case the Emitter class is not specified.
+
Small hack to get the KarmaThing set up on the client as well.
  
====SpawnOffset====
+
====CheckDamageType====
'''Type:''' [[vector]]
+
{{code|function [[bool]]&nbsp;'''CheckDamageType''' ([[class]]<[[UE2:DamageType (UT2004)|DamageType]]>&nbsp;'''DT''')}}
  
Where does the effect spawn in relation to the location of the StaticMesh?
+
Returns True if the DamageType is considered valid for this actor.
  
 +
====Reset====
 +
{{code|function '''Reset''' ()}}
  
===Struct '_Sounds'===
+
'''Overrides:''' [[UE2:Actor instance functions (UT2004)#Reset|Actor.Reset]]
====Sound====
+
'''Type:''' [[UE2:Sound (UT2004)|Sound]]
+
  
The sound to be played (from the center of the actor before it's destruction).
+
Restore initial values if this actor should be reset.
  
====SoundVolume====
+
====UpdatePrecacheStaticMeshes====
'''Type:''' [[float]]
+
{{code|simulated function '''UpdatePrecacheStaticMeshes''' ()}}
  
How loud the sound is being played. 1.0 is the maximum and is what you hear in the Sound Browser.
+
'''Overrides:''' [[UE2:Actor instance functions (UT2004)#UpdatePrecacheStaticMeshes|Actor.UpdatePrecacheStaticMeshes]]
  
====SoundRadius====
+
Load StaticMeshes into memory for faster access.
'''Type:''' [[float]]
+
  
The radius around the actor in which the sound can be heard.
 
  
====SoundPitch====
 
'''Type:''' [[float]]
 
  
'''Recommended value:''' 1.0
+
=DynamicSpawnableKarmaThing=
 +
{{infobox class
 +
| class = DynamicSpawnableKarmaThing
 +
| game = UT2004
 +
| engine = UE2
 +
| package = UltimateMappingTools
 +
| customparent1 = KarmaThing
 +
| parent2 = KActor
 +
| parent3 = Actor
 +
| parent4 = Object
 +
| custom = yes
 +
}}
  
How fast the sound is being played. 0.5 is half of normal speed and one octave lower.
+
A dynamic (and not so network efficient) version of the KarmaThing that can
 +
be spawned at runtime. It's used by the UltimateDestroyableEnvironment and
 +
not supposed to be placed in the map by hand.
  
2.0 is twice the normal speed and one octave higher. Those are the minimum and maximum values.
+
==Default values==
 +
{| class="list defaults"
 +
! Property
 +
! Value
 +
|-
 +
| [[UE2:Actor properties (UT2004)#bNoDelete|bNoDelete]]
 +
| False
 +
|}

Latest revision as of 15:58, 12 October 2011

UltimateDestroyableEnvironment

by Crusha K. Rool

UT2004 Object >> Actor >> Decoration >> UltimateDestroyableEnvironment (custom)
Package: 
UltimateMappingTools

Allows to set up an actor that gets more and more destroyed when it takes damage. That is done by having multiple versions of the StaticMesh that are differently high damaged.

Properties

Property group 'Events'

ResetEvent

Type: name

Triggered if bReset is True, so that you can potentially do some updates on other things as well when resetting this actor.

WrongDamageTypeEvent

Type: name

Triggered when an invalid DamageType damaged this actor.

Property group 'UltimateDestroyableEnvironment'

bBlackList

Type: bool

If true, the DamageTypes in the array can NOT damage this actor.

Default value: True

bReset

Type: bool

Reset this actor after the round ended or keep destruction the whole match?

bResetEventOnlyWhenFinalDestruction

Type: bool

If True, only fire off the ResetEvent if an LOD with bFinalDestruction has been reached in this round.

DamageTypes

Type: array<class<DamageType> >

Which DamageTypes can affect this actor?

LevelOfDestruction

Type: array<_LevelOfDestruction>

Determines the appearance of the Actor at different health levels.

TotalHealth

Type: int

The initial health of this actor.

Default value: 2000

WrongDamageEventTreshold

Type: int

Trigger an event every time this much damage has been caused by a "wrong" DamageType.

Default value: 300

Internal variables

AccumulatedWrongDamage

Type: int

This much of the wrong damage has been accumulated already.

bFinalDestructionReached

Type: bool

Used by bResetEventOnlyWhenFinalDestruction.

CurrentLOD

Type: int

This tells players who join the match in progress how the Actor currently looks like.

Default value: -1

i_temp

Type: int

Counter.

j_temp

Type: int

Remember the current array for use in GainedChild.

OldLOD

Type: int

Only change appearance if we receive a LOD value that is not the same as the old one.

Default value: -1

OriginalLocation

Type: Object.Vector

Remember for calculating offset from default in each LOD.

OriginalRotation

Type: Object.Rotator

Remember for calculating rotation offset from default in each LOD.

OriginalScale

Type: Object.Vector

Just remember this too.

OriginalStaticMesh

Type: StaticMesh

Remember for reset.

OriginalStyle

Type: Actor.ERenderStyle

Don't ask.

Default values

Property Value
bAlwaysRelevant True
bBlockActors True
bBlockKarma True
bCollideActors True
bEdShouldSnap True
bNetNotify True
bNoDelete True
bStatic False
bWorldGeometry True
DrawType DT_StaticMesh
RemoteRole ROLE_SimulatedProxy
StaticMesh StaticMesh'Albatross_architecture.Alb_crate1'

Structs

_DecoKActor

You can spawn real chunks that are physics calculated when you destroy this Actor step by step.

StaticMesh KActorStaticMesh 
This StaticMesh will be used by the KarmaThing that is spawned.
float KActorMaxNetUpdateInterval 
How often is the KActor maximally updated per second for online games. Should be about 0.5
KarmaParams KActorParameters 
Set the parameters for the new Karma object.
Object.Vector SpawnOffset 
Where does the KActor spawn in relation to the location of the StaticMesh?
Object.Rotator RotationOffset 
Which rotation does the KActor have in relation to the StaticMesh?
float KActorLifeSpan 

_LevelOfDestruction

Determines the appearance of the Actor at different health levels.

StaticMesh DestroyedStaticMesh 
The new StaticMesh that is used at this LOD.
int HealthLimit 
This LOD becomes active if the actors health drops below this.
Object.Vector StaticMeshScale 
Scale the StaticMesh by this value. Values close to 0 are ignored.
Object.Vector StaticMeshOffset 
New location of the StaticMesh in relation to the original location.
Object.Rotator StaticMeshRotation 
New rotation of the StaticMesh in relation to the original rotation.
array<_DecoKActor> KarmaDeco 
KActors to spawn at the destruction.
name TriggerEvent 
Trigger this Event once this LOD has been reached.
bool bFinalDestruction 
bool bReached 
True if this LOD has been executed already.

Functions

Events

GainedChild

simulated event GainedChild (Actor Other)

Overrides: Actor.GainedChild

This is the only place where we can assign our custom KParam as KParam of the spawned KActor before the Karma physics are initilizing.

PostBeginPlay

simulated event PostBeginPlay ()

Overrides: Actor.PostBeginPlay

Use the Health variable and keep TotalHealth as backup.

PostNetReceive

simulated event PostNetReceive ()

Overrides: Actor.PostNetReceive

This updates the visuals and collision on the client to the current LOD when the variable changes on the server or when the player just joined.

TakeDamage

event TakeDamage (int NDamage, Pawn instigatedBy, Object.Vector hitlocation, Object.Vector momentum, class<DamageTypedamageType)

Overrides: Decoration.TakeDamage

Process damage on this actor and change it's appearance if a DamageLimit is reached.

Trigger

event Trigger (Actor Other, Pawn EventInstigator)

Overrides: Decoration.Trigger

Triggering will cause the actor to lose all health that is the difference to the next lower LOD, i.e. cause it to active the next LOD.

Other instance functions

AssignKarmaThingProperties

simulated function AssignKarmaThingProperties (DynamicSpawnableKarmaThing KarmaThing, float NewLifeSpan, StaticMesh NewStaticMesh, float NewMaxNetUpdateInterval)

Small hack to get the KarmaThing set up on the client as well.

CheckDamageType

function bool CheckDamageType (class<DamageTypeDT)

Returns True if the DamageType is considered valid for this actor.

Reset

function Reset ()

Overrides: Actor.Reset

Restore initial values if this actor should be reset.

UpdatePrecacheStaticMeshes

simulated function UpdatePrecacheStaticMeshes ()

Overrides: Actor.UpdatePrecacheStaticMeshes

Load StaticMeshes into memory for faster access.


DynamicSpawnableKarmaThing

UT2004 Object >> Actor >> KActor >> KarmaThing >> DynamicSpawnableKarmaThing (custom)
Package: 
UltimateMappingTools

A dynamic (and not so network efficient) version of the KarmaThing that can be spawned at runtime. It's used by the UltimateDestroyableEnvironment and not supposed to be placed in the map by hand.

Default values

Property Value
bNoDelete False