Triggering a death Region (PhysicsVolume)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

zest

New Member
Jul 28, 2005
16
0
0
So here is the Scenario. I have a laser beam door. If the player passes through the lasers he get killed. I want this attached to an on/off switch(use trigger). Current setup is as follows.

1. A particle system tagged as Laser_B(My Laser Beam Door which is on.)
2. PhysicsVolume tagged as Laser_B with bPainCausing=True, and damagePerSec=150 (Death region also turned on)
3. A Use trigger set to Call Laser_B

What happens: When the player hits the trigger the Particle beam turns off, but the bPainCausing never gets Toggled. I have read through tutorials and through Epics own default PhysicsVolume code, and everywhere I have looked says that if there is a Number in the "DamagePerSec" property then a trigger should toggle bPainCauseing true or false. This isn't happening for me. Any suggestions of what I’m doing wrong or maybe other ways to approach what I want to do.

P.S. I know I could build a new custom PhysicsVolume class and attach it to a triggered mover to get the same effect, but I would rather not have to. I really don’t want to have to add any custom classes or code.
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
zest said:
What happens: When the player hits the trigger the Particle beam turns off, but the bPainCausing never gets Toggled.
The thing stopping you is a hidden property bStatic.
You'll want to set that to bStatic = false. But, because it's hidden, you'll want a whole new custom actor.
Luckily, this has been done before.
Code:
//=============================================================================
// TriggerPainVolume.
// by SuperApe -- April 2004
//=============================================================================
class TriggerPainVolume extends PhysicsVolume;

state() TriggerToggle
{
	simulated function Trigger( Actor Other, Pawn EventInstigator )
	{
		if ( DamagePerSec != 0 )
		{
			bPainCausing = !bPainCausing;
			if ( bPainCausing && ( PainTimer == None ) )
				PainTimer = spawn( class'VolumeTimer', self );
		}
	}
}

state() TriggerControl
{
	simulated function Trigger( Actor Other, Pawn EventInstigator )
	{
		if ( DamagePerSec != 0 )
		{
			bPainCausing = !bPainCausing;
			if ( bPainCausing && ( PainTimer == None ) )
				PainTimer = spawn( class'VolumeTimer', self );
		}
	}
	simulated function UnTrigger( Actor Other, Pawn EventInstigator )
	{
		if ( DamagePerSec != 0 )
		{
			bPainCausing = !bPainCausing;
			if ( bPainCausing && ( PainTimer == None ) )
				PainTimer = spawn( class'VolumeTimer', self );
		}
	}
}
You'll need to make this custom actor: Uncheck "placeable actors" in the actor browser, select Brush -> Volume -> PhysicsVolume, Right-click and select New..., type "myLevel" in Package and "TriggerPainVolume" in Name. After naming your new custom Actor, delete the default code that shows up in the script editor. Copy and paste in the code that is shown above. Compile it. (hit the button that looks like a black arrow over a stack of papers)
Then you'll type "editdefault class=TriggerPainVolume" in the Ued console.
And change None -> bStatic = false.
Then, add the volume to your map and save the map.

Sounds like a lot? You could download a map of mine, open it, open your map, and make a new TriggerPainVolume, and save. (after loading mine, it will be there for you)

I just realized there was no wiki page for this, so I added one.
EDIT: And then I removed it.
 
Last edited:

zest

New Member
Jul 28, 2005
16
0
0
THANKS :)

Wow, thanks you have saved me a bunch. Plus taught me a new way to add custom classes.

thanks,

zest
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
Not a problem. :D
Someone on the wiki pointed out another way to trigger pain through the ScriptedTrigger ACTION_DamageActor, but I realize you wanted a volume of pain (death).
Btw, crank the pain amount per second to around 300 for instant death even if the player has visited a few power ups.
 

zest

New Member
Jul 28, 2005
16
0
0
Thanks, how do i remove a custom class that i had added

Now that you have taught me how to add a custom class and set in in 'Mylevel'. Is there an easy way to remove a custom class from my level?

thanks
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
Things that are stored in MyLevel only persist during a save if the level is dependent on it. Thus remove all instances of the class in your level, save and quit UnrealED and restart it. Why you need to restart UnrealED, is because it doesn't alter than myLevel package in memory ... hence why you can load different levels to obtain their myLevel meshes/textures or whatever else they stored in there. However your level's myLevel on harddisk won't have the class anymore ... or at least in theory anyways.
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
zest said:
Now that you have taught me how to add a custom class and set in in 'Mylevel'. Is there an easy way to remove a custom class from my level?
Sorry, I didn't go into the 'myLevel' virtual package at all in my instructions. That would have been a good idea. Here is a quick overview of what it is, for anyone who's interested.

[SAS]Solid Snake said:
Things that are stored in MyLevel only persist during a save if the level is dependent on it. Thus remove all instances of the class in your level, save and quit UnrealED and restart it. Why you need to restart UnrealED, is because it doesn't alter than myLevel package in memory ... hence why you can load different levels to obtain their myLevel meshes/textures or whatever else they stored in there. However your level's myLevel on harddisk won't have the class anymore ... or at least in theory anyways.
What he said. :) A way I move things from package to package is to recreate it with another name in the new package. For a moment, two identical objects will be there. Then (as SS says) remove the old one and save. As long as you've removed all instances of your object's structure, you don't really need to restart Ued, but it is a sure way to double check that you haven't missed anything in the myLevel package.
So, if you called it "myTriggerPainVolume", you'd want to change the first line of code to match, so that it can compile. After that, you can (should probably) recreate it again with the correct name, changing the code back. Why go through that just for the name? You don't have to, but it keeps the object consistent from one mapper's efforts to another.
One more note for anyone casually reading this stuff about the myLevel package, never save it when quitting Ued. Never.
Hope that helps.
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
Well, after all that...

Wormbo on the wiki pointed out to me that a VolumeTrigger should allow PhysicsVolumes to toggle. A TriggerControl system can be configured with a ScriptedTrigger and a TriggeredCondition. I am not at a machine with Ued ATM, but I'd take Wormbo's word any day.

I'm just wondering how the VolumeTrigger code looks. I want to know how it gets around the bStatic problem for myself. I haven't seen it used before, but I'm sure it all works as it should.

Live and learn. At least I was able to tell you how to add custom actors. :rolleyes:
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
The VolumeTrigger is an additional actor you polace in the level. It used ForEach AllActors(class'Volume', V, Event) { ... } to trigger each volume with a Tag matching the event. The VolumeTrigger itself has a Tag that should be matched with the original trigger event name.
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
Thanks, Wormbo.
I have to say I'm a little suprised this works.
I expected an explicit bStatic reference in the code.
I'm suprised that
Code:
class VolumeTrigger extends Triggers;

event Trigger( Actor Other, Pawn EventInstigator )
{
    local Volume V;
    
	if ( Role < Role_Authority )
		return;
    
	ForEach AllActors(class'Volume', V, Event)
		V.Trigger(Other, EventInstigator);
}
...this is all there is. From my point of view, V.Trigger(); is exactly the same as simply triggering the Volume by matching Event -> Tag. Why this can override the bStatic property on a Volume is bizzare to me.

I'm wondering where else I can apply this new found trick? :p
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Triggering is not directly connected to the value of bStatic. It's just that the TriggerEvent() and UntriggerEvent() functions use ForEach DynamicActors(class'Actor') {all non-static actors} and For (Level.NavigationPointList) {I think non-static NavigationPoints are excluded here because they were already triggered through DynamicActors()} , while the VolumeTrigger's Trigger() function uses ForEach AllActors(class'Volume') {all Volumes, whether they are static or not}.
 

zest

New Member
Jul 28, 2005
16
0
0
"TriggerControl system can be configured with a ScriptedTrigger and a TriggeredCondition."

Could you give me a quick explanation of how to setup the triggered condition to trigger the PhysicsVolume bPainCauseing on and off. I'm familiar with ScriptedTriggers just not too much with trigger conditions. Here is how I tried to set it up but I still couldn’t get it to trigger.

AIScript
-Action

--Action_WAITFOREVENT
ExternalEvent= Use_Trigger
--Action_TRIGGEREVENT
Event= TriggeredCondition
--Action_IFCONDITION
TriggeredConditionTag= TriggeredCondition
--Action_TRIGGEREVENT
Event= ParticleSystem
--Action_TRIGGEREVENT
Event= PhysicsVolume

The TriggerdCondition has: bToggled=true

The PhysicsVolume has: bPainCauseing=true (this should go false if triggerd, therefor turning off the death region.)

I get the Particle system to turn on but I can’t get the PainCauseing to go false.

thanks
-zest
 
Last edited:

zest

New Member
Jul 28, 2005
16
0
0
I realized after I read your tutorial that I was using the trigger condition the wrong way, and I didn't even need it for this door. What I forgot was the Volume Trigger to trigger the Physics Volume. My Final simple scripted trigger looks like this:

AIScript
-Action

--Action_WAITFOREVENT
ExternalEvent= Use_Trigger
--Action_TRIGGEREVENT
Event= ParticleSystem
--Action_TRIGGEREVENT
Event= VolumeTrigger
--Action_GOTOACTION
ActionNumber=1

Once the VolumeTrigger gets the event call it then triggers the death region.

This works great.
Thanks Wambo, and SuperApe for all your help.

-zest