Jump to content
ItsLeandro

Implementing new commands

Recommended Posts

Hey all,

I am busy with developing a modification for Emergency 5, but I am experiencing a few issues. I have been coding some new commands for units, but I have no idea how to implement them in the game.

So my question is, does anyone of you know, how to move (modified/new) commands (from the SDK) into a modification/project?

Thanks in advance.

Link to comment
Share on other sites

Well basicly 3 steps:

 

a) declare all commands that you want to export in your  plugin.cpp file.

            QSF_START_CAMP_CLASS_EXPORT(user::CheerCommand, "CheerCommand", "Cheer command")
                QSF_GAME_CAMP_IS_COMMAND
                QSF_END_CAMP_CLASS_EXPORT

b) Tell the game which plugins need to be loaded

this is done in the project.json as example here is the one from the minimod. The thing that needs to be added is the "Plugin(s)"-Section

{
    "Format": {
        "Type": "Project",
        "Version": "1"
    },
    "Properties": {
        "Name": "killerconstis_mini_mod",
        "Locked": "false",
        "Version": "3.2",
        "Author": "Consti",
        "Description": "The only real mod right now"
    },
    "AssetPackages": [
        "content",
        "local",
        "required_files",
        "language_de"
    ],
    "Plugins": {
        "minimod_plugin": "em5_game em5_editor",
        "misc_crew_minimod_edition": "em5_game em5_editor"
    }
}

your *.dll file must be at your_mod_direction/x64/ . The easiest way is to declare this as your target direction in VS2015

c) use your commands ingame

select the em5::CommandableComponent and add your Command into the array. For the example above it would be

[user::CheerCommand] (in the editor)

or "user::CheerCommand", if you directly edit the *.json file

For testing it is usefull to set the playerId in the CommandableComponent to "0", this makes the unit belonging to player 1.

 

If you still have problems, I recommend to have a look into the *.log files or the SamplePlugin+Samplemod with the CheerCommand/CheerAction/Observer/Event

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...