Difference between revisions of "Adding a Mod to a Gamemode"
Splittingred (Talk | contribs) (Created page with "Say you have a mod that wants to add some new functionality to a gamemode (not add a new Entity or Vehicle), like say a mod that allows for people to type !fireworks to get firew...") |
Splittingred (Talk | contribs) m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Say you have a mod that wants to add some new functionality to a gamemode (not add a new Entity or Vehicle), like say a mod that allows for people to type !fireworks to get fireworks in the sky. How would you add it? This tutorial explains how. | Say you have a mod that wants to add some new functionality to a gamemode (not add a new Entity or Vehicle), like say a mod that allows for people to type !fireworks to get fireworks in the sky. How would you add it? This tutorial explains how. | ||
− | First off, let's assume your mod's name is "fireworks", and contains a single file, "fireworks.as". Make sure your [[ | + | First off, let's assume your mod's name is "fireworks", and contains a single file, "fireworks.as". Make sure your [[Creating a Mod|mod is loaded]]. This means your file is at: |
<code>/Mods/fireworks/fireworks.as</code> | <code>/Mods/fireworks/fireworks.as</code> | ||
Line 30: | Line 30: | ||
(Note, if your script had been in /Mods/fireworks/Rules/fireworks.as, then you would put Rules/fireworks.as here, rather than just fireworks.as, since the path is relative.) | (Note, if your script had been in /Mods/fireworks/Rules/fireworks.as, then you would put Rules/fireworks.as here, rather than just fireworks.as, since the path is relative.) | ||
− | This will tell KAG to load your script after loading all the other scripts. From here you can use [[Hooks]] or functions or whatever you want to customize the gamemode functionality. | + | This will tell KAG to load your script after loading all the other scripts. From here you can use [[Hooks]] or functions or whatever you want to customize the gamemode functionality. The gamemode.cfg part that we edited should now look like this: |
+ | |||
+ | |||
+ | <syntaxhighlight lang="cpp" enclose="div"> | ||
+ | scripts = WAR.as; | ||
+ | WAR_Interface.as; | ||
+ | WAR_PickSpawn.as; | ||
+ | TimeToEnd.as; | ||
+ | RestartAfterShortPostGame.as; | ||
+ | ChatCommands.as; | ||
+ | Editor.as; | ||
+ | TeamMenuJustSpectator.as; | ||
+ | KillMessages.as; | ||
+ | SpawnTraders.as; | ||
+ | fireworks.as; | ||
+ | </syntaxhighlight> | ||
[[Category:Scripting]] | [[Category:Scripting]] |
Latest revision as of 23:07, 23 January 2013
Say you have a mod that wants to add some new functionality to a gamemode (not add a new Entity or Vehicle), like say a mod that allows for people to type !fireworks to get fireworks in the sky. How would you add it? This tutorial explains how.
First off, let's assume your mod's name is "fireworks", and contains a single file, "fireworks.as". Make sure your mod is loaded. This means your file is at:
/Mods/fireworks/fireworks.as
Second, go into the gamemode that you wish to edit. For this tutorial, we'll assume the WAR mode. Find the WAR's gamemode.cfg, in Base/Rules/WAR/gamemode.cfg.
Look for these lines (they may be a bit different, but the main part is finding the "scripts" variable:
WAR_Interface.as;
WAR_PickSpawn.as;
TimeToEnd.as;
RestartAfterShortPostGame.as;
ChatCommands.as;
Editor.as;
TeamMenuJustSpectator.as;
KillMessages.as;
SpawnTraders.as;
Simply add the relative path of your file from your mod's directory to the end of list of scripts to load:
(Note, if your script had been in /Mods/fireworks/Rules/fireworks.as, then you would put Rules/fireworks.as here, rather than just fireworks.as, since the path is relative.)
This will tell KAG to load your script after loading all the other scripts. From here you can use Hooks or functions or whatever you want to customize the gamemode functionality. The gamemode.cfg part that we edited should now look like this:
WAR_Interface.as;
WAR_PickSpawn.as;
TimeToEnd.as;
RestartAfterShortPostGame.as;
ChatCommands.as;
Editor.as;
TeamMenuJustSpectator.as;
KillMessages.as;
SpawnTraders.as;
fireworks.as;