View unanswered posts | View active topics It is currently Fri Jan 10, 2025 12:12 am



Reply to topic  [ 4 posts ] 
 Emitters question 
Author Message
User avatar

Joined: Sun Nov 16, 2008 6:04 am
Posts: 29
Reply with quote
Post Emitters question
I have a gun that shoots an emitter that sticks to people and drags them with itself, slowly lifting them off the ground using GlobalAccScalar, and I want to make it so that it would smack the said people into ground after some time, so the question is: how can I make that emitter emit upwards, or at least perpendicular to movement direction?

P.S. I feel like I've failed this assault on defenceless english language, but I hope this is understandable. >_<


Sun Aug 30, 2009 1:31 pm
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Emitters question
You could use this simple script:
Code:
function Create(self)
   self.unpinned = 1
   self.vector = Vector(0,0)
   self.LTimer = Timer()
   self.time1 = Timer()
   self.time2 = Timer()
   for actor in MovableMan.Actors do
      if (actor.Pos - self.Pos).Magnitude < 60 then self.parent = actor;end
   end
   self.GlobalAccScalar = 0
end

function Update(self)
    if self.LTimer:IsPastSimMS(50) then
   if self.unpinned == 1 then
     self.atarget = (SceneMan:CastMORay(Vector(self.Pos.X - self.Vel.X,self.Pos.Y - self.Vel.Y),Vector(self.Vel.X,self.Vel.Y),0,0,true,5))
     self.target = MovableMan:GetMOFromID(self.atarget)
     if self.target ~= nil then
       self.target = MovableMan:GetMOFromID(self.target.RootID)
       self.unpinned = 0
       self.offset = Vector(self.Pos.X - self.target.Pos.X , self.Pos.Y - self.target.Pos.Y)
       self.offsetang = self.offset.AbsRadAngle - self.target.RotAngle
       self.target:AddAbsImpulseForce(Vector((self.Vel.X - self.target.Vel.Y), (self.Vel.Y - self.target.Vel.Y)) , self.Pos)
       self.target.Vel = Vector(self.target.Vel.X + self.Vel.X / self.target.Mass , self.target.Vel.Y + self.Vel.Y / self.target.Mass)
       self.time2:Reset()
     end
   end
    end

    if MovableMan:ValidMO(self.target) and self.unpinned == 0 then
   self.Pos = Vector(self.target.Pos.X + (self.offset.Magnitude * math.cos(self.target.RotAngle + self.offsetang)),self.target.Pos.Y - (self.offset.Magnitude * math.sin(self.target.RotAngle + self.offsetang)))
   self.Vel = self.target.Vel
        if not self.time2:IsPastSimMS(5000) then
          self.target.Vel.Y = -5
        elseif not self.time2:IsPastSimMS(5200)
          self.target.Vel.Y = 50
        end
    else self.unpinned = 1;end
end


Sun Aug 30, 2009 2:28 pm
Profile
User avatar

Joined: Sun Dec 21, 2008 8:16 am
Posts: 293
Reply with quote
Post Re: Emitters question
piipu wrote:
You could use this simple script:
Code:
Super hueg code...


o.O... If this is simple in lua, I'm giving up.


Sun Aug 30, 2009 5:32 pm
Profile
User avatar

Joined: Sun Aug 09, 2009 9:26 am
Posts: 1633
Reply with quote
Post Re: Emitters question
Simple doesn't account for length. Look at the functions, though, it uses the same functions often, and doesn't require a lot of thinking to understand. That's why it's simple.


Sun Aug 30, 2009 7:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.054s | 14 Queries | GZIP : Off ]