SpecialDamage

  • 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.

tarquin

design is flawed
Oct 11, 2000
3,945
0
36
UK
www.planetunreal.com
does anyone here understand the mysteries of SpecialDamage?

I'm using the SpecialEvent trigger in a level, set to the DamageInstigator state, with the DamageString property set, but I'm not getting the message when the trigger kills me in the game.
Not really a coding question, I know, but the Ed board is drawing a blank on this one & I suspect the answer lies in the code somewhere...

there remains the possibility that this is a wild goose chase, and it's another of those little bits of unrealscript that Epic didn't get round to finishing -- leaving the building blocks lying around to tantalize us with what might have been.
In that case, how do I have a triggered damage show up a specific message, with the usual player name parsing, when the player dies from it?

snip from SpecialEvent class
Code:
state() DamageInstigator
{
	function Trigger( actor Other, pawn EventInstigator )
	{
		Global.Trigger( Self, EventInstigator );
		if ( Other.IsA('PlayerPawn') )
			Level.Game.SpecialDamageString = DamageString;
		Other.TakeDamage( Damage, 
		EventInstigator, EventInstigator.Location, 
		Vect(0,0,0), DamageType);
	}
}
 
Noone seems to have a comprehensive understanding of how that all works, and i'm 5 months new to UT mapping and 3 months new to UScript, but ironically i've dealt with this issue a few times in my first map which i just released. So hopefully i can help point you in the right direction.

I initiallly had a situation where i was using SpecialEvent with DamageInstigator to injure (and possibly kill) players and needed a custom death message. Always had problems with the custom death message, but more importantly i noticed an even bigger problem if you're only injuring players (as opposed to setting the damage real high to insure instant death): The damage done to the player is different in network play than it is in botmatch. Never could find a happy compromse so i ditched the approach, went with zoning the small area i needed and setting it to cause x damage per second, and now the damage is consistent between modes of play and i get my custom deathmessage.

A sidenote: There's a SpecialEvent with DamageInstigator in i believe DM-Cybrosis for the lazerbeams by the damage amp, and i patterned off that initially and wondered why it wasn't working, until i realized it wasn't working in the UT map either, in fact i'm not sure it's even used, the damage being done by a mover or some other means. But for sure their custom death message never plays.

As far as looking at UScript to figure it out: You need to follow the track from Died() all the way through to the native c++ function that actually parses the deathmessage. The reason this custom deathmessage stuff is so hard to nail down is that once you look through Died, GameInfo.ScoreKill, and the other related function (can't recall it's name but it's in GameInfo) that determines what to feed to the native parsing function, you'll see that there are many different factors that influence whether it looks at your custom message or not.

You have to be careful with manipulating "SpecialDamageString = DamageString" (though certainly you need to be sending 'SpecialDamage' as the damage type) ... I found this out the hard way. I modified the TriggeredDeath actor because i needed a trap like that that was activated remotely by a button but killed everything in it's radius. I also (separately but in the same map) wanted a zone trap similar to DM-Pressure but didn't have the luxury like they did of confining the victims to the zone once the trap was triggered, it just needed to kill everything inside it once time expired.

In both cases i reset the globaldamagestring and called Died() for the relevant pawns, but upon testing i was sporadically getting either of the two custom death messages when i shouldn't be, for example when a bot fell to his death during melee. This took forever to even notice, and i never did analyze every possible route the stock code could take to produce this, but i effectively limited it by making my trap function only modify the globaldamagestring immediately before killing the victims, then changing it back to its prior value immediately afterwards.

And because under certain game conditions the code calls the parsing function with an empty weapon value, the log occasionally shows an Accessed None warning, but it doesn't matter, it's because the parse function is getting called after a victim's weapon has been destroyed. Anyway, no cut and dried answers, because the code can take so many different routes to get to the parsing function.

And last but not least (along the lines of "Are you sure you plugged it in?"), are you sure you've got the deathmessage syntax right? You need at least the killer and victim parameters (%k and %o respectively, and %w if you have any type of weapon text to be parsed) for it to work properly. And damage type must be 'SpecialDamage', and if it's zone related, the zone must be set to cause at least some damage, unless you're overriding it with code by using Died or TakeDamage, etc. Also it's easy to forget which variables use text strings and which ones are Description or whatever it is that is not text and uses different delimiters (some use single quotes, others use double quotes).

If you want to look at examples of all of this, the modified actors are in navboyScripts.u in the finished map:

DM-Gravadyne7.zip

HTH

-steve/navboy
 

tarquin

design is flawed
Oct 11, 2000
3,945
0
36
UK
www.planetunreal.com
wow :) thanks for all the info :D

I had indeed omitted the %o, thinking that since the killing wasn't done by a player... :rolleyes: doh!
The KillInstigator now works:
"%k was sliced. %o" produces "Tarquin was sliced." and UT is clever enough to do nothing with the %o.

However, with DamageInstigator set to:
"%k was steamed. %o", I get "Tarquin was steamed. Tarquin", which is a little peculiar..
I daresay I can find a way to fit in the player's name twice
("Tarquin stayed near the jets too long: steamed Tarquin!" for example) but like you said, the damage doesn't seem to be consistent. With Damage set to 10 I seem to be losing 25 health each time... usually :con:

The area where I want to cause damage can probably be zoned off so I'll try that.

thanks again for all the info.
 
ya, check the damage in botmatch then in network and it'll be different, i think it's also a factor of the base difficulty level (the 8 bot skill settings are divided into 3 tiers of difficulty) ...

I think the repeating the name thing has to do with either you are both the Instigator and the victim of the trap ... or if not that, then there is no Instigator carried through the function and passed on and in certain circumstances it uses the victim in place of the Instigator, i can't remember, it's all there in the code though. Pain in the *ss for sure.