Data Realms Fan Forums
http://45.55.195.193/

Ok... This ain't funny anymore.
http://45.55.195.193/viewtopic.php?f=73&t=17347
Page 1 of 1

Author:  Roon3 [ Fri Dec 11, 2009 3:44 pm ]
Post subject:  Ok... This ain't funny anymore.

I keep getting errors that look like this:
Image
Just a ton of symbols and words with no meaning what so ever. At first I thought it was funny and ignored it, but its really starting to get on my nerves.
This is what triggers it:
Code:
function Create(self)
   self.curDist = 20;

   local i = Vector(0,0);
   i.X = math.cos(self.RotAngle) * self.curDist * -1;
   i.Y = math.sin(self.RotAngle) * self.curDist;
   local ParentID = SceneMan:CastMORay(self.Pos, i, self.ID, -1, false, 0);
   if ParentID ~= 255 then
      local j = MovableMan:GetRootMOID(ParentID);
      self.Parent = MovableMan:GetMOFromID(j);
      if self.Parent:IsActor() then

         for i = 0, MovableMan:GetMOIDCount() do
            if MovableMan:GetRootMOID(i) == self.Parent.ID and MovableMan:GetMOFromID(i).PresetName == "Grapple Gun" then
               self.gun = MovableMan:GetMOFromID(i);
            end
         end

         if ToHeldDevice(self.gun):IsActivated() and ToHeldDevice(self.gun):IsFull() ~= true then
            local Smoke = CreateAEmitter("Smoke Emitter");
            Smoke.Pos = self.Pos;
            Smoke.RotAngle = ToActor(self.Parent):GetAimAngle(true);
            MovableMan:AddParticle(Smoke);
         end
      end
   end
   self.Lifetime = 1;
end


Or more specifically, this:
Code:
ToHeldDevice(self.gun):IsFull() ~= true


What I have here is a MOSRot emitted off of a gun. It finds the actor I'm using and its gun, runs the script, and deletes. All in one update.
What I'm trying to do with that line is fire some effect particles when the gun is fired, but if you keep holding the fire button it shoots the effects out non stop. This is where the broken line comes in, it limits the particle creation to as long as the gun still has ammo (A few frames). Is there is any way to limit the creation without using the broken part, or fixing it so the broken part still works?

Author:  Darlos9D [ Fri Dec 11, 2009 5:20 pm ]
Post subject:  Re: Ok... This ain't funny anymore.

Man... that's new to me. Does it not do it when the IsFull() line isn't there? Maybe there's just something inherently wrong with it.

Author:  411570N3 [ Sat Dec 12, 2009 4:30 am ]
Post subject:  Re: Ok... This ain't funny anymore.

Try pming Grif. I think that banned users can pm, but I'm not sure.

Author:  Geti [ Sat Dec 12, 2009 8:52 am ]
Post subject:  Re: Ok... This ain't funny anymore.

They can.
Anyway, for those that haven't encountered errors like this before, its generally because something is being called on an object in game, using functions that it holds (or doesnt hold), and it breaking.
Roon, you should probably be using ToHDFirearm, incase HeldDevices dont have IsFull and all that jazz, though they should, according to the wiki.
As I said in PM, try splitting up the check.
I might tinker with it tonight, but probably not.

Author:  Roon3 [ Sat Dec 12, 2009 11:41 am ]
Post subject:  Re: Ok... This ain't funny anymore.

Thanks for the help guys. Both splitting the checks and using ToHDFirearm didn't work. I got it working by emitting it off of the muzzle flash and applying some hacky lua to get it doing what I want.

Author:  Geti [ Sat Dec 12, 2009 1:21 pm ]
Post subject:  Re: Ok... This ain't funny anymore.

Well, it's a workaround. Be nice to find the root of it though.

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