Is it possible to make a monster follow another monster? Created 3 months ago2019-10-03 11:51:38 UTC by abbadon abbadon

Created 3 months ago2019-10-03 11:51:38 UTC by abbadon abbadon

Posted 3 months ago2019-10-03 11:51:38 UTC Post #343184
I know scientists do, but, would not it be troublesome for monsters spawned by monstermakers?
Posted 3 months ago2019-10-03 21:22:50 UTC Post #343185
I think it's possible.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 months ago2019-10-03 23:10:00 UTC Post #343186
A monster following another monster? Like, actively? I'm not sure that you could. Unless you faked it or the monster was trying to kill the other...
Jessie JessieTrans Rights <3
Posted 3 months ago2019-10-04 09:52:50 UTC Post #343187
Abbadon has coding powers, so of course it's possible. The scientist class has a follow task&schedule:
User posted image
And it's handled somewhere in the GetSchedule function:
User posted image
Keep in mind that this is scientist-specific, so you don't necessarily have to make your monsters heal each other. But you can. :D

If you base your monster off CTalkMonster, I believe you could get such monsters (that are spawned by a monstermaker) to follow a certain thing:
User posted image
You can call StartFollowing and pass it the entity you need the monster to follow. I'm not exactly sure what approach you're going for, but I think this is approximately what you need to follow a monster. :)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 months ago2019-10-04 13:57:36 UTC Post #343188
Ok, Admer!! but remember that I struggle even with the "Hello World" program :walter: ha, ha!!! I will try to implement those parts into the infantry coder (monster_gunner.cpp).

Thanks! :crowbar:
Posted 2 weeks ago2020-01-05 23:04:44 UTC Post #343560
:crowbar: Done!!, but game crash each time the monster spawns... :pwned:

HereĀ“s all the code. Forgive me if I did not rename the Islave monster from CIslave to CGunner :lol:

I have modified its relationship:
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int    CISlave :: Classify ( void )
{
    return    CLASS_PLAYER_ALLY;
}


int CISlave::IRelationship( CBaseEntity *pTarget )
{

    if ( FClassnameIs( pTarget->pev, "monster_sentinel" ) )
    {
        return R_NM;
    }
    if ( FClassnameIs( pTarget->pev, "player" ) )
    {
        return R_AL;
    }
    if ( FClassnameIs( pTarget->pev,  "monster_trolley" ) )
    {
        return R_HT;
    }


    return CBaseMonster::IRelationship( pTarget );
}
wrote the new code:
//=========================================================
// Codigo para seguir a los Trolley
//=========================================================

Task_t    tlFollow[] =
{
//    { TASK_SET_FAIL_SCHEDULE,    (float)SCHED_CANT_FOLLOW },    // If you fail
    { TASK_MOVE_TO_TARGET_RANGE,(float)640        },    // Move within 640 of target ent (monster_trolley)
//    { TASK_SET_SCHEDULE,        (float)SCHED_TARGET_FACE },
};

Schedule_t    slFollow[] =
{
    {

        tlFollow,
        ARRAYSIZE ( tlFollow ),
        bits_COND_NEW_ENEMY |
        bits_COND_LIGHT_DAMAGE |
        bits_COND_HEAVY_DAMAGE |
        bits_COND_HEAR_SOUND,
        bits_SOUND_COMBAT |
        bits_SOUND_DANGER,
        "Follow"
    },
};
Of course I have definded all...
DEFINE_CUSTOM_SCHEDULES( CISlave )
{
    slSlaveAttack1,
    slSlaveEstablishLineOfFire,
    slFollow,
};
And in:
Schedule_t *CISlave :: GetSchedule( void )
I placed:
//=================================================
// He follows who he hates...
//=================================================
    if ( HasConditions (bits_COND_SEE_HATE ) )
    {
        return  slFollow;
    }
 //=================================================
Also I put the "follow" thing in:
Schedule_t *CISlave :: GetScheduleOfType ( int Type )
{
    switch    ( Type )
    {
    case SCHED_FAIL:
        slSlaveEstablishLineOfFire;//ZWC
     case SCHED_RANGE_ATTACK1:
        return slSlaveAttack1;
    case SCHED_TARGET_CHASE:
        return slFollow;
    }
    return CSquadMonster :: GetScheduleOfType( Type );
}
Posted 2 weeks ago2020-01-06 14:33:07 UTC Post #343565
BTW: if I comment THIS part...
//=================================================
        if ( HasConditions (bits_COND_SEE_HATE ) )
        {
            return  GetScheduleOfType( SCHED_TARGET_CHASE );
        }
     //=================================================
...the game runs perfect. The gunners attack the Trolley guy, yes, but the game does not crash at all. :|
Posted 2 weeks ago2020-01-07 01:31:42 UTC Post #343566
You can format code blocks like this, FYI:
```
code goes here
```
Penguinboy PenguinboyHaha, I died again!
Posted 2 weeks ago2020-01-07 15:20:55 UTC Post #343568
THANKS so much Penguinboy, In the formatting options the code was enclosed in this singns code, and it look awful (sorry), but did not look into the Formatting Help link, moron me. :crowbar:
Posted 2 weeks ago2020-01-08 20:40:19 UTC Post #343574
Aniway... Any ideas on how to solve this? I have surrender some hours ago... I mean: how can I make the gunners follow the trolley guy without crashing the whole game. My compile is Win32_release not debug, so I cannot debug a thing, also, I am not able to setup the projects correctly to be Win32_debug instead (each time I did it I find myself with a ton of errors and "thiscall", "unknown stuff" etc.

PS: I have tried the tracktarget method of the Hornet and, no, it still crashes the game. :)
Posted 2 weeks ago2020-01-12 07:23:15 UTC Post #343600
I think you should be able to debug a release build if the .pdb file is in the same directory as the .dll?
Anyway, you should copy your changes into a clean project so that things are set up correctly (probably too hard to recreate Debug - I'm sure Visual Studio takes care of a lot of stuff).
You must be logged in to post a response.