Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
  • Announcements

    • randomperson139

      Signatures   03/04/2016

      Hi everyone. It appears that the update to the new forum has affected the format of the majority of signatures (adding extra spaces, changing sizes etc.). Due to this, could everyone please check their own signature, ensuring that it complies with the site rules. See the http://www.emergency-planet.com/tos.html/ or http://www.emergency-planet.com/topic/16848-acceptable-signature-sizes/ for more information.  We'll give it a few weeks to give enough time to edit signatures, after that the unnecessarily large signatures will simply be removed. Thanks for your cooperation. Regards, EMP Staff.
Sign in to follow this  
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi Killerconsti,

Thank you for your extensive answer. Right now I don't have the ability to test it out, but I do think I understand now. I will try it out as soon as possible.

 

Thanks once again!

 

Regards,

ItsLeandro

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×