コード例 #1
0
void CJaS_Marine_Jack::Spawn()
{
	CASW_Marine_Resource *pResource = dynamic_cast<CASW_Marine_Resource *>( CreateEntityByName( "asw_marine_resource" ) );
	pResource->SetProfileIndex( 6 );
	pResource->SetMarineEntity( this );
	SetMarineResource( pResource );
	pResource->Spawn();
	m_pProfileOverride = pResource->GetProfile();
	SelectModelFromProfile();
	SetModelFromProfile();

	CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>( CreateEntityByName( "asw_weapon_sniper_rifle" ) );
	if ( pWeapon )
	{
		pWeapon->Spawn();
		pWeapon->GiveDefaultAmmo();
		pWeapon->m_iClip1 = 9999;
		GiveAmmo(9999, pWeapon->GetPrimaryAmmoType());
		Weapon_Equip_In_Index( pWeapon, 0 );
		Weapon_Switch( pWeapon );
	}
	m_bConstantSlowHeal = true;

	m_hSquadFormation = static_cast<CASW_SquadFormation *>( CreateEntityByName( "asw_squadformation" ) );
	m_hSquadFormation->Leader( this );

	SetRenderColor( 0x99, 0x40, 0x40 );

	BaseClass::Spawn();
}
コード例 #2
0
void asw_marine_skill_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());	

	if (!ASWGameRules())
		return;
	if (!pPlayer)
		return;
	CASW_Game_Resource* pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	CASW_Marine_Profile *pProfile = NULL;
	CASW_Marine *pMarine = pPlayer->GetMarine();
	if (pMarine)
	{
		pProfile = pMarine->GetMarineProfile();
	}
	else
	{
		// find the first marine info that belongs to us
		for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
		{
			CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
			if (pMR && pMR->GetCommander() == pPlayer)
			{
				pProfile = pMR->GetProfile();
				break;
			}
		}
	}
	
	if ( !pProfile )
		return;

	if ( args.ArgC() < 2 )
	{
		Msg("Usage: asw_marine_skill [SkillSlot]  - reports the number of skill points of the current marine in that skill\n  asw_marine_skill [SkillSlot] [x]  - sets that skill to the specified number of skill points (0-5)\n");
		Msg("SkillSlot goes from 0 to 4 for your skills, slot 5 is spare skill points.\n");
		return;
	}

	int nSkillSlot = atoi(args[1]);
	if ( nSkillSlot < 0 || nSkillSlot >= ASW_NUM_SKILL_SLOTS )
	{
		Msg("nSkillSlot out of bounds\n");
		return;
	}

	if ( args.ArgC() < 3 )
	{
		int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot );
		Msg( "Marine skill[%d] is %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints );
	}
	else
	{
		int iNewPoints = atoi(args[2]);
		ASWGameResource()->SetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot, iNewPoints );	
		int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot );
		Msg( "Marine skill[%d] is now %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints );
	}
}