Forum posts

Ok I found the issue, was connected to another part pf the code and not the Reload itself. Also I used the bits_COND_SPECIAL function that is also used in the HGRUNT to connect to my weapon to trigger the prone.
Now it is fine.
I gave monster_barney a reload-task and this is working well. However if Barney is reloading and gets to the monsterstate_prone (normally it means to be grabbed by a Barnacle, I am using this bit for a new weapon to 'freeze' the monster_barney), the reloading sequence is still finished although it should be interrupted (like when the monster is killed in that moment).

It works when I enter the 'bits cond damage' so it is kind of the right way I think. However I dont want to interrupt the reloding when damaged, only if the 'barnacle grab' happens:

Schedule_t slBARNEYReload[] =
{
{tlBARNEYReload,
ARRAYSIZE(tlBARNEYReload),

* bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE*

//"Reload"
},

There seems to be no bits_COND regarding the monsterstate_prone, entering the schedule does not work. I tried to put the 'stopnanimations' at the barnacle-grab, but it did not help either.

Little help please? :-)
Posted 3 months ago2024-01-07 21:05:05 UTC
in New item changes players speeds for movements Post #348423
No, guess I have to trick in the mapping to have the user not duck. Still the forwardspeed and centering the view which are important for me can be set via console.
If I put the console-commands in an own config that is triggered with a button but dont bind the button, can it still be triggered by an Entity? It should only be set for one specific map and not manuall by the player.
Posted 3 months ago2024-01-07 10:37:38 UTC
in New item changes players speeds for movements Post #348416
Nobody has an idea? :-( I saw there are some console-commands that would do the trick but it seems there is no way to make an entity (item) to trigger them. In Source there is the point_clientcommand but in Goldsource there is not. Is it possible to get this into my mod?
The prisoner flag can not be removed after a while. You should try to have the zombie execute a scripted sequence with an idle-animation. Once it is triggered, the sequence will stop and the Zombie will behave normal.
Or you build a full transparent box around it as a func_door and remove it when the zombie should start attacking.
Posted 3 months ago2024-01-03 11:31:25 UTC
in New item changes players speeds for movements Post #348392
Update: so I entered
pPlayer->pev->maxspeed = X;
and this works, but I need the ducktime, forwardspeed etc. and those dont work this way :-( Any idea what I have to do please?
Posted 3 months ago2024-01-02 10:22:18 UTC
in New item changes players speeds for movements Post #348385
As a non-coder to my own suprise I was able to clone the longjum-item to get a new item for the player to pick up. The effects should be a changing of players speeds and heights but I dont know how to do that :-(
The relevant part of the class in items.cpp looks like this:

{
pPlayer->m_fMYITEM = true; // player now has the Item
???
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev);
WRITE_STRING(STRING(pev->classname));
MESSAGE_END();
return true;
}

What do I need to enter for the ??? to change the cl_forwardspeed, flDuckTime etc please? I am unable to make the correct entries :-(
Maybe easier for beginning would be a func_door. Put the brush where it should be at the beginning (above the sicientist), make it a func_door with a name, downwoards-direction, a 100-damage when blocked, high movement-speed and set the flags to 'start open' and 'monster cant'. Depending on the size and position you need to try out which entry in LIP works best. Set another brush close to the player, make it a trigger_once and enter the name of the func_door as target. When the player passes through it, the func_door will move down and crash the scientist.
Posted 3 months ago2023-12-30 16:26:31 UTC
in Same Damage in Radius for grenade explosions Post #348376
I cloned the weapon_handgrenade for HL1 (Solokillers SDK) with all settings and want to have it only give 1 Damage in the whole radius of the explosion. The DMG-skill is to 1 and in the ggrenade.cpp I tried these two settings:

void CSTUNGrenade::Spawn()
{
pev->movetype = MOVETYPE_BOUNCE;
pev->classname = MAKE_STRING("grenade");

pev->solid = SOLID_BBOX;

SET_MODEL(ENT(pev), "models/grenade.mdl");
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
* pev->dmg = 100;*
m_fRegisteredSound = false;
}

and

CSTUNGrenade* CSTUNGrenade::ShootTimed(entvars_t* pevOwner, Vector vecStart, Vector vecVelocity, float time)
{
CSTUNGrenade* pSTUNGrenade = GetClassPtr((CSTUNGrenade*)NULL);
pSTUNGrenade->Spawn();
UTIL_SetOrigin(pSTUNGrenade->pev, vecStart);
pSTUNGrenade->pev->velocity = vecVelocity;
pSTUNGrenade->pev->angles = UTIL_VecToAngles(pSTUNGrenade->pev->velocity);
pSTUNGrenade->pev->owner = ENT(pevOwner);

pSTUNGrenade->SetTouch(&CSTUNGrenade::BounceTouch); // Bounce if touched

// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
// will insert a DANGER sound into the world sound list and delay detonation for one second so that
// the grenade explodes after the exact amount of time specified in the call to ShootTimed().

pSTUNGrenade->pev->dmgtime = gpGlobals->time + time;
pSTUNGrenade->SetThink(&CSTUNGrenade::TumbleThink);
pSTUNGrenade->pev->nextthink = gpGlobals->time + 0.1;
if (time < 0.1)
{
pSTUNGrenade->pev->nextthink = gpGlobals->time;
pSTUNGrenade->pev->velocity = Vector(0, 0, 0);
}

pSTUNGrenade->pev->sequence = RANDOM_LONG(3, 6);
pSTUNGrenade->pev->framerate = 1.0;

// Tumble through the air
// pGrenade->pev->avelocity.x = -400;

pSTUNGrenade->pev->gravity = 0.5;
pSTUNGrenade->pev->friction = 0.8;

SET_MODEL(ENT(pSTUNGrenade->pev), "models/w_grenade.mdl");
  • pSTUNGrenade->pev->dmg = 100;*
return pSTUNGrenade;
}


I tried different values but either the damage is high in the radius (like normal) or 0 in the radius but 1 at the center of explosion. Also the scale of the explosion (spr) is scaled bigger when the values are lower.

Is it possible to have the damage 1 in the whole radius no matter where and not automatically upscaling the spr?
Posted 1 year ago2023-01-03 20:29:30 UTC
in define new BITS_COND for monsters Post #347221
Thank you for your reply, I appreciate it.
Sorry I mixed definition and condition, I have no experience and do the 'learning by doing' approach ;-)
My idea was to set up the own definition and condition like 'Monster get hurt by slowfreeze-damage' to have it do a specific task. As I still cant find where the condition is set for Barney, I put an If-clause as a Workaround into the 'void TraceAttack' of the monster with the damagetype and so I am able to trigger the task I wanted :-)
Posted 1 year ago2022-12-29 18:36:57 UTC
in define new BITS_COND for monsters Post #347212
I want to set up an own condition, like for an NPC beeing damaged by a specific damage-type triggering a specific schedule. So I was trying to find the definitions of it, to add my own.

In the schedule.h I find for example
#define bits_COND_LIGHT_DAMAGE (1 << 8) // hurt a little
this condition is linked in several files like the scripted.cpp or monsterstate.cpp, however I can not find the definition for it. Like in this case, how much a 'light' damage is etc.

Where can I find and set up my own BITS_COND?

(Using Solokillers SDK).
If I remember correct there is a ‚fall‘ but no ‚land and dies‘-Animation for many npcs. So when the npc is done falling, you should have it execute a ‚die‘ Animation.
That should be a func_door_rotating with the origin-brush at the edge.
Posted 1 year ago2022-11-08 23:29:47 UTC
in Barney Reload stucks and does not fire Post #347063
Ok nevermind, I found the 'Extended Half Life' SDK and used it as reference, so after a re-design is working now:

void CBarney::HandleAnimEvent(MonsterEvent_t* pEvent)
{
switch (pEvent->event)
{
case BARNEY_AE_RELOAD:
...

Task_t tlBarneyReload[] =
{
{TASK_STOP_MOVING, (float)0},
{TASK_FACE_ENEMY, (float)0},
{TASK_PLAY_SEQUENCE, (float)ACT_RELOAD},
};
Schedule_t slBarneyReload[] =
{
{tlBarneyReload,
ARRAYSIZE(tlBarneyReload),
bits_COND_HEAVY_DAMAGE | bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Reload"},
};

case MONSTERSTATE_COMBAT:
...
if (m_cAmmoLoaded <= 0)
{
m_cAmmoLoaded = 2;
return GetScheduleOfType(SCHED_RELOAD);
}
...
Posted 1 year ago2022-11-07 19:31:29 UTC
in Barney Reload stucks and does not fire Post #347055
Hello, I am a total noob in C++ and try to do some 'easy' coding for a HL1-mod.
Currently I want to have Barney reload after 2 shots and after some try and error and the tutorial of Shepard62700FR (https://twhl.info/wiki/page/Monsters_Programming_-_Standard_and_Squad_Monsters#Reloading) I got him to do that but, after the reload-sequence, the model points the gun at the next enemy and freezes, no more shots are beeing fired.

Could someone please have a look and point me in the right direction?

In talkmonster.h I declerated the variable from the basemonste.h:
int m_cAmmoLoaded;

And as the initial filling works (Barney fires 2 shots because is spawned with it) *I suspect the issue to be either here:
*
void CBarney::HandleAnimEvent(MonsterEvent_t* pEvent )
{
switch ( pEvent->event )
{
case BARNEY_AE_RELOAD:
{
m_cAmmoLoaded = 2;
ClearConditions(bits_COND_NO_AMMO_LOADED);
break;
}
case BARNEY_AE_SHOOT:
{
BarneyFirePistol();
break;
}

case BARNEY_AE_DRAW:
// barney's bodygroup switches here so he can pull gun from holster
{
pev->body = BARNEY_BODY_GUNDRAWN;
m_fGunDrawn = true;
break;
}
case BARNEY_AE_HOLSTER:
{
// change bodygroup to replace gun in holster
pev->body = BARNEY_BODY_GUNHOLSTERED;
m_fGunDrawn = false;
break;
}
default:
CTalkMonster::HandleAnimEvent(pEvent);
}
}

or maybe here:

Schedule_t* CBarney::GetScheduleOfType(int Type)
{
Schedule_t *psched;
switch (Type)
{
case SCHED_RELOAD:
return slBarneyReload;

break;
...

class CBarney : public CTalkMonster
{
public:
void Spawn() override;
void Precache() override;
void SetYawSpeed() override;
int ISoundMask() override;
void BarneyFirePistol();
void AlertSound() override;
int Classify() override;
void HandleAnimEvent(MonsterEvent_t* pEvent) override;

void CBarney::CheckAmmo()
{
if (m_cAmmoLoaded <= 0)
SetConditions(bits_COND_NO_AMMO_LOADED);
}

Task_t tlBarneyReload[] =
{
{TASK_STOP_MOVING, (float)0},
{TASK_FACE_ENEMY, (float)0},
{TASK_PLAY_SEQUENCE, (float)ACT_RELOAD},

};

Schedule_t slBarneyReload[] =
{
{tlBarneyReload,
ARRAYSIZE(tlBarneyReload),
bits_COND_HEAVY_DAMAGE | bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Reload"
},
};

DEFINE_CUSTOM_SCHEDULES(CBarney){
...
slBarneyReload,
};

IMPLEMENT_CUSTOM_SCHEDULES(CBarney, CTalkMonster);

void CBarney::RunTask(Task_t* pTask)
{
switch (pTask->iTask)
{

case TASK_RELOAD:
{
if (pTask->iTask == TASK_RELOAD)
{
m_IdealActivity = ACT_RELOAD;
return;
}

case TASK_RANGE_ATTACK1:
if (m_hEnemy != NULL && (m_hEnemy->IsPlayer()))
{
pev->framerate = 1.5;
}
CTalkMonster::RunTask(pTask);
break;
default:
CTalkMonster::RunTask(pTask);
break;


CTalkMonster::RunTask(pTask);
}
}
}

void CBarney::BarneyFirePistol()
{
Vector vecShootOrigin;

UTIL_MakeVectors(pev->angles);
vecShootOrigin = pev->origin + Vector(0, 0, 55);
Vector vecShootDir = ShootAtEnemy(vecShootOrigin);

Vector angDir = UTIL_VecToAngles(vecShootDir);
SetBlending(0, angDir.x);
pev->effects = EF_MUZZLEFLASH;

FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, BULLET_MONSTER_357);
m_cAmmoLoaded--;
int pitchShift = RANDOM_LONG(0, 20);

// Only shift about half the time
if (pitchShift > 10)
pitchShift = 0;
else
pitchShift -= 5;
EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, "barney/ba_attack2.wav", 1, ATTN_NORM, 0, 100 + pitchShift);

CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);

}

Schedule_t* CBarney::GetSchedule()
{
{
case MONSTERSTATE_COMBAT:
{
...
if (HasConditions(bits_COND_NO_AMMO_LOADED))
return GetScheduleOfType(SCHED_RELOAD);

return CTalkMonster::GetSchedule();
}