A_ChangeModel

void A_ChangeModel (name modeldef [, int modelindex [, string modelpath [, name model [, int skinindex [, string skinpath [, name skin [, int flags [, int generatorindex [, int animationindex [, string animationpath [, name animation]]]]]]]]]]])

(New from 4.10.0)

Usage

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. This does not actually generate any modeldef data, but does instruct the index to copy the behavior of the index you put for generatorindex. As a result, 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 "" to modeldef/model/skin parameter to revert to the default.

Parameters

  • modeldef: This is the MODELDEF this actor will now load. The default modeldef can be restored with "".
  • modelindex: This is the model index where the new model should be attached or replaced. Default is 0.
  • modelpath: This is the path for where to locate the new model. Default is "".
  • model: This is the file name of the new model. The extension is required. "" can be used to restore the default model for this index. Default is "".
  • skinindex: This index specifies which model index must change it's skin. Default is 0.
  • skinpath: This is the path for where to locate the new skin. Default is "".
  • skin: This is the file name of the new skin. The extension is required. "" can be used to restore the default skin for this index. Default is "".
  • flags: Allows the alteration of the function's behavior. The following flags can be combined by using the | character between the constant names:
    • 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. Useful to temporary hide part of the model. Can be used with CMDL_WEAPONTOPLAYER.
    • CMDL_USESURFACESKINskinindex instead corresponds to the index of a surface to replace its skin.
Default is 0.
  • generatorindex: Instructs the model in modelindex to copy frame data from this index. Default is -1, which will not copy frame data from any index. Useful for attaching models with similar frames, like a gun to a player model.
  • animationindex: This index specifies where the new animation should be attached or replaced. Default is 0. (New from 4.10.0)
  • animationpath: This is the path for where to locate the new animation clip. Default is "". (New from 4.10.0)
  • animation: This is the file name of the new animation clip. The extension is required. "" can be used to restore the default animation for this index. Default is "". (New from 4.10.0)

Examples

This actor alternates modeldefs every second.

actor SwapModelDef
{
    Height 16
    Radius 8

    States
    {
    Spawn:
        PIST A 35
        TNT1 A 0 A_ChangeModel("SwapModelDefHelper")
        PIST A 35
        TNT1 A 0 A_ChangeModel("SwapModelDef")
        Loop
    }
}

Another useful function of A_ChangeModel is the ability to change the player's appearance from the weapon itself. Note that index 0 represents the player model, while index 1 is attaching a gun to the player model.

actor NewPistol : Pistol replaces Pistol
{
    States
    {
    Ready:
        PISG A 0 A_ChangeModel("", 1, "Models", "w_blaster.md2", 1, "Models", "g_blaster.png", CMDL_WEAPONTOPLAYER, 0)
        PISG A 1 A_WeaponReady
        Wait
    }
}
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.