Create Mobile

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
MasonFace
Posts: 355
Joined: Tue Nov 27, 2018 7:28 pm
Contact:

Create Mobile

Post by MasonFace » Thu Apr 04, 2019 10:38 pm

I'm trying to use the console command "CM" to instantiate an enemy, but I can't seem to get it to work.

It keeps saying "Invalid mobile ID" regardless of what format I use. It looks like in DFTFU, the enemies use the format [Rat] for example, but that doesn't seem to work with CM. I've tried it as "CM Rat", "CM [Rat]", and even "CM [255]". I've tried it with and without the second argument. Nothing seems to work.

Any idea what I'm doing wrong?

User avatar
Interkarma
Posts: 5035
Joined: Sun Mar 22, 2015 1:51 am

Re: Create Mobile

Post by Interkarma » Thu Apr 04, 2019 10:44 pm

The parameter should be the index of the enemy you want to create. So "cm 0" will create a Rat, "cm 4" will create a GrizzlyBear, and "cm 128" will create a Mage.

The enemy index is pulled from MobileTypes enumeration (which just maps to the classic enemy indices). Here it is in full.

Code: Select all

public enum MobileTypes
    {
        // Monster IDs are 0-42
        Rat,
        Imp,
        Spriggan,
        GiantBat,
        GrizzlyBear,
        SabertoothTiger,
        Spider,
        Orc,
        Centaur,
        Werewolf,
        Nymph,
        Slaughterfish,
        OrcSergeant,
        Harpy,
        Wereboar,
        SkeletalWarrior,
        Giant,
        Zombie,
        Ghost,
        Mummy,
        GiantScorpion,
        OrcShaman,
        Gargoyle,
        Wraith,
        OrcWarlord,
        FrostDaedra,
        FireDaedra,
        Daedroth,
        Vampire,
        DaedraSeducer,
        VampireAncient,
        DaedraLord,
        Lich,
        AncientLich,
        Dragonling,
        FireAtronach,
        IronAtronach,
        FleshAtronach,
        IceAtronach,
        Horse_Invalid,              // Not used and no matching texture (294 missing). Crashes DF when spawned in-game.
        Dragonling_Alternate,       // Another dragonling. Seems to work fine when spawned in-game.
        Dreugh,
        Lamia,

        // Humanoid IDs are 128-146
        Mage = 128,
        Spellsword,
        Battlemage,
        Sorcerer,
        Healer,
        Nightblade,
        Bard,
        Burglar,
        Rogue,
        Acrobat,
        Thief,
        Assassin,
        Monk,
        Archer,
        Ranger,
        Barbarian,
        Warrior,
        Knight,
        Knight_CityWatch,           // Just called Knight in-game, but renamed CityWatch here for uniqueness. HALT!

        // No enemy type
        None = (int)0xffff,
    }

User avatar
MasonFace
Posts: 355
Joined: Tue Nov 27, 2018 7:28 pm
Contact:

Re: Create Mobile

Post by MasonFace » Thu Apr 04, 2019 10:54 pm

Ah! Thank you so much InterKarma!

User avatar
King of Worms
Posts: 2552
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Create Mobile

Post by King of Worms » Mon Apr 08, 2019 11:42 am

Its a nice feature for a battles and testing.
If we had a option to lets say type:

cm 4 x100

to spawn 100 creatures... that would be quite handy for a loads of fun and epic "x VS y" battles ;)

PS: Dont take it as a demand pls, just a idea, maybe someone picks it up laters

Post Reply