Topic: [MODs] How to mod? C++ Tutorial for newbies
Introduction...
Hello everybody.
In this Topic i'll try my best to teach you how to create mods for Teeworlds.
At least you should know the Basics of C/C++: If/Else, For/While, Variables, Switch-Case... So, the Basics... and maybe functions and pointers
If not you better press Ctrl+T, type in youtube.com, then C++ Tutorial and then press Enter, choose any video and take an hour to learn the basics, it'll be easy if you have motivation...
You also need to know how to compile the source code (create an .exe), if not, take a look on my friend's compiling tutorial for Windows:
https://www.teeworlds.com/forum/viewtopic.php?id=9541/
To modify the Teeworlds source i recommend Microsoft Visual C++ 2010 Express Edition.
Ok let's start...
Maybe you've already took a look into the source and seen lots of files
I'll explain some important files, where you can gain visible success by changing only some parts:
...src\game\
variables.h - Here you're able to add rcon (F2) Commands
...src\game\server\
gamecontext.cpp - some server sided stuff, broadcast, explosion function
player.cpp - text you see in scoreboard ot this tee( Name, Score, Clan...)
...src\game\server\enteties\
character.cpp - lifehandling, armor, weapon,...
laser.cpp - Rifle settings
pickup.cpp - PickUps, respawntimer...
projectile.cpp - Lifetime of projectiles, explosion if needed, curvature, speed
...src\game\server\gamemodes\
~.cpp - Name of GameType, maybe some speacial stuff
First Code:
// ...src\game\server\gamemodes\dm.cpp
// in constructor we see m_pGameType = "DM";
// change it to: m_pGameType = "OwnMod"; the string will be displayed as gametype
// Remember: Not more than 7 symbols
CGameControllerDM::CGameControllerDM(class CGameContext *pGameServer)
: IGameController(pGameServer)
{
m_pGameType = "OwnMod";
}
Now compile it and see the quite little result...
I'll continue after school with Weapon modifications, because it's the easiest way to learn how to make mods and i guess almost everybody started like this.
Write down everything you want: Feedback, Corrections, Questions, Greeting, whatever...
...