Data Realms Fan Forums
http://45.55.195.193/

Custom wound that does not add to gibwoundlimit?
http://45.55.195.193/viewtopic.php?f=1&t=46204
Page 1 of 1

Author:  Magmacow358 [ Sun Sep 03, 2017 9:43 pm ]
Post subject:  Custom wound that does not add to gibwoundlimit?

I've been experimenting with new ways of implementing flamethrowers, and I saw someone suggest an AEmitter that uses Lua to attach a custom "on fire" wound to a target. So far, it's working excellently, except that the target will quickly hit its gibwoundlimit and explode. Which, while sort of fun, is far from expected flamethrower behavior.

Is there a way to exempt a wound from the adding to the wound count?

Author:  p3lb0x [ Mon Sep 04, 2017 7:43 pm ]
Post subject:  Re: Custom wound that does not add to gibwoundlimit?

It's been a while since I did CC lua scripting, but you could "attach" it with lua. And just let it move around with its parent instead of actually putting a wound on the character

edit: I used this for my flame effect in the brolands mod

edit edit: Would probably refactor this a lot nowadays after I've gotten better at programming.

Code:
function Create(self)
   self.target = MovableMan:GetMOFromID(self.Sharpness);
   self.timer = Timer();
   self.timer2 = Timer();
   self.interval = 100;
   self.damage = 0.25;
   self.particles = 5;
   self.particle = {}
end

function Update(self)
   if self.target.ID ~= 255 then
      self.Pos = self.target.Pos;
      self.Vel = self.target.Vel;
   
      if IsActor(self.target) then
         if self.timer:IsPastSimMS(self.interval) then
            ToActor(self.target).Health = ToActor(self.target).Health - self.damage
            self.timer:Reset();
         end
      end

      for i=0,self.particles,1 do
         if self.target.ID ~= 255 then
            if not self.particle[i] then
               self.particle[i] = CreateMOSParticle("Flame 1","Brolands.rte");
               self.particle[i].relpos = Vector(math.random(-6,6),math.random(-10,15));
               self.particle[i].Pos = self.Pos + Vector(self.particle[i].relpos.X, self.particle[i].relpos.Y):RadRotate(self.target.RotAngle);
               MovableMan:AddParticle(self.particle[i]);
            end
            self.particle[i].Pos = self.Pos + Vector(self.particle[i].relpos.X, self.particle[i].relpos.Y):RadRotate(self.target.RotAngle);
         end
      end

   else
      self.ToDelete = true;
   end
end

Author:  Bad Boy [ Tue Sep 05, 2017 8:56 pm ]
Post subject:  Re: Custom wound that does not add to gibwoundlimit?

At some point we got an AttachEmitter method which lets you add wounds directly through lua, so that may be better than position following. Also, since we can store object references on actors I'd suggest you try a system that works along the following lines:

1. When a flamethrower 'bullet' hits an actor it checks if the actor's MyFlamethrowerWound (or whatever you want to call it) object value exists
2. If it doesn't exist, it attaches a new FlamethrowerWound emitter to the actor, and sets the actor's MyFlamethrowerWound object value to that emitter. The wound emitter would have a separate script on it that does whatever damage over time or other effects you want.
3. If it does exist, it tells the attached wound that another piece of fire has hit, and the wound does whatever it needs to (damages the actor, increases DOT, etc.)

As a bonus, this sort of setup could be used for any weapon of this sort, with the only difference being what the wound does over time and what it does when it gets told that another bullet has hit its actor.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/