Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Small health kit made by attribute 203 isn't dropped to ground #168

Closed
M60TM opened this issue Feb 4, 2024 · 0 comments · Fixed by #174
Closed

[Bug] Small health kit made by attribute 203 isn't dropped to ground #168

M60TM opened this issue Feb 4, 2024 · 0 comments · Fixed by #174
Labels
bug Something isn't working

Comments

@M60TM
Copy link
Contributor

M60TM commented Feb 4, 2024

Description

It seems that the small health kit made by attribute 203 is designed to fall off the boss in a random direction.

Media

One screenshot will be enough to explain this bug.
image

More Information

int entity = CreateEntityByName("item_healthkit_small");
if(IsValidEntity(entity))
{
	DispatchKeyValue(entity, "OnPlayerTouch", "!self,Kill,,0,-1");
	DispatchSpawn(entity);
	SetEntProp(entity, Prop_Send, "m_iTeamNum", team);
	SetEntityMoveType(entity, MOVETYPE_VPHYSICS); // <- This line doesn't work.
	velocity[0] = GetRandomFloat(-10.0, 10.0);
	velocity[1] = GetRandomFloat(-10.0, 10.0);
	TeleportEntity(entity, position, _, velocity);
	SetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity", attacker);
}
void CTFPowerup::DropSingleInstance( Vector &vecLaunchVel, CBaseCombatCharacter *pThrower, float flThrowerTouchDelay, float flResetTime /*= 0.1f*/ )
{
//	SetSize( Vector(-8,-8,-8), Vector(8,8,8) );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetAbsVelocity( vecLaunchVel );	
	SetSolid( SOLID_BBOX );
	if ( flResetTime )
	{
		ActivateWhenAtRest( flResetTime );
	}

	m_bThrownSingleInstance = true;
	AddSpawnFlags( SF_NORESPAWN );

	SetOwnerEntity( pThrower );
	m_flThrowerTouchTime = gpGlobals->curtime + flThrowerTouchDelay;

	// Remove ourselves after some time
	SetContextThink( &CBaseEntity::SUB_Remove, gpGlobals->curtime + GetLifeTime(), "PowerupRemoveThink" );
}

I have a plan to fix this. However, there is something to choose from.

  1. SDKCall CTFPowerup::DropSingleInstance.
  2. Just setting movetype to MOVETYPE_FLYGRAVITY instead of MOVETYPE_VPHYSICS.
@M60TM M60TM added the bug Something isn't working label Feb 4, 2024
Batfoxkid pushed a commit that referenced this issue Feb 19, 2024
- Increased velocity to proper dispersal of medikit(too low to spread).
- I used `CTFPowerup::DropSingleInstance`. It's not good to chase game
updates with functions.
- `CTFPowerup::DropSingleInstance` has unique x-ref string
`"PowerupRemoveThink"`.

Fixes #168.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant