Tremulous Forum
Mods => Modding Center => Topic started by: Lonly on October 17, 2008, 09:08:38 pm
-
Follow these steps on coding a QVM on Microsoft Windows XP.
RECENTLY UPDATED ON DECEMBER 24, 2009
Before anything, read and follow "The short and sweet guide to compiling SVN 895 on Windows (http://tremulous.net/forum/index.php?topic=3408.0)", by Risujin (NOTE: DO NOT DO A SVN CHECKOUT USING MSYS)
For some people MSYS has a bug where is opens, then closes, it means your msys-1.0.dll is out dated, your computer's RAM is out of space, or you have a(n) old Operating System. Google a(n) updated msys-1.0.dll, buy a larger RAM, or buy Windows 7. Delete your current msys-1.0.dll from C:\msys\bin and then replace it with the one you download from source files. This recently usually occurs on Windows XP.
Make sure you installed:
(http://tortoisesvn.tigris.org/tortoisesvn_logo_hor468x64.PNG) (http://tortoisesvn.tigris.org/)
(http://subversion.tigris.org/images/subversion_logo_hor-468x64.png) (http://subversion.tigris.org/)
(http://jeez.eu/wp-content/uploads/2009/09/568395745.png) (http://notepad-plus.sourceforge.net/uk/site.htm)
MinGW (http://www.mingw.org/)
Msys (http://www.mingw.org/wiki/msys)
Now lets get started...
TortoiseSVN
- Restart your PC
- Right click your desktop and click SVN Checkout
(http://funleaked.net23.net/guides/QVM/TortoiseSVN/rightclick.jpg) - A screen will pop up, fill in the information with the following:
(http://funleaked.net23.net/guides/QVM/TortoiseSVN/checkout.jpg) - Press Ok and wait until the checkout is finished (Completed At revision: ####)
- Click Ok
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Opening Files
- Open My Computer (http://funleaked.net23.net/guides/QVM/TortoiseSVN/compdesktop.jpg) then click (DRIVE NAME)(C:) [EXAMPLE (http://funleaked.net23.net/guides/QVM/TortoiseSVN/drive.jpg)]
- Click (http://funleaked.net23.net/guides/QVM/TortoiseSVN/tremfolder.jpg), then (http://funleaked.net23.net/guides/QVM/TortoiseSVN/srcfolder.jpg), then (http://funleaked.net23.net/guides/QVM/TortoiseSVN/gamefolder.jpg), then open (http://funleaked.net23.net/guides/QVM/TortoiseSVN/g_admincfile.jpg) with Notepad++ [EXAMPLE (http://funleaked.net23.net/guides/QVM/TortoiseSVN/admincnotepad.jpg)] if Notepad++ is not in recommended programs to open it with, browse it:
[/list]C:\Program Files\Notepad++\notepad++.exe
To jump to a line in Notepad++ go to the Search tab on the top, then click Go To...
(NOTE: IF YOU CHANGE ANYTHING REMEMBER TO COPY THE FILE AND PASTE IT IN A BACKUP FOLDER JUST IN CASE OF A(N) ERROR)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
Layout of a CMD
When g_admin.c is open the first command should be
[/list] {"adjustban", G_admin_adjustban, "ban",
"change the duration or reason of a ban. duration is specified as "
"numbers followed by units 'w' (weeks), 'd' (days), 'h' (hours) or "
"'m' (minutes), or seconds if no units are specified. if the duration is"
" preceded by a + or -, the ban duration will be extended or shortened by"
" the specified amount",
"[^3ban#^7] (^5/mask^7) (^5duration^7) (^5reason^7)"
},
Scroll down until you reach
{"unmute", G_admin_mute, "mute",
"unmute a muted player",
"[^3name|slot#^7]"
}
Below this type //begging of (YOUR NAME)'s commands
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
The layout of a CMD
The way a CMD is typed is
{"(COMMAND)", G_admin_(COMMAND), "(COMMAND'S GENRE)",
"(DESCRIPTION)",
"(USAGE)"
},
So if you want to make a CMD you would do
{"slap", G_admin_slap, "funny",
"slap the s#$% out of a player",
"[name|slot#]"
},
(EXAMPLE)
Your last command, at the bottom of it make sure that }, is only } all the other commands must have }, with the exception of the last one.
Once you've typed all of your commands below that type //end of (YOUR NAME)'s commands
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
The bottom of g_admin.c
Now, jump to line 2890 in g_admin.c
Here is the bottom of the page, below this is something else we won't be going over.
At the bottom of the page is the "function" of the command. Basically it tells what the command should do and alternate errors and warnings.
Below
AP( va( "print \"^3%s: ^7the %s team has been %slocked by %s\n\"",
command, BG_TeamName( team ), lock ? "" : "un",
ent ? ent->client->pers.netname : "console" ) );
return qtrue;
}
Type /begging of (YOUR NAME)'s commands
Now type
qboolean G_admin_(YOUR COMMAND)( gentity_t *ent ) <- (YOUR COMMAND = the one from g_admin.h)
Were going to follow our example (!slap) so it would be
qboolean G_admin_slap( gentity_t *ent )
then below this we would add the function. This requires learning how to code. So once you learn how to code you code out the function, which in this case would be
qboolean G_admin_slap( gentity_t *ent, int skiparg )
{
int pids[ MAX_CLIENTS ], found, damage = 0;
char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ],
command[ MAX_ADMIN_CMD_LEN ], *cmd;
gentity_t *vic;
vec3_t dir;
if( level.intermissiontime ) return qfalse;
if( G_SayArgc() < 2 + skiparg )
{
ADMP( "^3!slap: ^7usage: slap [name|slot#]\n" );
return qfalse;
}
G_SayArgv( skiparg, command, sizeof( command ) );
cmd = command;
if( cmd && *cmd == '!' )
cmd++;
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS ) ) != 1 )
{
G_MatchOnePlayer( pids, found, err, sizeof( err ) );
ADMP( va( "^3!slap: ^7%s\n", err ) );
return qfalse;
}
if( !admin_immune_check( ent, &g_entities[ pids[ 0 ] ] ) )
{
ADMP( "^3!slap: ^7sorry, but your intended victim has immunity to"
" commands issued by your admin type\n" );
return qfalse;
}
vic = &g_entities[ pids[ 0 ] ];
// cant slap spectators
if( vic->client->pers.teamSelection == TEAM_NONE ||
vic->client->pers.classSelection == PCL_NONE ) {
ADMP( "^3!slap: ^7can't slap thin air\n" );
return qfalse;
}
// knockback in a random direction
dir[0] = crandom();
dir[1] = crandom();
dir[2] = random();
G_Knockback( vic, dir, g_slapKnockback.integer );
// play a sound
//G_AddEvent( vic, EV_SLAP, 0 );
if( vic != ent )
trap_SendServerCommand( vic-g_entities,
va( "cp \"%s^7 is not amused\n\"",
ent ? ent->client->pers.netname : "console" ) );
if( g_slapDamage.integer > 0 ) {
// !slap (name) [damage] syntax
if( G_SayArgc() > 2 + skiparg ) {
char dmg_str[ MAX_STRING_CHARS ];
G_SayArgv( 2 + skiparg, dmg_str, sizeof( dmg_str ) );
damage = atoi(dmg_str);
if( damage < 0 ) damage = 0;
} else {
if( g_slapDamage.integer > 100 ) g_slapDamage.integer = 100;
damage = BG_FindHealthForClass( vic->client->ps.stats[ STAT_CLASS ] ) *
g_slapDamage.integer / 100;
if( damage < 1 ) damage = 1;
}
vic->health -= damage;
vic->client->ps.stats[ STAT_HEALTH ] = vic->health;
vic->lastDamageTime = level.time;
if( vic->health <= 0 )
{
vic->flags |= FL_NO_KNOCKBACK;
vic->enemy = &g_entities[ pids[ 0 ] ];
vic->die( vic, ent, ent, damage, MOD_SLAP );
} else if( vic->pain ) vic->pain( vic, &g_entities[ pids[ 0 ] ], damage );
}
return qtrue;
}
Once we compile this and go into Tremulous and start a LAN server with the QVM we compiled and used !slap it would damage the player and push it slightly. In other cases if you just want to make the command send a text to someone just use
qboolean G_admin_(COMMAND)( gentity_t *ent, int skiparg )
{
ADMP("(YOUR TEXT)\n" );
}
return qtrue;
}
That will show up in the console, currently I do not know how to make it show up on the screen.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
G_admin.h
The G_admin_(COMMAND) would go in the g_admin.c and it sorta connects to the g_admin.h
If you open the g_admin.c, which is right next to the g_admin.h if it is sorted by name you would find at line 151
// ! command functions
Below this is a list of the G_admin_(COMMANDS)
qboolean G_admin_time( gentity_t *ent );
qboolean G_admin_setlevel( gentity_t *ent );
qboolean G_admin_kick( gentity_t *ent );
etc.
Below
qboolean G_admin_nextmap( gentity_t *ent );
qboolean G_admin_namelog( gentity_t *ent );
qboolean G_admin_lock( gentity_t *ent );
Type //begging of (YOUR NAME)'s commands
then once you typed the begging of a command in g_admin.c you would copy the G_admin_(COMMAND) and paste it below //begging of (YOUR NAME)'s commands. After you typed all of your G_admin_(COMMAND)s type below that //end of (YOUR NAME)'s commands.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
The tremulous.h
Now open the tremulous.h (the last file if sorted by name)
In the tremulous.h you will find:
1. Classes/Levels and their abilities (speed, value, regen, and cost)
2. Weapons and their abilities
3. Upgrades and their abilities
4. Buildables and their abilities
5. Other
If you change anything remember to write after your change //(default)
Also if you edit the tremulous.h remember to try your best to make the teams even to win
Some places you would find a time number, most of the time it goes by Milliseconds
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
The bg_misc.c
In the bg_misc.c you would find
1. Buildable names and their description
2. Classes/Levels names and their description
3. Error and warning text
3. *.PK3 directories
4. Weapon names and their description
5. Upgrade names and their description
6. Event names
7. Team names
Buildable names
The buildable names start at line 38
"eggpod", //char *buildName;
is the console CMD name to build the buildable. If you joined a server and (as a granger) typed /build eggpod you would build the buildable [EXAMPLE(1.1) (http://funleaked.net23.net/guides/QVM/TortoiseSVN/trem-20091224-174814.png)] [AFTER ENTERED(1.1) (http://funleaked.net23.net/guides/QVM/TortoiseSVN/trem-20091224-174820.png)].
"Egg", //char *humanName;
is the buildable name in the list of buildables. [EXAMPLE(1.1) (http://funleaked.net23.net/guides/QVM/TortoiseSVN/trem-20091224-174803.png)]
This goes for every other buildable. Buildable names end at line 599.
Class/Level names
Class/Level names starts at line 888.
"builder", //char *className;
is the name of the class that if you type in the console you spawn as it.
"Responsible for building and maintaining all the alien structures. "
"Has a weak melee slash attack.",
is the description of the class. [EXAMPLE(1.1) (http://funleaked.net23.net/guides/QVM/TortoiseSVN/trem-20091224-180138.png)]
Class/level names end at line 1245.
Error and warning text
Error and warning text are scattered everywhere and they look like:
{
Com_Printf( S_COLOR_RED "ERROR: Buildable file %s doesn't exist\n", filename );
return qfalse;
}
*.PK3 Directories
*.PK3 Directories are scattered everywhere and some look like:
{
bc = BG_BuildableConfig( i );
Com_Memset( bc, 0, sizeof( buildableConfig_t ) );
BG_ParseBuildableFile( va( "configs/buildables/%s.cfg",
BG_Buildable( i )->name ), bc );
}
Weapon names and their description
Weapon names and their description starts at line 1935.
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
is the stages available to be bought at the Armoury.
"rifle", //char *weaponName;
is the text you would type in the console.
"Rifle", //char *humanName;
is the text on the list at the Armoury.
"Basic weapon. Cased projectile weapon, with a slow clip based "
"reload system.",
is the description of the weapon.
qfalse, //int infiniteAmmo;
qfalse means it does not have unlimited ammunition and qtrue means it has unlimited ammunition.
qfalse, //int usesEnergy;
qfalse means it does not use energy and qtrue means it uses energy.
qfalse, //qboolean canZoom;
qfalse means you cannot zoom in with it and qtrue means you can zoom in with it.
qtrue, //qboolean purchasable
qtrue means it is purchasable and qfalse means it is not purchasable.
TEAM_HUMANS //team_t team;
is the team that is allowed to purchase it/use it.
Weapon names and their description ends at line 2400.
Upgrade names and their description
Upgrade names and their description starts at line 2454.
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
is the stages available to be bought at the Armoury.
"larmour", //char *upgradeName;
is the text you would type in the console.
"Light Armour", //char *humanName;
is the text on the list at the Armoury.
"Protective armour that helps to defend against light alien melee "
"attacks.",
is the description of the upgrade.
"icons/iconu_larmour",
is the directory where the Upgrade's icon is found in the *.PK3.
qtrue, //qboolean purchasable
qtrue means it is purchasable and qfalse means it is not purchasable.
qfalse, //qboolean usable
qtrue means in the game it is not shaded grey and unusable and qfalse means it is grey and unusable (Default = qfalse because there is a bind to use it)
TEAM_HUMANS //team_t team;
is the team that is allowed to purchase it/use it.
Upgrade names and their description end at line 2566.
Event names
Event names start at line 2733
We do not recommend changing this unless you are a professional. I do not know how to change this or what anything means.
Event names end at line 2832
Team names
Team names start at line 3965
Here are the team names that you type in the CONSOLE.
Team names end at line 3974
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX
12.) With MSYS (http://tremulous.net/forum/index.php?topic=3408.0)
- Type cd c:
- Type cd tremulous
- Type make
- Wait...
- The game.qvm should be found in the build/vm folder
- Place it in your server's vm folder
- Run your server, type !map atcs or !devmap atcs
- Test it, use it, Enjoy
- Please do not release your qvm, keep it on your server, the last thing Tremulous needs is a million qvm downloads everywhere like the maps
NOTE: I am not responsible for server crashes. If any marks within the qvm are placed or deleted, errors will occur.
How to mod your own QVM (LINUX BASED!) (http://xserverx.com/forum/viewtopic.php?f=44&t=622)
A longer version will be on the FuN Website (http://html://www.officialfun.tk/).
-
I can see this becoming a decent guide, if you use code tags.
-
Maybe a tutorial on modding the X stuffs would be better posted on the X forums?
-
Maybe a tutorial on modding the X stuffs would be better posted on the X forums?
Im using their trunk as a example!
-
this isn't rly a guide as much as it is what does what, a guide would show what to do to make it, [in this case it would say the commands, and what they're used for] but it could use some touch ups to become a guide.
The most important thing about making QVMs though is you must have programming experience and know some C
Once you learn what to edit to do what, and where to do it, it's all a matter of knowing C
-
Awsome guide Lonly! Keep on improving it, I love the looks of it right now! ;D
*Sigh*
Do I really have to compile Tremulous just to make a Qvm? Oh comon.....
-
Someone test his code, I'm too lazy.
-
*Sigh*
Do I really have to compile Tremulous just to make a Qvm? Oh comon.....
Yes you must compile it to make a qvm, you can't make the qvm through archive or winrar.
-
Thank you Lonly!
You have encouraged me one step more into QVM coding.
Our programmer at TremSpain, Ackman, also thanks you ;D
-
Meh, I would trade in my soul to know how to make Qvms like Syntac does....
Opps, my soul was already traded for a pack of gum. :P
-
Opps, my soul was already traded for a pack of gum. :P
You need to get a job as a comedian or something.
-
. Do not I repeat do not edit the files with bg_ in front of the name. Those files cannot be messed with. If they are they can cause your server to crash.
Do not give such false information.
-
False information? Ohh ok.
-
erm...changing colours of things is a hack...and i wouldn't suggest posting a guide to making a hack...
anyway, i'm trying to get my source up on svn, but i can't seem to get it, i'll probably just make a .zip file for now
-
i modified it so if you are having a msys issue that it opens then closes, i posted how to fix it.
-
i don't recommend download the trunk from xserverx.com, is to old.
i also make a tutorial, based on Linux systems.
http://xserverx.com/forum/viewtopic.php?f=44&t=622 (http://xserverx.com/forum/viewtopic.php?f=44&t=622)
-
Please, I beg of you, PLEASE don't follow ANY of these guides. The LAST thing Tremulous needs is another server with horrible balance changes.
-
Archangle, I havn't seen you in like a year! Hey! Good point, plus, hardly anyone wants to make a qvm, only like a few people want to make a qvm. Plus this guide is for people who understand who know how to compile. But good point.
-
Who the hell are you?
-
One of the code stalkers.....
-
Also http://www.freewebs.com/foe-qvms/ to download the latest Foe's qvm.
woot! i'm known :P
i'll try to get the source for it up asap, but i'm having trouble with a mod to the bots...
hope to get it up soon!
-
Freewebs. Pretty pro there. What is !upgrades?
-
I believe !upgrades is from Nero's QVM. It does what it sounds like: gives you upgrades (all of them).
-
I feel ill.
-
You and me both, bro'. ;)
-
I am RoK.
-
I've never heard of you.
-
I think I saw someone named -Rod-RoK once, but there's no evidence as to this being one of his (Lonly's) identities.
Maybe I'll start working on a player tracker for TremSnaps...
-
Hi Lonly/Connman/Pro/CREATOR/RoK/Reaper and everyone,
Thanks again for your tutorial. Just a quick question :P
Once I get the game.qvm file, can I replace it directly at the server while is running and "exec server.cfg" to run it or do I need to shut it down, etc?
-
Hi Lonly/Connman/Pro/CREATOR/RoK/Reaper and everyone,
Thanks again for your tutorial. Just a quick question :P
Once I get the game.qvm file, can I replace it directly at the server while is running and "exec server.cfg" to run it or do I need to shut it down, etc?
just replace the qvm and change map using !map atcs or !devmap atcs
-
It's an OK "guide" but it needs more, and better organization, IMO before people can really start using it as such.
Seriously, Foe, you already knew that I have my own server... you could've asked me to set up a subdomain for you! However, I recommend Sourceforge or Google Code because my SVN doesn't integrate with everything else like the big guys' do.
As to modded Tremulous, yeah, it's "another horrible balance change" but I've been an X regular for months now. It's fun and it's a good community, even if it isn't pure Trem, and sometimes it's exciting to break away from the norm and go play with really beefed-up classes and weapons. In the meantime, my dretching on pure servers has most certainly suffered as a result, haha. At any rate, it's really fun to figure out ways to code really weird never-before-attempted functionality into Trem, even if it isn't practical; Spectator has actually set up a server dedicated to this purpose, and it changes on a whim when one of the devs decide to try out something new. Sex is X's resident modder who implements the really crazy changes, and they are interesting, albeit not something you'll want to play full-time.
-
just replace the qvm and change map using !map atcs or !devmap atcs
Really? And is any difference between !map atcs and continuing in rotation? Because when I changed qvm, then server was often hanged up while tryed load new map.
-
Er... then your QVM has issues of its own that you need to fix. All mapchanges are the same, and they'll load the current QVM anew, whether it's rcon map, !map, or maprotation.cfg.
-
just replace the qvm and change map using !map atcs or !devmap atcs
Thanks SlackerLinux! Never thought it would be so simple
-
The server reloads the QVM on a map change, much faster than shutting down the server and restarting it...
-
I have fixed a little problem with the MSYS compiling issue of MSYS loading and closing, I fixed that, edited it so its more simpler. The file download i placed on the guide is damaged, use the new link. Also, I am very Anonomous on tremulous. So if your planning on tracking me, good luck.
-
Er... then your QVM has issues of its own that you need to fix.
Well, atleast on my linux server it is not true. I uploaded new qvm, then !map atcs. Server crashed. But was still in running processes and blocked port. I finally killed him with some commandline commands. Then I started server again (nothing was changed) and all was ok, no crash, no bugs. Now I allways uploading new qvm, shutdown server, start server and all is ok.
On my computer with windows xp I can use !map atcs and all is ok.
-
Updated! Please lock and stick.
-
Maybe a tutorial on modding the X stuffs would be better posted on the X forums?
-
The images in this tutorial are broken making it incomplete :(
Can they be fixed, please?