View unanswered posts | View active topics It is currently Wed Dec 11, 2024 11:26 am



Reply to topic  [ 134 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
 Lua based map objects, help! (BW related) 
Author Message
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Lua based map objects, help! (BW related)
The gravity causes a constant acceleration of 20 m/s^2. So in a frame the change of velocity would be 20 m/s^2 * time of frame in seconds aka deltatime.


Mon Apr 27, 2009 12:51 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua based map objects, help! (BW related)
piipu wrote:
The gravity causes a constant acceleration of 20 m/s^2. So in a frame the change of velocity would be 20 m/s^2 * time of frame in seconds aka deltatime.


oh yeah durr hurr hurr it's multiplication not division

Grif are retarded.


Mon Apr 27, 2009 3:12 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Lua based map objects, help! (BW related)
411570N3 wrote:
How about a module that does what you guys have suggested as zero gravity, except in reverse; a super gravity module, only the lightest of actors may pass.
Oh and I think the hard-code for gravity would be essentially what you guys are talking about: constant acceleration downwards, which, in a physics context, it is; so constant acceleration upwards should be fine... except if your actor was heavy enough it could end up being really buggy...


Here you go:
Code:
actor.Vel.Y = actor.Vel.Y + (20 * 0.016667)


Should double gravity.


Tue Apr 28, 2009 7:03 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Except WEIGHT does not affect GRAVITY jesus CHRIST.


Wed Apr 29, 2009 1:40 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Actually it does. The acceleration is the same, but the higher your mass is the bigger the force caused by gravity is.


Wed Apr 29, 2009 5:41 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua based map objects, help! (BW related)
oh wow more newtons exerted how handy. they should still be able to walk, things will just splatter, or at least take impulsedamage much more easily. it would basically be a no-jet no-prone (unless you were careful) area for any heavy actors, and probably light actors too.


Wed Apr 29, 2009 5:53 am
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua based map objects, help! (BW related)
piipu wrote:
Actually it does. The acceleration is the same, but the higher your mass is the bigger the force caused by gravity is.


In reality, sure, though to a ♥♥♥♥ miniscule degree.

In CC, nope nope nope. Constant downward velocity, 100% guaranteed.


Wed Apr 29, 2009 6:28 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Grif wrote:
In CC, nope nope nope. Constant downward velocity acceleration, 100% guaranteed.

fixed, before someone else does more angrily.


Wed Apr 29, 2009 6:32 am
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Some help needed again!

How would one change the velocity to negative or make it fly in a reverse direction it was coming if a particle/item entered hit a certain area?

So basically I'm talking about a reverse field, particles and items that try to fly through it, are sent to fly in the opposite direction where they came from.
Pretty much how to change an objects velocity to negative with Lua code?



Another thing is proximity mine. Its fairly simple, but I dont know how would the detonation work. Is there a variable to make the objects gib itself?Because thats only what I need.
The mine itself would most likely be either a pinned MOSRotating or a pinned AEmitter (emitter could give a small effect showing the mine is active by blinking red.)


Wed Apr 29, 2009 8:14 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Code:
for reverse in MovableMan.Objects do
   reverse.Vel.X = reverse.Vel.X * -1
   reverse.Vel.Y = reverse.Vel.Y * -1
end
should do it.
and also
Code:
self.GibThis()
should gib the object should it not?


Wed Apr 29, 2009 8:38 am
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Geti wrote:
Code:
for reverse in MovableMan.Objects do
   reverse.Vel.X = reverse.Vel.X * -1
   reverse.Vel.Y = reverse.Vel.Y * -1
end
But wouldn't that do it every iteration? I think you'd either have to make something to combat that or add a variable to check if it's been done... or maybe it'd immediately exit the area... hmm...


Wed Apr 29, 2009 11:42 am
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Heres the code for the Plasma Chaser, a grenade that sends out 6 Emitters that are supposed to chase actors. The grenade works normally, but the charges dont chase anyone.
Also it doesnt matter if it would chase the use, its even better that way.

Code:
function Create(self)
end

function Destroy(self)
end

function Update(self)
   for actor in MovableMan.Actors do
      local diff = math.sqrt(math.pow((actor.Pos.X-self.Pos.X),2) + math.pow((actor.Pos.Y - self.Pos.Y),2))
      if diff < 30 then
         diff = 30
      end
      if diff < 600 then
        local diffx = actor.Pos.X - self.Pos.X
        local diffy = actor.Pos.Y - self.Pos.Y
        local ang2 = math.atan2(self.Vel.Y , self.Vel.X)
        local ang = math.atan2(diffy , diffx)
        if math.abs(ang - ang2) < 0.8 then
           self.Vel.Y = -(actor.Vel.Y - (50 / diff * math.sin(ang)))
           self.Vel.X = -(actor.Vel.X - (100 / diff * math.cos(ang)))
        end
      end
   end
end


And just incase, I'll post the emitter code itself incase you might find something interesting from it.

Code:
AddEffect = AEmitter
   PresetName = Plasma Chaser
   Mass = 50
   LifeTime = 7000
   OrientToVel = 0.9
   GlobalAccScalar = 0
   RestThreshold = -500
   HitsMOs = 0
   GetsHitByMOs = 0
      SpriteFile = ContentFile
      FilePath = BW.rte/Sprites/PlasmaChaser.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -6
      Y = -6
   ScriptPath = BW.rte/Grenades/PlasmaChaser.lua
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Air Blast
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Air Blast
      Resolution = 4
      Depth = 10
   DeepCheck = 1
   JointStrength = 16000
   JointStiffness = 1
   DrawAfterParent = 1

   AddEmission = Emission
      EmittedParticle = MOPixel
         CopyOf = Plasma Chaser Particle 1
      ParticlesPerMinute = 3000
      Spread = 3.14
      StartTimeMS = 150
      MaxVelocity = 10
      MinVelocity = 5
      PushesEmitter = 0
   AddEmission = Emission
      EmittedParticle = MOPixel
         CopyOf = Plasma Chaser Particle 2
      ParticlesPerMinute = 1600
      Spread = 3.14
      StartTimeMS = 50
      MaxVelocity = 5
      MinVelocity = 2
      PushesEmitter = 0
   AddEmission = Emission
      EmittedParticle = MOPixel
         CopyOf = Kicks
      Spread = 3.14
      StartTimeMS = 6000
      MinVelocity = 20
      MaxVelocity = 20
   EmissionEnabled = 1
   EmissionsIgnoreThis = 1
//   ParticlesPerMinute = 3000
   BurstSize = 1
   BurstScale = 1
   BurstDamage = 0
   BurstTriggered = 0
   EmissionDamage = 0
   Flash = None
   FlashOnlyOnBurst = 0
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Plasma Chaser Particle 1
      Count = 60
      Spread = 3.14
      MaxVelocity = 45
      MinVelocity = 45
      InheritsVel = 0
      LifeVariation = 0.30
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Plasma Chaser Particle 2
      Count = 30
      Spread = 3.14
      MaxVelocity = 30
      MinVelocity = 30
      InheritsVel = 0
   GibImpulseLimit = 3000
   GibSound = Sound
      AddSample = ContentFile
         Path = BW.rte/Sounds/ShockBallExplosion.wav





Then the next thing is the repeller field generator. Its supposed to accelerate particles away from the field.
It needs to affect MOPixels, MOSParticles, MOSRotatings, AEmitters and TDE's. Basicly particles and items. Not actors.

Code:
function Create(self)
end

function Destroy(self)
end

function Update(self)

    for actor in MovableMan.Particles do
       if (actor.ClassName == "MOPixel") and (actor.HitsMOs == 1) and ( not(actor.PresetName == "Mercenary Jet Particle 1")) and ( not(actor.PresetName == "Mercenary Jet Particle 2")) and ( not(actor.PresetName == "Mercenary Jet Particle 3")) then
         local diff = math.sqrt(math.pow((actor.Pos.X-self.Pos.X),2) + math.pow((actor.Pos.Y - self.Pos.Y),2))
         if diff < 40 then  -- the smaller the value the sharper the bullets turn when they are close
            diff = 40
         end
         if diff < 200 then    --maximum range
            local gravitymultiplier = 25  -- use this to adjust gravity to a fitting value
            local diffx = actor.Pos.X - self.Pos.X
            local diffy = actor.Pos.Y - self.Pos.Y
            local ang = math.atan2(diffy,diffx)
            actor.Vel.Y = -(actor.Vel.Y - ((gravitymultiplier / math.pow(diff,2)) * math.sin(ang)))
            actor.Vel.X = -(actor.Vel.X - ((gravitymultiplier / math.pow(diff,2)) * math.cos(ang)))
         end
      end
   end
end


Wed Apr 29, 2009 11:51 am
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Geti wrote:
Code:
for reverse in MovableMan.Objects do
   reverse.Vel.X = reverse.Vel.X * -1
   reverse.Vel.Y = reverse.Vel.Y * -1
end
should do it.
and also
Code:
self.GibThis()
should gib the object should it not?


Perfect! Both of these worked! The proxy mine works like a charm! :D

The other one however... all the guns are using "FireIgnoreThis = 1". :oops:
Looks like I could try enabling those. Are you guys ok on that your own gun can blow your arm off?
Its pretty easy to die from enemy fire anyways, so this is a pretty hard choice to make.
Rocket launchers ofcourse work like they would if you shoot them at your feet.


Wed Apr 29, 2009 12:14 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Lua based map objects, help! (BW related)
It's your decision, but I'm fine with being able to shoot myself with a weapon, just as long as in normal firing your arms don't fall off randomly. But of course you'd never be as unprofessional as to do that now would you Numgun? =)


Wed Apr 29, 2009 12:22 pm
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
411570N3 wrote:
It's your decision, but I'm fine with being able to shoot myself with a weapon, just as long as in normal firing your arms don't fall off randomly. But of course you'd never be as unprofessional as to do that now would you Numgun? =)


No they shouldnt. I usually place the muzzleoffset a couple pixels forward where the actual barrel is and then adjust the flash with that. I'm just thinking if youre moving too fast or youre rolling barrels which you'll be doing suprisingly often in a deathmatch you might accidently shoot at your foot.


Wed Apr 29, 2009 1:06 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 134 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.045s | 14 Queries | GZIP : Off ]