For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
Best way to handle lingering hurtbox/area for projectiles?
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Best way to handle lingering hurtbox/area for projectiles?
Title says it all. I tried simply calling HurtRadiusProj every tick or so but that feels like a wrong way to handle it. I tried spawning a DynamicZoneInfo and change its properties based on what zone it's fired in but this has the obvious side effect that doesn't work well when you shoot it near another zone that has different properties (like creating air inside of a zone with bWaterZone enabled).
The goal is mainly to make a pool of acid that lasts for a few second dealing damage over time for anything that walks into it. But having it work on a projectile during flight would also be usefull. Assuming both require a different approach.
The goal is mainly to make a pool of acid that lasts for a few second dealing damage over time for anything that walks into it. But having it work on a projectile during flight would also be usefull. Assuming both require a different approach.
Last edited by Skywolf on Mon Nov 27, 2017 3:02 pm, edited 1 time in total.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
yrex .
- OldUnreal Member
- Posts: 291
- Joined: Wed May 06, 2015 6:46 am
Re: Best way to handle lingering hurtbox/area for projectiles?
First, HurtRadiusProj uses the trace check which is probably not what you want. You could use foreach TouchingActors() instead.
Second, the timing. To make it more ZoneInfo-like, do something like this (pseudocode):
Second, the timing. To make it more ZoneInfo-like, do something like this (pseudocode):
Code: Select all
function Tick()
{
foreach ActorsInRange(A)
{
if(Level.TimeSeconds>LastHurtTime(A)+1)
{
A.TakeDamage(...)
LastHurtTime(A) = Level.TimeSeconds
}
}
}My work | contact: ampoyrex at wp dot pl
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
How would you go around implementing LastHurtTime though? Afaik the only way to do such a thing is by modifying the actor to have a variable called LastHurtTime which is not exactly desirable for obvious reasons.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
yrex .
- OldUnreal Member
- Posts: 291
- Joined: Wed May 06, 2015 6:46 am
Re: Best way to handle lingering hurtbox/area for projectiles?
Something like this:
Code: Select all
struct ActorInfo
{
var Actor Actor;
var float LastHurtTime;
};
var array ActorInfos;
function SetLastHurtTime(actor A, float time)
{
local int i;
for(i=0;iMy work | contact: ampoyrex at wp dot pl
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
A proper implementation depends on the shape of the pool and the laws of how entered actors are supposed to be damaged (whether the caused damage per sec is the same within the hitting area or is different on the bounds and the epicentre, what happens if the affected actor is partly inside the hitting area and partly outside of it, what is the frequency of damaging - 1 time per second, 10 times per second, etc...).The goal is mainly to make a pool of acid that lasts for a few second dealing damage over time for anything that walks into it.
Last edited by Masterkent on Tue Nov 28, 2017 11:04 am, edited 1 time in total.
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Since it's a splat of acid (similair to that of the blood splat that spawns under carcasses only instant) it would make sense to deal equal damage no matter what part you are touching. And since acid has a constant burning effect would it be more realistic to have a lot small amounts of damage per second.
Another problem is that you can have multiple splats on the floor at the same time. Which makes the damage stack if you implement it like Yrex suggested. Unless you can somehow share the actor array so all splats in the level have access to the same variables.
Another problem is that you can have multiple splats on the floor at the same time. Which makes the damage stack if you implement it like Yrex suggested. Unless you can somehow share the actor array so all splats in the level have access to the same variables.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
gopostal
- OldUnreal Member
- Posts: 1007
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
You can take a look at my work on the Saucier gun in the Food Fight mod for UT if you want something to follow. It's a gun that shoots either sprays or globs of hot sauce that ignite items that will burn (made of wood, cloth, etc). The flames are tricky though because in certain circumstances they can spread, like if you hit the bottom box of a stack. It could then burn it's way up the stack. You can also start forest fires by setting a tree or two on fire. Maybe this is getting close to what you want?
Last edited by gopostal on Wed Nov 29, 2017 2:50 am, edited 1 time in total.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Can you upload the relevant snipped(s) of code here? I don't own UT so I can't open your Food Fight Mod.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
gopostal
- OldUnreal Member
- Posts: 1007
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
I always post source code: http://www.moddb.com/mods/food-fight/addons/ff-mh-source-code
Look at the Saucier alt fire globs and the way they spawn a class called ObjectsFlames and set things nearby on fire.
I'm honestly a lower level coder compared to the rock stars in here but I'm happy to help any way I can. If you need help applying the Food Fight code I idle in my TS3 server most west coast US evenings.
Look at the Saucier alt fire globs and the way they spawn a class called ObjectsFlames and set things nearby on fire.
I'm honestly a lower level coder compared to the rock stars in here but I'm happy to help any way I can. If you need help applying the Food Fight code I idle in my TS3 server most west coast US evenings.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Is its size constant or smoothly decreasing to zero?Since it's a splat of acid (similair to that of the blood splat that spawns under carcasses only instant)
I think, stacking makes sense: more acid -> more damage. Besides, each splat could have its own "instigator" (the pawn which is formally responsible for damaging/killing). If you don't allow stacking, you may face with difficulties related to determining the instigator. For example, in Coop game, admins often disallow friendly fire, so allies can't hurt you while enemies can. This would imply the need to distinguish acid splats which may hurt a particular player and the ones which cannot.Another problem is that you can have multiple splats on the floor at the same time. Which makes the damage stack if you implement it like Yrex suggested
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
To give a better idea what I'm trying to do, here is what is looks like (ignore the blue spark thingy, that is just a temporary projectile for helping me debugging stuff):

As you can see is it impossible to tell if multiple splats are on the same spot. which is why I prefer it if the damage doesn't stack as it would just create player confusion.
And the size is constant. I would like it to fade out but the splats use AlphaBlend so it's impossible to do this.
As for the FoodFight mod. I'm terrible at reading code but from what I understand it simply does exactly what HurtRadiusProj does in terms of dealing damage only it spawns a copy of itself on nearby actors. It doesnt do the whole ZoneInfo-style damage dealing.

As you can see is it impossible to tell if multiple splats are on the same spot. which is why I prefer it if the damage doesn't stack as it would just create player confusion.
And the size is constant. I would like it to fade out but the splats use AlphaBlend so it's impossible to do this.
As for the FoodFight mod. I'm terrible at reading code but from what I understand it simply does exactly what HurtRadiusProj does in terms of dealing damage only it spawns a copy of itself on nearby actors. It doesnt do the whole ZoneInfo-style damage dealing.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Then the next question you should answer is "who is the damage instigator of the union of two acid splats which have different instigators?" This is a critical question if you're going to support multiplayer game.As you can see is it impossible to tell if multiple splats are on the same spot. which is why I prefer it if the damage doesn't stack as it would just create player confusion.
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
You can probably do both and simply split the damage (And simply draw a random instigator, which you will practically have to do anyway if you made them stack). Which is one of the possible solutions I came up with for this problem. Issue is that if two splats only partially overlap the whole area would have reduced damage even on the parts the two don't overlap.
If that implementation is impossible I would say the one who shot last. As their acid covers that of the other player. The acid is supposed to damage the instigator anyway so you can't just use your acid to make that of another player suddenly safe.
Bonus question unrelated to this: What is the best way to spawn a pawn that is used as a pawn kill detector from a mutator? These can't exist out of bounds so currently I have it search for a PlayerStart it can spawn at assuming that no mapper puts all of these in a location where nothing can spawn.
If that implementation is impossible I would say the one who shot last. As their acid covers that of the other player. The acid is supposed to damage the instigator anyway so you can't just use your acid to make that of another player suddenly safe.
Bonus question unrelated to this: What is the best way to spawn a pawn that is used as a pawn kill detector from a mutator? These can't exist out of bounds so currently I have it search for a PlayerStart it can spawn at assuming that no mapper puts all of these in a location where nothing can spawn.
Last edited by Skywolf on Sun Dec 03, 2017 8:49 pm, edited 1 time in total.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
If you mean the approach which implies changing the instigator on every damage tick, then you may get an effect that is opposite to stacking: the damage per time interval can be reduced. F.e. if you stayed only a on splat from your enemy, you'd get the full damage rate, but if you're also staying on a splat from your teammate and 100% protection from friendly fire is enabled, then you would take damage only on those damage ticks for which the instigator is defined to be your enemy.You can probably do both and simply split the damage
What set of game versions are you going to support? In case of 227, you can use GameRules.NotifyKilled instead of the trick with Pawn. If you need a possibility to spawn a Pawn out of world for other reasons, 227 lets you do this by means of function SpawnAct (providing false as the argument for parameter bMayColFail). If using 227-specific functions is not an option for you, then you can try to use a hack with setting bIsPawn to false (by means of calling ConsoleCommand("set" @ PawnClass @ "bIsPawn false")). Then bIsPawn must be set back to true as soon as possible - e.g. in Spawned().Bonus question unrelated to this: What is the best way to spawn a pawn that is used as a pawn kill detector from a mutator?
-
gopostal
- OldUnreal Member
- Posts: 1007
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Why don't you do damage depending on how far the player is from the acid pool center? If they are barely touching the edge then the damage is mitigated some. If they wade through the middle then they get full damage. This can be done with a simple and fast distance trace and then blunt the damage more for higher distance.
Add an instigator check and you are covered for team games with FF disabled.
Add an instigator check and you are covered for team games with FF disabled.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Sorry for the slow and infrequent replies. Work it keeping me busy.
Anyway, this brings us back to the whole ZoneInfo style damage dealing. If I can make some kind of additional variable per pawn to keeps track of what the last time they were hurt was you can avoid what Masterkent says.
Then If two splats overlap from different players (On team A and B) and friendly fire is disabled then the splat from a player on the same side (lets say team A) doesn't damage players from team A and thus doesn't change this variable for him. So that when the splat from team B checks for players that haven't been damaged yet it sees that the enemy player from Team A still has its LastHitTime variable above the threshold thus allowing it to deal damage to that player.
If both splats are from team B then one will damage the player from team A and the next one will see that LastHitTime hasn't passed the threshold (because the first splat already changed this) and thus doesn't deal additional damage.
You then make the game check the splats in newest to oldest in the array (assuming that new ones are added to the end or beginning and now put somewhere random) to make the player that shot last get the kill.
The challenge here is to make all the splats talk to each other about the players their LastHitTime Variable. But how to do that I have no idea.
About the pawn kill detector. How would you go around accessing GameRules.NotifyKilled from a Mutator? GameRules isn't a parent of Mutator so it isn't as easy as just writing a simple function called NotifyKilled or something.
Anyway, this brings us back to the whole ZoneInfo style damage dealing. If I can make some kind of additional variable per pawn to keeps track of what the last time they were hurt was you can avoid what Masterkent says.
Then If two splats overlap from different players (On team A and B) and friendly fire is disabled then the splat from a player on the same side (lets say team A) doesn't damage players from team A and thus doesn't change this variable for him. So that when the splat from team B checks for players that haven't been damaged yet it sees that the enemy player from Team A still has its LastHitTime variable above the threshold thus allowing it to deal damage to that player.
If both splats are from team B then one will damage the player from team A and the next one will see that LastHitTime hasn't passed the threshold (because the first splat already changed this) and thus doesn't deal additional damage.
You then make the game check the splats in newest to oldest in the array (assuming that new ones are added to the end or beginning and now put somewhere random) to make the player that shot last get the kill.
The challenge here is to make all the splats talk to each other about the players their LastHitTime Variable. But how to do that I have no idea.
About the pawn kill detector. How would you go around accessing GameRules.NotifyKilled from a Mutator? GameRules isn't a parent of Mutator so it isn't as easy as just writing a simple function called NotifyKilled or something.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
On the side that causes a damage, there is no flawless way to determine if there is a protection from friendly fire (or a different kind of protection) for a particular pawn and how much damage such a protection is able to absorb. The information about how much damage should be reduced is retrieved by pawns - they call GameRules.ModifyDamage and GameInfo.ReduceDamage to determine the actual damage amount which is then divided between armors and health. These functions are not necessarily pure (a pure function would take an incoming damage amount and return the adjusted damage amount without producing any side effects); in particular, they may count damage amount for various purposes and calling them more than once per the same damage may produce wrong results. Note also that protection from friendly fire is not necessarily either 0% or 100% (although usually it's one these two values). For example, dots used 50% FF damage absorbtion on his Coop server.Then If two splats overlap from different players (On team A and B) and friendly fire is disabled then the splat from a player on the same side (lets say team A) doesn't damage players from team A and thus doesn't change this variable for him.
Of course, you need to write a subclass of Engine.GameRules and spawn an instance of your class. A canonical implementation would look like this:How would you go around accessing GameRules.NotifyKilled from a Mutator? GameRules isn't a parent of Mutator so it isn't as easy as just writing a simple function called NotifyKilled or something.
Code: Select all
class MutatorName expands Mutator;
event BeginPlay()
{
Spawn(class'MutatorNameGR', self);
}Code: Select all
class MutatorNameGR expands GameRules;
var MutatorName MutatorRef;
event BeginPlay()
{
MutatorRef = MutatorName(Owner);
if (MutatorRef == none)
{
Destroy();
return;
}
if (Level.Game.GameRules == none)
Level.Game.GameRules = self;
else
Level.Game.GameRules.AddRules(self);
}
function NotifyKilled(Pawn Victim, Pawn Killer, name DamageType)
{
// Here you handle kills
// Properties and functions of the underlying mutator can be accessed through MutatorRef
}
defaultproperties
{
bHandleDeaths=True
}
Last edited by Masterkent on Sun Dec 10, 2017 7:15 pm, edited 1 time in total.
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
In that case I give up. There seems to be no easy way to handle this without serious modifications of existing classes 
Is it atleast possible to avoid the splats of each instigator from stacking? This would still mean that multiple players can stack the damage but considering the splats don't stay that long anyway is it unlikely that the damage gets stacked that insanely high regardless.
Is it atleast possible to avoid the splats of each instigator from stacking? This would still mean that multiple players can stack the damage but considering the splats don't stay that long anyway is it unlikely that the damage gets stacked that insanely high regardless.
I hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.
-
Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
Well, you have a choice between the two possibilities: allowing damage multiplication or allowing damage reduction. If you prefer to deal with a possible damage reduction, then the implementation could be easy:Is it atleast possible to avoid the splats of each instigator from stacking?
Code: Select all
class AcidSplat expands Projectile;
event Touch(Actor A)
{
local AcidSplatDamageAffector DamageAffector;
if (!A.bIsPawn)
return;
foreach A.ChildActors(class'AcidSplatDamageAffector', DamageAffector)
return; // if A already has an associated affector, then do nothing
Spawn(class'AcidSplatDamageAffector', A);
}
function CauseDamage(Actor A)
{
A.TakeDamage(Damage, Instigator, A.Location, vect(0,0,0), 'Corroded');
}
defaultproperties
{
Damage=10.0
CollisionRadius=....
CollisionHeight=....
Mesh=....
bUseMeshCollision=True
Physics=PHYS_None
....
}Code: Select all
class AcidSplatDamageAffector expands Info;
var() float DamageRate;
var private int NextProjectileIndex;
event BeginPlay()
{
SetTimer(1 / DamageRate, true);
}
event Timer()
{
local AcidSplat Proj, FirstProj;
local int i;
if (Owner == none || Owner.bDeleteMe)
{
Destroy();
return;
}
foreach Owner.TouchingActors(class'AcidSplat', Proj)
{
if (NextProjectileIndex
Last edited by Masterkent on Mon Dec 11, 2017 5:04 pm, edited 1 time in total.
-
Skywolf
- OldUnreal Member
- Posts: 880
- Joined: Sun Aug 02, 2009 12:20 pm
Re: Best way to handle lingering hurtbox/area for projectiles?
As I like to understand code rather than just mindless copy-pasting stuff am I kinda stuck right now not fully understanding how things work here. This is what I understand happens:
Code: Select all
class AcidSplat expands Projectile; //This one I understand what is does. So far so good.
event Touch(Actor A)
{
local AcidSplatDamageAffector DamageAffector;
if (!A.bIsPawn)
return;
foreach A.ChildActors(class'AcidSplatDamageAffector', DamageAffector)
return; // if A already has an associated affector, then do nothing
Spawn(class'AcidSplatDamageAffector', A);
}
function CauseDamage(Actor A)
{
A.TakeDamage(Damage, Instigator, A.Location, vect(0,0,0), 'Corroded');
}
defaultproperties
{
Damage=10.0
CollisionRadius=....
CollisionHeight=....
Mesh=....
bUseMeshCollision=True
Physics=PHYS_None
....
}Code: Select all
class AcidSplatDamageAffector expands Info; //Here my brain fails me
var() float DamageRate;
var private int NextProjectileIndex;
event BeginPlay()
{
SetTimer(1 / DamageRate, true); //Sets a timer and repeats is.
}
event Timer()
{
local AcidSplat Proj, FirstProj;
local int i;
if (Owner == none || Owner.bDeleteMe)
{
Destroy();
return;
}
foreach Owner.TouchingActors(class'AcidSplat', Proj) //iterates through all AcidSplats the owner (the pawn that walked into an acidsplat) is touching.
{
if (NextProjectileIndexI hate it when people ask me what my favorite game is. Just try to explain you're not talking about Unreal Tournament
.