.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
Re: cs weapons modification
Old
  (#11)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: cs weapons modification - 10-09-2005

I believe you can look at the war3mod made for amx and see how Orcs do more damage with nades..
  
Reply With Quote
Re: cs weapons modification
Old
  (#12)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: cs weapons modification - 10-09-2005

Yes that can be done. Anyway, I don't think grenades would have a detonation event. They would probably spawn a sprite, make a sound, and be removed.It's the damage you need to look at.


sfx1999.postcount++
  
Reply With Quote
Re: cs weapons modification
Old
  (#13)
BotUser
Member
 
Status: Offline
Posts: 39
Join Date: Jun 2004
Default Re: cs weapons modification - 11-09-2005

Quote:
Originally Posted by sfx1999
It's the damage you need to look at.
Yes, that's what i found out. I'll try and go with the damage and have a look at this war3mod thing. Maybe it'll help.
  
Reply With Quote
Re: cs weapons modification
Old
  (#14)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: cs weapons modification - 12-09-2005

I hope this is not too late but I think you can find out when a HE grenade detonates by hooking pfnRemoveEntity and checking if edict_t*->classname is the grenade.
Its been a while since I played with CS so I'm not sure of the name.
What you could do is hook the pfnRemoveEntity function and log the entities passed to it to either the server log or your local console with CLIENT_PRINT.

Note, coded in the quick reply box - may not be accurate
Code:
void RemoveEntity( edict_t* pEntity ) {
   static char szClassname[ 64 ];

   if ( ! FNullEnt( pEntity ) ) {
	  _snprintf( szClassname, sizeof( szClassname ), "Entity %s being removed from the world!", STRING( pEntity->v.classname );
	  CLIENT_PRINTF( INDEXENT( 1 ), print_console, szClassname );
   }

   RETURN_META( MRES_IGNORED );
In game - throw a grenade and see what output you get.
  
Reply With Quote
Re: cs weapons modification
Old
  (#15)
BotUser
Member
 
Status: Offline
Posts: 39
Join Date: Jun 2004
Default Re: cs weapons modification - 12-09-2005

interesting ... thanks Lazy. Will check this out.

Meanwhile, I had a look at the AMX-X framework. Nice thing.
A lot can be done using their PAWN script language, and quite easily.
  
Reply With Quote
Re: cs weapons modification
Old
  (#16)
BotUser
Member
 
Status: Offline
Posts: 39
Join Date: Jun 2004
Default Re: cs weapons modification - 14-09-2005

Ok folks,

I think I almost made it. The HE grenades' strength in CS can now be adjusted at will.
Here's what I did:

- Intercepted "Damage" message to player entity
- checked pPlayer->v.dmg_inflictor for grenade entity
- if yes, then adjust pPlayer->v.health accordingly to do more damage
- send message to all other players about changed health

Don't do the last two steps if adjusting the health would result in
pPlayer->v.health <= 0.

And that's the problem. If, say, player health is 49, and health would be reduced by 50, I can't do it. I would have to let the player die.

How can one make a player die ? Is there something like pEntity->kill ?




  
Reply With Quote
Re: cs weapons modification
Old
  (#17)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: cs weapons modification - 14-09-2005

As far as I know it's impossible to inflict real damage to a player outside the mod unless you have the source.

Although, a while ago I posted an extremely cheap hack to cause real damage to entities.
It involved creating a trigger_hurt entity with the right settings and forcing the target player to touch it.

The one I posted on here had a few careless bugs that crept in due to lack of sleep but this one should work.

Code:
// Causes pain to someone by using a trigger_hurt to apply damage
// Params:
// pVictim	 - Who takes the damage
// pInflictor  - Who does the damage
// flAmount	- How much damage to do ( TRIGGER_HURT TAKES ARMOR INTO ACCOUNT! )
// iDmgmask	- See DMG_xxx macros, in cbase.h I think
// pszPainname - What should this pain be called? NULL leaves it at trigger_hurt
void Pain( edict_t* pVictim, edict_t* pInflictor, float flAmount, int iDmgmask, const char* pszPainname ) {
   char		   szKeyValue[ 32 ]; // Will contain iDmgmask as a string  
   edict_t*	   pEnt = NULL;	  // Trigger_hurt entity pointer
   KeyValueData   keyData;		  // Used to setup the damage type on the trigger_hurt entity

   // Create a trigger_hurt entity
   pEnt = CREATE_NAMED_ENTITY( MAKE_STRING( "trigger_hurt" ) );

   // Make sure it's valid
   if ( ! FNullEnt( pEnt ) ) {	
	  if ( pszPainname ) pEnt->v.classname = MAKE_STRING( pszPainname ); // Custom name! ( if set )
	  pEnt->v.dmg_inflictor = pInflictor;			 // Who's attacking me?
	  pEnt->v.owner = pInflictor;					 // ^^^^^
	  pEnt->v.dmg = flAmount;						 // Take this much damage ( note: goes by trigger_hurt rules! )
	  pEnt->v.dmg_take = 1.0f;					    // TODO: Figure out what this does... later
	  pEnt->v.dmgtime = 2.0f;						 // ^^^^^

	  // Somewhere out of the way
	  SET_ORIGIN( pEnt, Vector( -4000, -4000, -4000 ) );
	  SET_SIZE( pEnt, Vector( -32, -32, -32 ), Vector( 32, 32, 32 ) );

	  // Setup the damage type
	  _snprintf( szKeyValue, sizeof( szKeyValue ), "%d", iDmgmask ); // Setup value string
	  keyData.szClassName = ( char* ) pszPainname; // TODO: ??? 
	  keyData.szKeyName = "damagetype";		    // damagetype key
	  keyData.szValue = szKeyValue;			    // What kind of damage to do
	  keyData.fHandled = FALSE;				    // Not handled yet

	  // Set the key/value pair on the entity
	  MDLL_KeyValue( pEnt, &keyData );

	  // Spawn it and force it to touch us...
	  MDLL_Spawn( pEnt );
	  MDLL_Touch( pEnt, pVictim );

	  // So noone accidentally walks into it later on
	  REMOVE_ENTITY( pEnt );
   }
}
It does cause damage but I'm not 100% sure that the inflicting entity gets credit for it.
Good luck on your plugin.
  
Reply With Quote
Re: cs weapons modification
Old
  (#18)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: cs weapons modification - 14-09-2005

well if you look in the war3 mod it also simulates death of a player..
http://amxmod.net/showplugin.php?id=130081
search for do_damage
  
Reply With Quote
Re: cs weapons modification
Old
  (#19)
BotUser
Member
 
Status: Offline
Posts: 39
Join Date: Jun 2004
Default Re: cs weapons modification - 14-09-2005

Man, you guys are great, thanks for all the suggestions !

@Lazy:
That's exactly the point. I could kill a player by just calling MDLL_ClientKill, but then this looks like suicide for the player and the attacker doesn't get any credit. Just one line, works nicely, except for the credit situation.

@sPlOrYgOn:
I checked out that code. It's basically setting the health of the player accordingly, and setting a flag if player is dead (i. e. health <= 0).
But in this case, just setting health = 0 and killed = 1 is not sufficient.
I need to make the player die "naturally" in terms of the engine if I detect that healt <= 0.

There's a method TakeDamage for an entity, however I would need to make a CBasePlayer* or somethink like that out of the edict_t* I've got in order to call this.

There must be a way to do this, I'll keep searching ...
  
Reply With Quote
Re: cs weapons modification
Old
  (#20)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: cs weapons modification - 14-09-2005

You can get a CBaseEntity pointer from an edict_t pointer by calling CBaseEntity::Instance( edict_t* ).
BUT, don't expect it to work or not crash since almost every mod makes changes to the top of the CBaseEntity class which breaks compatibility by changing the positions of variables inside the class.
One exception is natural selection which does allow you to call CBaseEntity::TakeDamage.

I'll think for a bit and see if theres any way to cause damage to a player but as far as I know no other entities can have variable damage amounts.
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com