Announcement

Collapse
No announcement yet.

Silly Instagib Mod

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Mod renamed to berserker, which seems more fitting.

    Added cfg support for vars.
    Added auto semi-random weapon switch.

    berserker.cfg:
    Code:
    // WEAPONS
    // IT_SHOTGUN           1
    // IT_SUPER_SHOTGUN     2
    // IT_NAILGUN           4
    // IT_SUPER_NAILGUN     8
    // IT_GRENADE_LAUNCHER  16
    // IT_ROCKET_LAUNCHER   32
    // IT_LIGHTNING         64
    
    // Edit the next variables to your liking
    // First or main weapon - see above:
    set STARTWEAPON 2
    // When to go berserk. In seconds (gets a random element thrown in too):
    // 0 disables.
    set BERSERKTIMER 25
    // When to switch weapons. In seconds (gets a random element thrown in too):
    // 0 disables.
    set SWITCHTIMER 15
    Index of /quake-mods

    -r0t.uk- cOOp - Mapvote - r0t.uk:26001
    -r0t.uk- DM - Mapvote - r0t.uk:26000

    Comment


    • #32
      Nice! I'll check it out! This is good setting them in the cfg. You are learning young grass hopper! Err wait... I remember you are a veteran!

      Comment


      • #33
        Only if veteran means old and knackered

        -r0t.uk- cOOp - Mapvote - r0t.uk:26001
        -r0t.uk- DM - Mapvote - r0t.uk:26000

        Comment


        • #34
          By the way, I tried moving some of the client functions to my custom berserker.qc and calling them from client as usual, but I found that things started breaking so I'm guessing that it was trying to run code from a server POV rather than client.

          Would that be correct? Or are functions called from client meant to be processed a if they were on client?

          *Edit: I expect calling W_ChangeWeapon from there would break anyway...

          Perhaps I could pass 'self' as a function argument... *Edit: see above.

          There may also be some syncing issues. Had some fun testing on my server for a while when some guy turned up, and noticed that after respawn we were out-of-sync with berserk mode.
          Last edited by slackhead; 09-16-2014, 11:35 AM.

          -r0t.uk- cOOp - Mapvote - r0t.uk:26001
          -r0t.uk- DM - Mapvote - r0t.uk:26000

          Comment


          • #35
            Working on a server-centric way of changing weapons using my old friend 'bob'. So there will be much less in client, and more in my custom qc.

            -r0t.uk- cOOp - Mapvote - r0t.uk:26001
            -r0t.uk- DM - Mapvote - r0t.uk:26000

            Comment


            • #36
              Originally posted by slackhead View Post
              By the way, I tried moving some of the client functions to my custom berserker.qc and calling them from client as usual, but I found that things started breaking so I'm guessing that it was trying to run code from a server POV rather than client.

              Would that be correct? Or are functions called from client meant to be processed a if they were on client?

              *Edit: I expect calling W_ChangeWeapon from there would break anyway...

              Perhaps I could pass 'self' as a function argument... *Edit: see above.

              There may also be some syncing issues. Had some fun testing on my server for a while when some guy turned up, and noticed that after respawn we were out-of-sync with berserk mode.

              Some of this I am not sure what you mean. I haven't had a minute to look at your code but I will try to answer some of these questions.

              The location of the function/routine/subroutine is not what matters usually. Where it is called is the real issue. Your init timer is run in worldspawn which is fine. If you use self in that instance it will refer to world. If you make a call for a function in PlayerPostThink then self by default will be the player. Now lets say you spawn an entity and want it to connect it to a client. you'll need to set it's owner to self. So for example:


              Code:
              void() player_flashlight = 
              { 
              local entity newflashlight; 
              newflashlight = spawn(); 
              newflashlight.pflags = PFLAGS_FULLDYNAMIC; 
              newflashlight.light_lev = 750; 
              newflashlight.color = '1.5 1.5 1.5'; 
              newflashlight.style = 255;
              newflashlight.skin = 1; 
              newflashlight.owner = self; 
              self.flashlight = newflashlight; 
              newflashlight.think = flashlight_think; 
              newflashlight.nextthink = time; 
              };

              This is an example flashlight that you might call using an impulse. Basically we set the owner as self (player). This will be carried over to the next think function that will run. So because you changed self to be the owner in order to refer to this reference into the think function every time you what the action to refer to the player you'll need to use self.owner instead of just self. Example:

              Code:
              void() flashlight_think = 
              { 
              if (self.owner.health > 0) 
              { 
              makevectors (self.owner.v_angle); 
              traceline (self.owner.origin, (self.owner.origin + (v_forward * 32)), FALSE, self); 
              setorigin(self, trace_endpos + (v_forward * -5) + (self.owner.view_ofs - '0 0 8')); 
              self.angles = self.owner.v_angle; 
              self.angles_x = self.angles_x * -1; 
              self.nextthink = time; 
              }
              	 
              };
              As you can see the green highlights are references to the player and self here will be the entity. A lot of people forget to use self.owner instead of self and get all confused about what's being identified so the correct information is passed to the right source.

              Now this is assuming the player (self) is the one that will run these functions. In this case, a toggle via impulse will initate this spawn action. If you decide to run something like this server side and want to assign it to a player you'll need to have the function also look for specific classnames first and then make sure you assign it to other or similar. You already have experience doing this with your remove_items function I believe.

              Not sure if this answers the question or not. Basically how you should write the routine depends on where you plan to call it. If you call it via something like PlayerPostThink self will default to being the player (yourself) unless you specific different. The example above shows this being done. You end up changing self to refer to the owner of the entity which will still be you but changes how you will refer to the player in the next think routine it calls. You can change it back to being just the player (self) after the fact but just remember to do it correctly or you will break the routine from doing what it was suppose to do. You'll need to let it function as it needs and probably at the end of it set self back to refer to the player so that your next think or subroutine you run will know what to assign instructions to. You could even make the change in the next routine. As long as you make it before you need to assign new instructions or changes to the player. The flashlight example doesn't require changing anything because this routine only gets run once so no need to change references once this is done.


              *Edit: I expect calling W_ChangeWeapon from there would break anyway...
              From where? the routine for W_ChangeWeapon all uses of self are meant for the player so using this in any situation that self does not default to the player would render this routine useless. It is only useful if (self) can actually use any of the references. If you try to run this for a monster clearly it will not work because they don't usually have a set amount of items or weapons on them so they can't change weapons. Those you could use something like this for a bot which could basically use a lot of the same code as you. If you wanted to run something like this from Startframe () you'd have to completely rewrite it. Not sure where you are wanting to run it.


              There may also be some syncing issues. Had some fun testing on my server for a while when some guy turned up, and noticed that after respawn we were out-of-sync with berserk mode.
              I haven't looked at your code yet, but did you change how you initiated the timer? I thought it was synced up when we last playtested but I can't remember. What changes have you made in relation to it if it was indeed synced before?

              Comment


              • #37
                I hadn't made any changes to the to timer, so no idea why it was misbehaving. Since then though I've been experimenting with a totally different approach and it's going to take a while to sort out respawns. I'll upload as soon as I get something working.

                -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                -r0t.uk- DM - Mapvote - r0t.uk:26000

                Comment


                • #38
                  Well the new version is uploaded.

                  -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                  -r0t.uk- DM - Mapvote - r0t.uk:26000

                  Comment


                  • #39
                    Fixed the impulse bug and uploaded.

                    PL:

                    berserker.cfg:
                    Code:
                    // WEAPONS
                    // IT_SHOTGUN           1
                    // IT_SUPER_SHOTGUN     2
                    // IT_NAILGUN           4
                    // IT_SUPER_NAILGUN     8
                    // IT_GRENADE_LAUNCHER  16
                    // IT_ROCKET_LAUNCHER   32
                    // IT_LIGHTNING         64
                    
                    // Edit the next variables to your liking
                    // First or main weapon - see above:
                    set STARTWEAPON 2
                    // When to go berserk. In seconds (gets a random element thrown in too):
                    // 0 disables.
                    set BERSERKTIMER 25
                    // When to switch weapons. In seconds (gets a random element thrown in too):
                    // 0 disables.
                    set SWITCHTIMER 15

                    -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                    -r0t.uk- DM - Mapvote - r0t.uk:26000

                    Comment

                    Working...
                    X