Pull Request
A_ChangeModel(string modeldef, int modelindex string modelpath, string model, int skinindex, string skinpath, string skin, int flags, int generatorIndex)
This can change the modeldef, model and skins of an actor.
You can add models to an actor to render by using generatorIndex to tell your new model index to copy the behavior of another one. You may only copy the behavior of a model index already defined in your actor's current modeldef. To remove a model or skin, just pass "" in model/skin parameter to revert to the default.
Available flags:
CMDL_WEAPONTOPLAYER - If used on a weapon, this instead change's the model on the player instead.
CMDL_HIDEMODEL - Hides the specified model index from rendering. Can be used with CMDL_WEAPONTOPLAYER.
CMDL_USESURFACESKIN - skinindex instead corresponds to the number of a surface to replace it's skin.
https://drive.google.com/file/d/1iz6_BT ... sp=sharing
Here is a test file. Let me explain the various things you can do with it:
Summon SwapModelDef - This shows off dynamically swapping modeldefs
Summon SwapModels - This shows off raw dynamic model swapping
Summon SwapSkins - This shows off raw dynamic skin swapping
Summon SwapModelsAndSkins - Dynamically swaps models and skins
Summon SwapModelsEdgeCase - No modeldef is defined, will not show any models even though a model and skin is given
Summon SwapModelsEdgeCase2 - It tries to switch to hammer, but has no modeldef. Therefore, it just shows up as a pistol sprite
Summon SwapModelsEdgeCase3 - It tries to switch to hammer, but has no modeldef. Therefore, it just shows up as a pistol sprite. But 1 second later, it will also use CMDL_HideModel. This draws a model at index 0, but it won't render.
Give TriggerSwapGun - This token changes the weapon view model and player third person gun model to show off the ideal usage of CMDL_WEAPONTOPLAYER
Give TriggerSwapPlayer - This token changes the player model.
Give TriggerUnSwapPlayer - This token changes the player model back to the default. Basically just a different way to revert to default without constantly forcing it.
Take TriggerSwapModel - This token reverts the player model and weapon view model back to default. This is where the bug I mentioned occurs, but can be circumvented by just manually stating the model to revert back to.
Switch to pistol - This makes the player's gun model no longer render.