How To Add New In Game Commands - SWG-Source/swg-main GitHub Wiki
=============================================================== Original discussion thread text for search result purposes:
SWGSOURCE FORUMS MARK FORUMS READ SEARCH FORUMS SUBSCRIBED FORUMS SUBSCRIBED THREADS NEW THREADS SHOWCASESWG FILESMEMBERSCHAT
Forums SWG NGE Source Server Development FAQ & Guides How To: Add New In-game Commands Discussion in 'FAQ & Guides' started by Cekis, Feb 23, 2018.
Subscribe to Thread Cekis Cekis Well-Known Member Joined:Sep 3, 2016 Messages:93 Likes Received:32 #1Cekis, Feb 23, 2018 Here's a quick guide on how to add new commands to the game.
Introduction
First, you need to know that the game delineates commands between Space and Ground differently. Each area has a separate "command set" and therefore space commands can't be used on the ground and ground commands can't be used in space. The only way this happens is with basic commands like "examine" and "say" or "yell". This guide does not cover adding new basic commands as there was clearly an intention by the SOE devs to focus separation between command sets as MOST commands are NOT in the basic set.
The Command Table
There are two tables on both the server side of things and the client side of things that handle commands in the game. The two tables are located in the same location: Code:Select All
GROUND: dsrc/sku.0/sys.shared/compiled/game/datatables/command/command_table.tab SPACE: dsrc/sku.0/sys.shared/compiled/game/datatables/command/command_table_space.tab To add a new command, you can copy an existing row and edit the new row to match your needs. The command table specifies when, where and how the command can be used (i.e. can you use it while dead? while stealthed? while I'm a blue glowie?) and also specifies what methods get called when the command is used in game. You can also choose either to add a C++ method or a Java method that gets executed when the command is used.
As these tables are used on the client side as well, you will need to duplicate anything you add to these tables to the client files as well. Use SIE to dig them up, use Excel to modify, or just copy/paste if you know they're the same (not recommended - be surgical about changes like this and hand-modify). The client files are located in the following structure: Code:Select All
GROUND: datatables/command/command_table.iff SPACE: datatables/command/command_table_space.iff Add Permission To Use The Command
Once you add the command to the tables, you will need to add the "skill" to use the command to the skills.tab file in both the server and the client side files. These files are located as follows: Code:Select All
SERVER: dsrc/sku.0/sys.shared/compiled/game/datatables/skill/skills.tab CLIENT: datatables/skill/skills.iff The skill needs to be added to the level you wish the player to be able to use the command. This is very handy as commands can then be based on player level, player profession or player certification. The skills table will not be covered here, but perusing it a bit you can see how it works and then devise a plan on how best to add your command and how best to dictate by who it can be used by. Once you determine this, you just add the command to the COMMANDS column (there will likely be a lot of other commands already in this column for the skill - just add the command to the end, separating it from the other commands with a comma).
Make the Code For the Command
Finally, you will need to make the code that gets executed when the command is executed in game. The command methods sit in a couple of different files, depending on which type of command it is (space or ground). Here are the locations of those files (for Java commands using the scriptHook column in command tables): Code:Select All
GROUND: dsrc/sku.0/sys.server/compiled/game/script/systems/combat/combat_actions.java SPACE: dsrc/sku.0/sys.server/compiled/game/script/space/combat/combat_ship_player.java The method name should match exactly the name you put in the scriptHook column for the command in the command table. This tells the server how to locate the method that gets called when the command is executed in game. The method will have 4 arguments given to it:
obj_id self - the Object ID of the player who is executing the command. obj_id target - the Object ID of the thing the player has targeted in game (if one is targeted or not - this requirement is handled in the command tables). String params - the text typed in AFTER the command: i.e. "/kill xyz" where the command is "kill" and the params will be "xyz". Note, this is basically ANY AND ALL text following the command itself - including spaces and other crapola. If you have multiple parts to your command, you will need to handle this value appropriately by splitting and such. float defaultTime - I'm not sure what this is and I could not find an example where it was being used - experiment.
Note: Your method MUST have this signature where is the name of your method: Code:Select All public int (obj_id self, obj_id target, String params, float defaultTime) { } Conclusion
If you have everything setup correctly, you will likely be ready to rock with your new command. If you need an example, I've added the "/spacebattlestatus" command with the upcoming Space GCW work that I've done. Be on the lookout for that and you'll be adding new commands in no time.
Happy Commanding! REPORT BOOKMARKLIKE + QUOTE REPLY Kosh, IrishDarkshadow and Vlakulor like this. Write your reply...
Write your reply...
Users Who Are Viewing This Thread (Users: 1, Guests: 0) Users Who Have Read This Thread (Total: 0) Share This Page ABOUT US Community for sharing and guides on how to get a SWG Server up and running. Our goal is to allow people to share information freely and publicly and to preserve that information.
QUICK JUMP Home About Forums Downloads USEFUL LINKS Alpha Delta Omega REGULATIONS Forum software by XenForo™ ©2010-2017 XenForo Ltd.
SWGSource Home Help Terms and Rules
===============================================================