Author Topic: Kill Icon String on Death  (Read 2286 times)

How would I get the KillIcon from %damageType?
Code: [Select]
package DeathMod
{
function gameConnection::onDeath(%client, %KillerPlayer, %Killer, %damageType, %a)
{
Parent::onDeath(%client, %KillerPlayer, %Killer, %damageType, %a);
                if(%Killer == %Client)
{
MessageAll('', %Client.name SPC "Self Deleted");
}
if(%Killer != %Client)
{
MessageAll('', %Killer.name SPC %damageType SPC %Client.name);
}
}
};
activatePackage(DeathMod);

Add this to the end of the function:
Code: [Select]
if(isObject(%killer) && %killer != %client)
%deathCI = getWord(getTaggedString($DeathMessage_Murder[%damageType]),1);
else
%deathCI = getWord(getTaggedString($DeathMessage_Self Delete[%damageType]),1);

echo(%deathCI);

I'm trying to remake death
I'm using hide kills along with this is there any way for me to make it with hide kills enabled?

I'm trying to remake death
I'm using hide kills along with this is there any way for me to make it with hide kills enabled?
Try this:
Code: [Select]
package DeathMod
{
function gameConnection::onDeath(%client, %KillerPlayer, %Killer, %damageType, %a)
{
Parent::onDeath(%client, %KillerPlayer, %Killer, %damageType, %a);
if($Pref::HideKills::enabled !== 0)
{
if(%Killer == %Client)
{
MessageAll('', %Client.name SPC "Self Deleted");
}

if(%Killer != %Client)
{
MessageAll('', %Killer.name SPC %damageType SPC %Client.name);
}

if(isObject(%killer) && %killer != %client)
%deathCI = getWord(getTaggedString($DeathMessage_Murder[%damageType]),1);
else
%deathCI = getWord(getTaggedString($DeathMessage_Self Delete[%damageType]),1);

echo(%deathCI);
}
}
};
activatePackage(DeathMod);

that wouldn't work because hide kills is on and your saying only to execute this if it is off I want hide kills to be on I'm rewriting the death code all I need right now is to simultaneously hide kills and get the kill icon string

that wouldn't work because hide kills is on and your saying only to execute this if it is off I want hide kills to be on I'm rewriting the death code all I need right now is to simultaneously hide kills and get the kill icon string
Nay, it only works when it is on because !== means if it does not equal.

o lol I didn't notice the ! I didn't know !== was the same as ==! but anyway that does't work because hide kills seems to hide the icons
« Last Edit: December 26, 2011, 08:43:30 PM by swollow »

o lol I didn't notice the ! I didn't know !== was the same as ==
!== is not the same as ==

!== Checks if it is not equal to the number and == checks if it is equal to the number.

!== is not the same as ==

!== Checks if it is not equal to the number and == checks if it is equal to the number.
no no no lol I  accidentally typed == instead of ! cause I was reading your quote, dammit lol now I look like an idiot :P

is !== a thing or do you mean !=

I wouldn't be surprised if this is some basic syntax everyone else knows and I somehow don't

is !== a thing or do you mean !=

I wouldn't be surprised if this is some basic syntax everyone else knows and I somehow don't
thats how i feel

Code: [Select]
if($Pref::HideKills::enabled !== 0)

Seriously, it's driving me crazy when people do this.
Let's try to get down to basics.

if will cause the code contained in brackets after it to be evaluated if the statement specified is more than or equal to 1. If an else block is present and the statement is less than 1, the code contained in brackets after that will be evaluated instead.

Now, something such as $Pref::HideKills::enabled -- based on the way you're using it, the name and other things, I can see that you're intending for it to be a boolean. True or false. 1 or 0. Now, if you specify a variable, it's value will be used.

So, because of this, if $Pref::HideKills::enabled is true (or 1), if ( $Pref::HideKills::enabled ) will succeed, and if ( !$Pref::HideKills::enabled ) won't, because ! negates the value of a statement.

A few things: I believe the death message is sent from the parent::..., but that same parent::... does a bunch of other important things involved in making the game work. Might be possible to catch it in MessageAllExcept and MessageClient. Figuring out how those work for death would involve quite a bit of trace(), dying, killing, logging, reading, logicing, inging, echo()ing, and perhaps a bit of getTaggedString()ing, since trace() doesn't do that automatically, and shows the id of the tagged string.

Next, there is no !==. There is only == and !=.

Finally, torque borrowed from the ancient language of C and decided that 0 means false, and any other number means true (It was probably a cycle or two faster on the early CPUs or something that doesn't matter nearly as much today, but I suspect the original Torque devs really liked those old languages...). Anything that isn't a number at all is also counted as false. Torque also treats the string "true" (case insensitive) as true, just to confuse you.


All of the important parts (how the game behaves) can be proven just by firing up the old singleplayer bedroom map, opening the console, and trying different things to see what works and how it responds. The rest can be discarded as a failed sense of humour or wild guesses about things that don't really matter anyway.

-lots of words-
Whatever you just said wasn't helpful at all I already knew that all, all I'm asking is for help getting the kill icon with hide kills enabled, I understand basic code.

Whatever you just said wasn't helpful at all I already knew that all, all I'm asking is for help getting the kill icon with hide kills enabled, I understand basic code.
What do you mean "getting" it? Do you mean getting the icon itself or getting the icon from the message when someone dies?