Thread: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

Results 1 to 8 of 8
  1. #1
    Just another co-op player Maestro Fénix's Avatar
    Join Date
    Dec 2012
    Location
    Spain
    Posts
    362

    (Updated) Help me complete my HGrunt port!!!

    I'm porting the HGrunt to AS, and for the moment everything seems going well. However I found several methods which I can't find an equivalent at the docs. If you guys could help me with this, I would be thankful.

    SENTENCEG_PlayRndSz( ENT(pev), "HG_CLEAR", HGRUNT_SENTENCE_VOLUME, ATTN_NORM, 0, m_voicePitch );
    *Vector vecToss = VecCheckToss( pev, GetGunPosition(), vecTarget, 0.5 );
    Vector vecToss = VecCheckThrow( pev, GetGunPosition(), vecTarget, gSkillData.hgruntGrenadeSpeed, 0.5 );
    if ( FClassnameIs( pTarget.pev, "monster_alien_grunt" ) || ( FClassnameIs( pTarget.pev, "monster_gargantua" ) ) )
    if (g_Engine.time <= CTalkMonster::g_talkWaitTime)
    if ( FBitSet( self.pev.weapons, HGRUNT_9MMAR ) )
    Last edited by Maestro Fénix; 13-01-2017 at 02:43 PM.


    Here we go again

  2. #2
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,594

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    Code:
    if ( FClassnameIs( pTarget.pev, "monster_alien_grunt" ) || ( FClassnameIs( pTarget.pev, "monster_gargantua" ) ) )
    
    =
    
    if ( pTarget.pev.classname == "monster_alien_grunt" || pTarget.pev.classname == "monster_gargantua"  )
    Code:
    if (g_Engine.time <= CTalkMonster::g_talkWaitTime)
    
    =
    
    if (g_Engine.time <= this.g_talkWaitTime) // You have to manage this var yourself. CTalkMonster was removed from AS some time ago.
    Code:
    if ( FBitSet( self.pev.weapons, HGRUNT_9MMAR ) )
    
    =
    
    if ( self.pev.weapons & HGRUNT_9MMAR != 0 )
    Not sure if you wanted these ported or if you couldn't find where they're defined. I just searched the SDK on github:

    VecCheckToss

    VecCheckThrow

    PlayRndSz looks like PlaySentenceGroup.
    Love,
    w00tguy

  3. #3
    Just another co-op player Maestro Fénix's Avatar
    Join Date
    Dec 2012
    Location
    Spain
    Posts
    362

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    Thank you. I'm almost complete with the port. However, there are some bugs and I'm running out of free time again to finish the code, so I will upload here. Hopefully you guys will be able to track down the mistakes I may did and make it working.

    I'm including the AS log as a complete console dump so you guys can see directly where the game whines at.

    Resumed list of bugs:

    -Object handle is not supported for this type

    -Name conflict. 'pGruntSentences' is an object property.

    -No matching signatures to 'ScriptSchedule(int, string)'

    -'bits_COND_GRUNT_NOFIRE' is not declared

    -'m_fEnemyEluded' is not a member of 'CBaseMonster'

    -'g_talkWaitTime' is not a member of 'CBaseMonster'

    -'TASKSTATUS_RUNNING' is not declared

    -No matching signatures to 'CBaseMonster::FacingIdeal()'

    -'TASKSTATUS_COMPLETE' is not declared

    -Illegal operation on this datatype

    -'flags' is not a member of 'EHandle'

    -'absmin' is not a member of 'EHandle'

    -'origin' is not a member of 'EHandle'

    -No matching signatures to 'EHandle::BodyTarget(Vector)'

    -gSkillData' is not a member of 'CBaseMonster'

    -No matching signatures to 'CBaseMonster::InSquad()'

    -No matching signatures to 'SquadMemberInRange(Vector, const int)'

    -No matching signatures to 'CSoundEngine::PlaySentenceGroup(edict_t@&, string, const float, const string&, const int, int&)'

    -Type 'char' doesn't support the indexing operator

    - Use of uninitialized global variable 'slGruntTossGrenadeCover'.
    The errors related with the scripted schedules are really strange to me. I have been declared them like it is in monster_th_cyberfranklin.as, but they aren't recognized.
    Attached Files Attached Files


    Here we go again

  4. #4
    begadang jangan begadang =_= anggara_nothing's Avatar
    Join Date
    Jan 2016
    Location
    Indonesia
    Posts
    155

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    bits_COND_GRUNT_NOFIRE is a custom variable;
    You need to declared it like original valve hgrunt code ( bits_COND_SPECIAL1 )

    https://github.com/ValveSoftware/hal...grunt.cpp#L121

    or here's the quick fix:
    Code:
    int g_iSkillLevel = g_EngineFuncs.CVarGetFloat("skill");
    
    enum ENUM_SKILL {
    	SKILL_EASY		= 1,
    	SKILL_MEDIUM	= 2,
    	SKILL_HARD		= 3
    };
    
    //=========================================================
    // Scheduling 
    //=========================================================
    
    enum ENUM_TASKSTATUS {
    	TASKSTATUS_NEW				= 0,			// Just started
    	TASKSTATUS_RUNNING			= 1,			// Running task & movement
    	TASKSTATUS_RUNNING_MOVEMENT	= 2,			// Just running movement
    	TASKSTATUS_RUNNING_TASK		= 3,			// Just running task
    	TASKSTATUS_COMPLETE			= 4				// Completed, get next task
    };
    
    // Monster Spawnflags
    const int SF_MONSTER_GAG		= 2;			// no idle noises from this monster
    
    // HUMAN GRUNT SLOTS
    const int bits_SLOT_HGRUNT_ENGAGE1	= ( 1 << 0 );
    const int bits_SLOT_HGRUNT_ENGAGE2	= ( 1 << 1 );
    const int bits_SLOTS_HGRUNT_ENGAGE	= ( bits_SLOT_HGRUNT_ENGAGE1 | bits_SLOT_HGRUNT_ENGAGE2 );
    
    const int bits_SLOT_HGRUNT_GRENADE1	= ( 1 << 2 );
    const int bits_SLOT_HGRUNT_GRENADE2	= ( 1 << 3 );
    const int bits_SLOTS_HGRUNT_GRENADE	= ( bits_SLOT_HGRUNT_GRENADE1 | bits_SLOT_HGRUNT_GRENADE2 );
    
    //=========================================================
    // monster-specific conditions
    //=========================================================
    const int bits_COND_GRUNT_NOFIRE	= bits_COND_SPECIAL1;
    And HGrunt code is inherited from SquadMonster so im not really sure it's working with BaseMonster without recreating the whole code.
    Last edited by anggara_nothing; 13-01-2017 at 10:43 PM.

  5. #5
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,594

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    Even if it wasn't inheriting from SquadMonster, there are a lot of functions in BaseMonster that aren't accessible either (like anything to do with Conditions). It seems to me that completely rewriting the monster AI from scratch is the only way to correctly recreate the default monsters. That's a huge chore, especially considering the navigation/pathing functions aren't available either.
    Love,
    w00tguy

  6. #6
    begadang jangan begadang =_= anggara_nothing's Avatar
    Join Date
    Jan 2016
    Location
    Indonesia
    Posts
    155

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    Quote Originally Posted by w00tguy123 View Post
    ... especially considering the navigation/pathing functions aren't available either.
    Does custom NPC obey map waypoints (info_node)?

  7. #7
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,594

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    If you use the default Think function (or at least call BaseClass.Think() in yours), they should navigate normally with nodes. Otherwise it's up to you to generate a node graph, implement A* for path finding, and do some collision avoidance.

    It might be possible to just use the default AI and implement the "conditions" parts yourself. Hopefully you wouldn't be fighting the default AI doing that (among other things).
    Love,
    w00tguy

  8. #8
    Just another co-op player Maestro Fénix's Avatar
    Join Date
    Dec 2012
    Location
    Spain
    Posts
    362

    Re: SENTENCEG_PlayRndSz, VecCheckToss and others. Any equivalent in AS?

    We still without having access to some parts of the AI? Damm...


    Here we go again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •