Gib code: how do I figure out what player model is being use

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators


  • Gib code: how do I figure out what player model is being used?

    I want this:
    if(prandom() < amount)
    TossGib("models/gibs/eye.md3", org, vel, prandomvec() * 150, 0);

    To be like this:

    if(prandom() < amount)
    if ((PLAYERMODEL == robot) or (PLAYERMODEL == robot2)) {
    TossGib("models/gibs/gear1.md3", org, vel, prandomvec() * 150, 0);

    } else {
    TossGib("models/gibs/eye.md3", org, vel, prandomvec() * 150, 0);
    }


    I have no idea how to do stuff like that.

    I also have no idea how to make the blood for robots black rather than red.

    I will never know any of this stuff.

    This is in client/gibs.qc
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Sun Apr 19, 2009 8:16 pm

  • You have to do this server side:

    server/g_violence.qc:
    - Add an extra argument source to Violence_GibSplash_At
    - Before the setorigin() call in Violence_GibSplash_At, add:
    e.state |= source.gibtype;
    - Add the new source argument to all calls to Violence_GibSplash_At in the code (in this file, source goes in, in most other places, self goes in)
    - Add a new function that checks self.playermodel, and sets self.gibtype accordingly. Note that you can't use values there that are needed by the gibsplash. For now just add one type, namely, 4 (so gibtype is always either set to 0 or to 4). You can add up to 31 new gib types this way.

    server/cl_client.qc:
    - Add a call to UpdateGibType() at the end of setmodel_lod.

    client/gibs.qc:
    - Add the new gib types to the switch(). Gib type 0 uses 0x01, 0x02, 0x03 for regular gibs, and 0x81, 0x82, 0x83 if cl_gentle is set. Your new gib type will use 0x05, 0x06, 0x07, and 0x85, 0x86, 0x87 if cl_gentle is 1. The first of these triplets are done when the player is gibbed, the second is blood (when hit), the third is chunks thrown when almost out of health.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sun Apr 19, 2009 10:15 pm

  • Why not just distribute gibs with each player model, and use that/those model, or if it does not come with one, use a fallback (human) gibs.
    uluyol901
    Member
     
    Posts: 16
    Joined: Sun Jan 25, 2009 7:39 pm

Sun Apr 19, 2009 10:39 pm

  • divVerent wrote:You have to do this server side:

    server/g_violence.qc:
    - Add an extra argument source to Violence_GibSplash_At
    - Before the setorigin() call in Violence_GibSplash_At, add:
    e.state |= source.gibtype;
    - Add the new source argument to all calls to Violence_GibSplash_At in the code (in this file, source goes in, in most other places, self goes in)
    - Add a new function that checks self.playermodel, and sets self.gibtype accordingly. Note that you can't use values there that are needed by the gibsplash. For now just add one type, namely, 4 (so gibtype is always either set to 0 or to 4). You can add up to 31 new gib types this way.

    server/cl_client.qc:
    - Add a call to UpdateGibType() at the end of setmodel_lod.

    client/gibs.qc:
    - Add the new gib types to the switch(). Gib type 0 uses 0x01, 0x02, 0x03 for regular gibs, and 0x81, 0x82, 0x83 if cl_gentle is set. Your new gib type will use 0x05, 0x06, 0x07, and 0x85, 0x86, 0x87 if cl_gentle is 1. The first of these triplets are done when the player is gibbed, the second is blood (when hit), the third is chunks thrown when almost out of health.


    I don't understand what any of that means at all.

    What I did do, I failed at:
    This doesn't work:

    gibs.qc:
    https://cat2.optus.nu/nexuizserv/othermaps/gibs.qc
    Code: Select all
    void Ent_GibSplash()
    {
       float amount, type;
       vector org, vel, mi, ma;

       float c, gibfactor, randomvalue;

       type = ReadByte(); // gibbage type
       amount = ReadByte() / 16.0; // gibbage amount
       org_x = ReadShort() * 4 + 2;
       org_y = ReadShort() * 4 + 2;
       org_z = ReadShort() * 4 + 2;
       vel = decompressShortVector(ReadShort());
       mi = decompressShortVector(ReadShort());
       ma = decompressShortVector(ReadShort());

       if(cvar("cl_gentle"))
          type |= 0x80; // set gentle bit
       
       gibfactor = 1 - cvar("cl_nogibs");
       if(gibfactor <= 0)
          return;
       
       amount *= gibfactor;

       if(cvar("ekg"))
          amount *= 5;
       
       self.origin = org; // for the sounds

       switch(type)
       {
          case 0x01:
             sound (self, CHAN_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM);

             if(prandom() < amount)
                if (self.model == "models/player/crash.zym") {
                   TossGib("models/gibs/nb1.md3", org, vel, prandomvec() * 150, 0);
                } else {
                   TossGib("models/gibs/eye.md3", org, vel, prandomvec() * 150, 0);
                }
             te_bloodshower(org + mi, org + ma, 1200, 1000 * amount);
             if(prandom() < amount)
                TossGib("models/gibs/bloodyskull.md3", org, vel, prandomvec() * 100, 0);

             for(c = 0; c < amount; ++c)
             {
                randomvalue = amount - c;
                   
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/pneumaticram1.md3", org, vel, prandomvec() * (prandom() * 120 + 90),0);
                   } else {
                      TossGib ("models/gibs/arm.md3", org, vel, prandomvec() * (prandom() * 120 + 90),0);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/tm4.md3", org, vel, prandomvec() * (prandom() * 120 + 90),0);
                   } else {
                      TossGib ("models/gibs/arm.md3", org, vel, prandomvec() * (prandom() * 120 + 90),0);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/tm3.md3", org + '0 0 -12', vel, prandomvec() * (prandom() * 120 + 80),0);
                   } else {
                      TossGib ("models/gibs/chest.md3", org + '0 0 -12', vel, prandomvec() * (prandom() * 120 + 80),0);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/tm2.md3", org, vel, prandomvec() * (prandom() * 120 + 80),0);
                   } else {
                      TossGib ("models/gibs/smallchest.md3", org, vel, prandomvec() * (prandom() * 120 + 80),0);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/tm1.md3", org + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85),0);
                   } else {
                      TossGib ("models/gibs/leg1.md3", org + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85),0);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/nb2.md3", org + '0 0 -9', vel, prandomvec() * (prandom() * 120 + 85),0);
                   } else {
                      TossGib ("models/gibs/leg2.md3", org + '0 0 -9', vel, prandomvec() * (prandom() * 120 + 85),0);
                   }

                // these splat on impact
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/nb3.md3", org, vel, prandomvec() * 450,1);
                   } else {
                      TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * 450,1);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/nb5.md3", org, vel, prandomvec() * 450,1);
                   } else {
                      TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * 450,1);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/nb7.md3", org, vel, prandomvec() * 450,1);
                   } else {
                      TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * 450,1);
                   }
                if(prandom() < randomvalue)
                   if (self.model == "models/player/crash.zym") {
                      TossGib ("models/gibs/nb9.md3", org, vel, prandomvec() * 450,1);
                   } else {
                      TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * 450,1);
                   }
             }
             break;
          case 0x02:
             pointparticles(particleeffectnum("blood"), org, vel, amount * 16);
             break;
          case 0x03:
             if(prandom() < amount)
                if (self.model == "models/player/crash.zym") {
                   TossGib ("models/gibs/nb4.md3", org, vel, prandomvec() * (prandom() * 30 + 20), 1); // TODO maybe adjust to more randomization?
                } else {
                   TossGib ("models/gibs/chunk.mdl", org, vel, prandomvec() * (prandom() * 30 + 20), 1); // TODO maybe adjust to more randomization?
                }
             break;
          case 0x81:
             pointparticles(particleeffectnum("damage_dissolve"), org, vel, amount);
             break;
          case 0x82:
             pointparticles(particleeffectnum("damage_hit"), org, vel, amount * 16);
             break;
          case 0x83:
             // no gibs in gentle mode, sorry
             break;
       }
    }

    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Mon Apr 20, 2009 1:11 am

  • Div: I tried what you said abit, but stopped once it said create a new function. This is beyond me, I don't know why I'm creating a new function, nor what should be in it etc. I also don't know how to "fix" the rest of the code to use the gib splash thing correctly.

    I can't do this.
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Mon Apr 20, 2009 1:13 am

  • uluyol901 wrote:Why not just distribute gibs with each player model, and use that/those model, or if it does not come with one, use a fallback (human) gibs.


    I think that making at least 3 different types of gibs should be enough: human/robot/alien. Those can be referenced by the models later.

    Mikee: If the gibs models and effects are ready we can take care of the code. Don't struggle with it too much unless you really want to.
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Mon Apr 20, 2009 1:25 am

  • mand1nga wrote:
    uluyol901 wrote:Why not just distribute gibs with each player model, and use that/those model, or if it does not come with one, use a fallback (human) gibs.


    I think that making at least 3 different types of gibs should be enough: human/robot/alien. Those can be referenced by the models later.

    Mikee: If the gibs models and effects are ready we can take care of the code. Don't struggle with it too much unless you really want to.


    The robot's gibs have been ready for over a month, maybe 2?
    Robo gibs (small parts): https://caethaver2.optus.nu/nexuizserv/ ... ltszip.pk3
    The larger parts ("chest, small chest, etc"): https://caethaver2.optus.nu/nexuizserv/ ... talzip.pk3
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm



Return to Nexuiz - Editing




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest