Author Topic: Final 2 Questions.  (Read 4466 times)

Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
Final 2 Questions.
« on: October 16, 2008, 12:41:19 am »
I have finally got my way to making a qvm. The compiler, not really because the screen would open then close. Thats my first question. My compiler (http://tremulous.net/forum/index.php?topic=3408.0) would open then close. Why is that? I also would like to know what is all the files in a qvm for (example: g_admin). My qvm is so far coming alright (thanks to ~Foe Of Eternity~, who helped me). Those are my two questions: what are the files in a qvm for, and why does my compiler refuse to work. Thanks, RoK.

Thorn

  • Guest
Re: Final 2 Questions.
« Reply #1 on: October 16, 2008, 04:20:29 am »
There are no files inside a qvm.

Foe of Eternity

  • Posts: 169
  • Turrets: +6/-13
Re: Final 2 Questions.
« Reply #2 on: October 16, 2008, 05:52:07 am »
i think he means files in the source, if you want to make a ! command, you need to edit g_admin.c (2 places) and g_admin.h
if you want to make a / command, you need to edit g_cmd.c

for varibles, g_local.h, and main.c (in 2 places)
for stuff like ent->client-> that's in g_local.h
for from dying (like MOD_SLAP), you edit bg_public.c, and g_combat.c (2 places)


ps: i find this stuff out by doing file searches

No. Let n00bs pick overly destructive Human weapons and then use them in their own base and around their own teammates. Maybe then they'll learn that doing that is a stupid idea. Meanwhile, I will be slashing at their damaged Armoury, after I vault their smoking turrets and the scattered bodies of their TK' d teammates. N00bs: they're what's for breakfast.

Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
Re: Final 2 Questions.
« Reply #3 on: October 17, 2008, 09:03:49 pm »
How do you make a mod, any answers?

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: Final 2 Questions.
« Reply #4 on: October 17, 2008, 10:22:31 pm »
Well first you have to make sure that you have the necessary tools to build tremulous from source. Then you should get the tremulous sourcecode, apply any patches that you need (backport/other qvms).
Then you just call make BUILD_GAME_QVM=1 and you should get a new qvm (first without any mods of course).

To make any modifications you have to read and understand the source code in src/game and then change it to what you want it to do.

One example for a small silly mod: the development version of tremulous has barricades that shrink when an alien jumps on them. Now you want to extend this so that the barricade can work like a catapult when an alien jumps from it. The barricade should need to be half a second shrunk before the catapult can work.

The functions that you have to edit are in g_buildable.c namely ABarricade_Shrink and ABarricade_Touch.
In ABarricade_Shrink you have to remember the time when the barricade was shrunk. The barricade already has an attribute self->shrunktime, but unfortunately this is updated every frame, what you need is the first time that it was shrunk, so you have to edit g_local.h and add a new attribute to the gentity_s structure. This holds all the data that the server keeps for every entity in the game. Time is measured in milliseconds and stored as integer, so you add:
Code: [Select]
int firstShrunkTime;    // time when a barricade started to shrink after the shrunktime and in ABarricade_Shrink you add the line
Code: [Select]
self->firstShrunkTime = self->shrunkTime = level.time; at the place where the shrink animation is started.
Then you can add the following to the end of ABarricade_Touch:
Code: [Select]
  if ( &g_entities[ other->s.groundEntityNum ] == self &&      // other entity has to stand on barricade
     client->pers.cmd.upmove >= 10 &&                          // other entity must be pressing up
     level.time >= self->firstShrunkTime + 500 &&              // barricade must be shrunk for at least 500 ms
     self->spawned && self->powered ) {                        // barricade should be fully built and OM must exist
    vec3_t base, dir;

    // calculate base point of barricade
    VectorCopy( self->s.origin, base );
    base[ 2 ] -= self->r.mins[ 2 ];

    // Calculate direction of the other entity from the base of the barricade
    VectorSubtract( other->s.origin, base, dir);
    VectorNormalize( dir );
    // Set other entities velocity, fat aliens are pushed less.
    VectorScale( dir, 40000 / BG_FindHealthForClass( client-pers.classSelection ), client->ps.velocity );
  }

This is of course completely untested and may fail in various ways, but you should get an idea how modding works.

PS: I have actually looked at the tremfusion sources when I wrote this, so the tremulous source may work slightly different.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: Final 2 Questions.
« Reply #5 on: October 17, 2008, 10:40:04 pm »
@Lonly: You might find this useful.

Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
Re: Final 2 Questions.
« Reply #6 on: October 18, 2008, 01:41:12 pm »
My compiler gets a error when i try to open it. I'm using MSYS. I installed all the requirements but this is the error i got.

Code: [Select]
AllocationBase 0x0, BaseAdress 0x715B0000, RegionSize 0x150000, State 0x10000
C:\msys\bin\rxvt.exe: *** Couldn't reserver space for cygwin's heap, Win32 error

It would open, then quickly  close. But before it closed I took a Print Screen. So I got a picture of the error before it close. Can I please get some help.