View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-21-2014 , 14:42   Re: [TF2] Biohazard [0.0.0.1] [20/04/14]
Reply With Quote #7

Speaking of the zombie skins thing that we were discussing over on Reddit... it might be possible to create new zombie models by taking the current class models and modifying them... then merging the zombie soul items into them (because part of the model is stored in them).

I'm not sure how Valve would react to that, though. Then again, VSH uses a modded HHH model with a weapon attached to it and Valve didn't say anything about that...

A few other things...

Code:
// This one's currently unknown (SM API page says Engineer building?)
Slot 5 for Engineer is the tf_weapon_builder entity. This is the entity that actually constructs/destructs things (the Spy's stock Sapper is also a tf_weapon_builder, although the Red Tape Recorder is a tf_weapon_sapper instead). Both the Construction/Destruction tools and the build/destroy commands cause this to do things. In other words, destroying the Construction and Destruction tools will not stop an Engineer from building/destroying things via the console.

I notice you're referencing a g_GameRules entity. As people have pointed out to me before, any time you store an entity index in a global variable, you should use EntIndexToEntRef on it first.

However, since the GameRules entity should always exist, you could do something like this using SDKHooks:

PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"tf_gamerules"))
    {
        
g_GameRules EntIndexToEntRef(entity);
    }

This will save the gamerules entity any time it spawns.

Note that you should use EntRefToEntIndex and check if the returned value is INVALID_ENT_REFERENCE to make sure the entity still exists before using it.

Now, as for round timers... you can also create and/or manipulate the "team_round_timer" entity/entities on a map to change setup or round time. Most map modes have a single team_round_timer. KOTH has two. Arena has none by default unless tf_arena_round_time is greater than 0. PLR may or may not have one, but the only official map that has one doesn't end the round based on it (plr_nightfall). TC maps tend to have at least three (one for the middle rounds, two for the final rounds because they have different OnFinished conditions).

Koth's two are a problem as they also appear on the HUD. You'll need to block the tf_logic_koth entity from spawning using SDKHooks, because it in in turn spawns the two timer entities. Then, you can create your own timer and do things as appropriate.

You can add or modifying setup time to an existing team_round_timer in an SDKHook_Spawn Hook by using DispatchKeyValue on the "setup_length" property.

If you need to see how to create a team_round_timer entity and what you need to set for it, you can see what PropHunt Redux does. PropHunt Redux spawns the team_round_timer when the team_control_point_master entity is spawned, which doesn't apply to game modes that don't use them (CTF mainly, but it's technically not required for TC and possibly KOTH).

You can hook the OnFinished output via HookEntityOutput or HookSingleEntityOutput... that is assuming you want to call RoundWinWithCleanup rather than directly calling the team_control_point_master's SetWinner input (which is what PropHunt Redux does). Note that you may also want to HookSingleEntityOutput on its OnSetupFinished output just in case you run into buggy maps that have more than one timer running (ph_kakariko_a3 has this for PropHunt).

Ugh, this has already run on too long.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-21-2014 at 14:44.
Powerlord is offline