AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved] Change Blood Color (https://forums.alliedmods.net/showthread.php?t=96275)

stupok 07-03-2009 00:23

[solved] Change Blood Color
 
I want to change the blood color for a particular player or group of players, not all players.

I'm having trouble doing this properly. Right now, I'm doing it in a very "hackish" way and the results are bad.

I'm hooking TE_BLOODSTREAM, TE_BLOOD, TE_BLOODSPRITE, reading the coordinates, finding the ent at the coords, and then checking if the ent is the right one. It's not precise and it doesn't work well.

I only found two relevant threads on the forum:
https://forums.alliedmods.net/showthread.php?t=61812
https://forums.alliedmods.net/showthread.php?t=3464

I didn't have any success playing with pdata, but maybe I'm doing it wrong. Has anyone done this properly?

ConnorMcLeod 07-03-2009 00:52

Re: Change Blood Color
 
Quote:

/**
* Description: Normally returns the blood color of the entity.
* Forward params: function(this)
* Return type: Integer.
* Execute params: ExecuteHam(Ham_BloodColor, this)
*/
Ham_BloodColor,

Arkshine 07-03-2009 00:55

Re: Change Blood Color
 
Try m_bloodColor (89) at player's spawn or Ham_BloodColor.

stupok 07-03-2009 00:59

Re: Change Blood Color
 
set_pdata_int( id, 89, 195 ) on Ham_Spawn post works

However, the decals on the wall are still red :(

I'm thinking about what to do about that...

Arkshine 07-03-2009 01:09

Re: Change Blood Color
 
Did you try to hook Ham_BloodColor ? Because It's called in TraceAttack().

stupok 07-03-2009 01:22

Re: Change Blood Color
 
I tested Ham_BloodColor a long time ago, and I didn't have success. Maybe I was doing it wrong :oops:

Anyways, I don't think Ham_BloodColor will suffice for the red blood decals on the wall.

So, the solution is to record the red and yellow blood decal indexes and then write the yellow one after Ham_TraceAttack is called on the target player. If you want more details, I can write some real code.

Arkshine 07-03-2009 01:47

Re: Change Blood Color
 
Record, you could harcode them like in HL :

#define BLOOD_COLOR_RED (BYTE)247
#defineBLOOD_COLOR_YELLOW (BYTE)195

jim_yang 07-03-2009 02:10

Re: Change Blood Color
 
try to set "env_blood" entity's pev_impluse for it's color and pev_dmg for it's amount after it spawned
don't know if it works, never change the blood's color. :)

Arkshine 07-03-2009 11:15

Re: Change Blood Color
 
Doing that, it works and for decal too :

Code:
    #include <amxmodx>     #include <hamsandwich>         const BLOOD_COLOR_YELLOW = 195;         public plugin_init()     {         RegisterHam( Ham_BloodColor, "player", "CPlayer_BloodColor" );     }         public CPlayer_BloodColor ( const Player )     {         SetHamReturnInteger( BLOOD_COLOR_YELLOW );         return HAM_SUPERCEDE;     }

Edit : Actually decal color ( for other color ) is not changed and I don't think it's possible to change it since there is not color param for TE_WORLDDECAL or TE_DECAL.

stupok 07-03-2009 12:55

Re: Change Blood Color
 
@arkshine
Wow, this is confusing me.

You said it does not work for decal color. I confirmed this last week when I tested Ham_BloodColor.

Today, I'm testing it again, and decal color is successfully changed. :shock:


All times are GMT -4. The time now is 15:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.