Page 1 of 1

Server Side Blood Mode - is possible ?

Posted: Thu Sep 29, 2005 1:09 pm
by mcunha98
Well boys, my area is map !
I am a dedicated designer map, but i write code the full day (my job :wink: ).

My question is, i see many mods of net, for weapons, etc...
But i dont see a mod server side to show blood, in all samples, you need get a pk3 file and put in main. Not is possible make a blood mod 100% server side ??? :cry:

Posted: Thu Sep 29, 2005 3:07 pm
by Rookie One.pl
There is one by Scorpio Midget, but it's using the oil barrel leak effect. If you don't mind your blood being black, then go for it.

Posted: Thu Sep 29, 2005 3:29 pm
by mcunha98
Rookie One.pl wrote:There is one by Scorpio Midget, but it's using the oil barrel leak effect. If you don't mind your blood being black, then go for it.

Black Blood ?!?!
Hunpf, not is realistic and not is beautiful.
But, is usefull.
Where i find it ???

Posted: Thu Sep 29, 2005 3:35 pm
by lizardkid
it's not possible to do a serverside blood mod, simply because the blood is supported in all MOH, but they have no image for the blood. which is al blood mods do.

you could use something like tha barrell blood but it's not very cool imo :(

Posted: Thu Sep 29, 2005 5:44 pm
by Rookie One.pl
Here it is. It also includes always staying dead bodies. Save it as dead_bodies_and_blood.scr.

It's made by Scorpio Midget and the code is IMHO total crap. I can't believe the legend of MoH modding could write such lame stuff.
// ----- How 2 use --------
// put this after 'level waittill spawn' in the main map script
// it spawns permanent dead bodies, and blood trails if player takes enough damage
// pass parameters <bodies> <blood> <health> <ghost_specators>
// where bodies = 0 or 1, blood = 0 or 1, health = health points below which blood is left as a trail, <ghost> = 0 or 1
// ------------------------

Code: Select all

//
// Version 2
// Permanent Dead Bodies and Blood Trails
// Developed by ScorpioMidget
// Thanks to Poolmaster for helping me test it and find the bugs.
// 1st public release 22 Jul 2003
// Tested on MOHAA
// it might work on SH, i dunno
// Tested on obj_team1 ... 4 , all worked ok
//
// If you find any bugs, let me know what they are so i can releae a fixed verision
// scorpiomidget@hotmail.com
//
// FEEL FREE TO USE THIS SCRIPT, BUT PLEASE DONT REMOVE THIS HEADER !.
// IF YOU MAKE AMENDMENTS, JUST MAKE A NOTE OF THEM BELOW, THANK-YOU
//
// ----- change log -------
// V2 Released 23 Jul 2003
// ... Added in code so spectators can be ghosts ;)
// ... altered body code, so head isn't buried in ground
// V1 Released 22 Jul 2003
// ------------------------
//
// ----- How 2 use --------
// put this after 'level waittill spawn' in the main map script
// it spawns permanent dead bodies, and blood trails if player takes enough damage
// pass parameters <bodies> <blood> <health> <ghost_specators>
// where bodies = 0 or 1, blood = 0 or 1, health = health points below which blood is left as a trail, <ghost> = 0 or 1
// ------------------------

setup local.bodies local.blood local.health local.ghost:
	if (local.health < 1 || local.health == NIL)
		local.health = 50

	if (local.ghost==NIL)
		local.ghost=0

	if (local.blood==NIL)
		local.blood=0

	if (local.bodies==NIL)
		local.bodies=0

	if (local.bodies==0 && local.blood==0)
		end

	if (level.deadbodies==1)
		end

	level.deadbodies=1;

	// setup player scanner
	for (local.p=1;local.p<=32;local.p++)
	{
		thread spawnstuff local.p local.bodies local.blood
		if (local.ghost==1) thread spectator_ghost local.p
	}
end

spectator_ghost local.p:
	while (1)
	{
		while (local.p>$player.size)
			waitframe
	
		local.player = $player[local.p]

		while (local.player==NULL || local.player.dmteam!="spectator")
			waitframe

		local.player hide
		local.counter = 0
		local.switchmode = 0.5
		local.hidden = 1

		while (local.player!=NULL && local.player.dmteam=="spectator")
		{
			wait .1
			local.counter ++
			
			if (local.counter>=local.switchmode)
			{
				if (local.hidden==1)
				{
					local.player show
					local.hidden = 0
					local.switchmode = randomint(1) + 0.2
				}
				else
				{
					local.player hide
					local.hidden = 1
					local.switchmode = randomint(5) + 2
				}
				local.counter=0
			}
		}

		if (local.player!=NULL && local.player.dmteam!="spectator")
			local.player show

		waitframe
	}
end

spawnstuff local.p local.bodies local.blood:
	while (1)
	{
		restartspawndeadbodyloop:

		while (local.p>$player.size)
			waitframe
	
		local.player = $player[local.p]

		while (local.player == NULL || local.player.dmteam=="spectator")
			waitframe

		while (local.player!=NULL && IsAlive local.player)
		{
			if (local.player.dmteam == "specatator")
				goto restartspawndeadbodyloop
	
			if (local.blood==1)
				thread spawnblood local.player

			waitframe
		}

		if (local.bodies==1)
		{
			local.fx = local.player.brushmodel	
			// up a bit so head isn't buried in floor	
			local.o = local.player.origin + (0 0 5)
			local.a = local.player.angles
			local.a[0] = 90

			// wait for the standard mohaa body to disappear
			wait 12

			// spawn a body
			local.body = spawn script_model model local.fx
			local.body.origin = local.o
			local.body.angles = local.a
			local.body notsolid

			// make sure it's drops to floor in case we died midair
			local.body droptofloor
			// wait for drop
			wait 3
			// move up slightly so head isn't buried in floor ;)
			local.o = local.body.origin
			local.body.origin = local.o + (0 0 5)
		}
	}
end

spawnblood local.player:
	if (local.player.bleading == 1)
		end

	thread debugtext "SPAWN BLOOD ! for player " local.player.entnum

	local.player.bleading = 1

	local.fx = "models/fx/barrel_oil_long.tik"

	thread debugtext "BLOOD Model is " local.fx

	local.lo = local.player.origin

	for (local.b=0;local.b<=10;local.b++)
	{
		local.blood[local.b] = spawn script_model model local.fx
		local.blood[local.b].targetname = local.targetname
		local.blood[local.b] hide
		local.blood[local.b] notsolid
	}

	local.b = 0

	while (IsAlive local.player)
	{
		while (local.player!=NULL && local.player.health > 50)
			wait .1

		if (local.player==NULL)
			break
	
		if ((IsAlive local.player) && (local.player.origin != local.lo))
		{	
			local.player iprint ("You are bleeding !")

			local.b = local.b + 1
			if (local.b > 10)
				local.b = 1

			local.targetname=("blood_" + local.b)

			local.blood[local.b].origin = local.player.origin
			local.a = local.player.viewangles
			local.a[2] = 0
			local.blood[local.b].angles = local.a
			local.blood[local.b].scale = randomint (8) + 8
			local.blood[local.b] show

			local.lo = local.player.origin

			wait 1
		}

		waitframe
	}

	for (local.b=1;local.b<=local.blood.size;local.b++)
	{
		if (local.blood[local.b] != NULL)
			local.blood[local.b] remove
		wait 1
	}

	local.player.bleading = 0
end

// text only output if debug mode is turned on
debugtext local.text:
	if (level.debug == 1)
		println ("DEBUG DeadBodiesAndBlood: [" + parm.previousthread + "] > " + local.text)
end

Posted: Thu Sep 29, 2005 6:03 pm
by At0miC
Well you can replace the barrel splat texture to any other texture which has a polygonoffset inside its shader.

You can do it like this, replace 'decalshader barrel_water_splat' to an other shader name (or texture name, which is most times the same as the shader name) but the shader must have a polygonoffset value, or you will get z-fighting.
However I could not find an interesting texture for this in mohaa.

The decalshader value is inside the tik file like the in the barrel_water_leak_splat.tik

Posted: Thu Sep 29, 2005 6:24 pm
by Green Beret
Cant you add color to the bodyhitpuff serverside?
Might not look as real.

Posted: Thu Sep 29, 2005 7:14 pm
by Rookie One.pl
Both of you, the stuff you suggest is client side. He asks for a server side thingy.

I would do it another way than Scorpio did - I would spawn a bit of blood through the PAIN state.

Posted: Thu Sep 29, 2005 8:05 pm
by At0miC
Oh yeah now I see, I thought my suggestion was server side