Spellbook spawning when cart is pushed on Hightower Event?

  • If you're asking a question make sure to set the thread type to be a question!

oWave

L1: Registered
Jan 27, 2014
10
4
I'm trying to figure out how the spellbooks spawn from the carts on Hightower Event, mainly to figure out how the spellbook movement works for a sourcemod plugin.

There doesn't appear to be an entity that is responsible for spawning the spellbooks. They just spawn from the mapobj_cart_dispenser.

Is there some entity/input that I missed or is the spawning hardcoded?
 

Benoist3012

L3: Member
Dec 25, 2015
148
207
I can tell you It's hardcoded I never really spent time to look at which function spawns them, might do it tomorrow
 

oWave

L1: Registered
Jan 27, 2014
10
4
I can tell you It's hardcoded I never really spent time to look at which function spawns them, might do it tomorrow

Should you look at the spawning, could you send me the code for that function? All I would need are the EntProps that the spell pickups are spawned with.
 

Benoist3012

L3: Member
Dec 25, 2015
148
207
The function called is
Code:
CObjectCartDispenser::DropSpellPickup

I reversed the function from assembly to c++ for you:
Code:
public CSpellPickup CObjectCartDispenser::DropSpellPickup()
{
    CSpellPickup *pSellPickup;
    if (g_pGameRules->m_halloweenScenario == HELLTOWER_SCENARIO)//Yes this means only helltower can drop spells, unless you use a plugin and set m_halloweenScenario on 4
    {
        if (m_spawnflags & HEAL_DISGUISED_STEALTHED_SPIES)
        {
            CalcAbsolutePosition();
        }
        pSellPickup = g_pGameRules->DropSpellPickup(m_vecAbsOrigin, 0); //(CTFGameRules::DropSpellPickup)
    }
}

public CSpellPickup CTFGameRules::DropSpellPickup(const Vector *vecPosition, int iSpellTier)
{
    CSpellPickup *pSellPickup;
    if ( IsUsingSpells() )
    {
        //Some vecpostion changes not really important
        CBaseEntity *pEntity = CBaseEntity::CreateNoSpawn("tf_spell_pickup", vecPosition, vec3_angle, 0);
        pSellPickup = (CSpellPickup *)pEntity;
        if ( pSellPickup )
        {
            pSellPickup->m_nTier = iSpellTier;
            DispatchSpawn(pSellPickup);
            Vector *vecVelocity;
            //Velocity calculation crap
            CTFPowerup::DropSingleInstance((CTFPowerup *)pSellPickup, vecVelocity, 0, 0.0, 0.1);
        }
    }
  }
  return pSellPickup;
}

public void CTFPowerup::DropSingleInstance(Vector *vecVelocity, CBaseCombatCharacter *pPlayer, float flSomething, float flSomething2)
{
    //Begining of CTFPowerup::DropSingleInstance
    //Only that part is interesting
    SetMoveType(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE);
    SetAbsVelocity(vecVelocity);
    //Something stored at 368
    pSomething->SetSolid(SOLID_BBOX);
}