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



Reply to topic  [ 134 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9
 Lua based map objects, help! (BW related) 
Author Message
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)
A. I don't think it's possible - MOPixels fired from guns are indistinguishable from displaced terrain I'm quite sure... you could make it a feature and make it a grenade that turns the surrounding terrain into projectiles...
B.Change the indicated values to higher ones, probably in the same ratio or something...
Code:
   actor.Vel.Y = actor.Vel.Y - (>50< / diff * math.sin(ang))
   actor.Vel.X = actor.Vel.X - (>100< / diff * math.cos(ang))


Mon May 04, 2009 12:39 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:
A. I don't think it's possible - MOPixels fired from guns are indistinguishable from displaced terrain I'm quite sure... you could make it a feature and make it a grenade that turns the surrounding terrain into projectiles...
B.Change the indicated values to higher ones, probably in the same ratio or something...
Code:
   actor.Vel.Y = actor.Vel.Y - (>50< / diff * math.sin(ang))
   actor.Vel.X = actor.Vel.X - (>100< / diff * math.cos(ang))


Are you sure?

Hell, what about if it would ignore harmless particles? How do I do that?
Or particles that have sharpness more than 1? (Although I might have had a couple guns that had sharpness lower than that...)


Mon May 04, 2009 12:42 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)
numgun wrote:
Hell, what about if it would ignore harmless particles? How do I do that?
Something like
Code:
if (particle.sharpness < 1) then
<blarglcodeblargl>
end
Problem is, as you mentioned, some weapons won't be affected because of their sharpness not being high enough.


Mon May 04, 2009 12:47 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)
What about HitsMOs? Is that possible to use? So the field would check if the particle has hitmos = 1 or it doesnt have hitsmos = 0?

And does anyone have any idea what mass or other properties the terrain knock-off pixels use? : S


Btw that increasing for blackhole grenade worked, the blackhole just shooped my guys so fast that I barely blinked. :P


Mon May 04, 2009 2:58 pm
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)
Wut? It looks like it already checks if HitsMOs is 1. It really shouldn't affect terrain particles.


Mon May 04, 2009 10:42 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
piipu wrote:
Wut? It looks like it already checks if HitsMOs is 1. It really shouldn't affect terrain particles.


Huh? I thought I never had that. o_ô
Well it runs with that code anyways so theres something wierd about it.

Is the syntax even right or is it legal to reference hitsMos?
Mainly because in some cases I used LifeTime in normal .ini modding while its only Lifetime in lua code. Not sure, do capital letter have an effect?

What if it would check if the particle is not HitsMOs = 0? How would that code look like?


Mon May 04, 2009 11:36 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Part of your problem may be that HitsMOs is a boolean value in Lua. So, it should check whether HitsMOs == true or HitsMOs == false instead of the number values.
Also, I'm pretty sure terrain particles do hit MOs.


Tue May 05, 2009 12:09 am
Profile WWW
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)
I tried it with my vortex gun and particle.HitsMOs == 1 prevented the terrains from being sucked in. I've never noticed a terrain particle colliding with anything other than the ground so I don't think they're HitsMOs = 1 stuffs.


Tue May 05, 2009 7:31 am
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Oh crap, I just noticed that I posted the code for the accelerator module and not the grenade. The grenade didnt have that HitsMOs == 1 part at all.

Although I havent tested the module either, but we'll see. I'm gonna go test them now.

EDIT: Yup, that was it. I totally missed that. Now the terrain particles are no longer being accelerated and bomb and the module work perfectly.

I also used TLB's suggestion to make them do HitsMOs == true.

Thanks again guys!


Tue May 05, 2009 2:24 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Lua based map objects, help! (BW related)
A new challenge arises!

I just realized the lightning gun can be made to work like it should be since we got Lua. Back in the while I started making this, I had to do ridiculous hacky stuff to make it do things, but even then it wasnt fully succesful.

The lightning gun does this: Its a gun with a short range that projects an MOSR at a certain preset distance. The purpose of this MOSR is to capture its prey and drag it to its centre point swiftly. Like a gravity gun.

So what the code needs to to do is to check whether an actor or item with 0 or no pinstrength is within the range of the MOSR and then drag them to the center of it.

--Hold on, I'm gonna test my code first, if I fail I'll be back soon.--

Yeah, success!

Image

It works and its rather dangerous to use since if the corpse will fling out of the vortex in your face, decapitation is imminent, but since its so damn powerful and can reach players behind walls and already a single shot from this can make an actor act like superball boucing all over the stage, so I think its a cool drawback :D

Heres the code anyways incase someone wants to learn:

Code:
function Create(self)
end

function Destroy(self)
end

function Update(self)
   --This code sees if an actor is within range and then gravitates them to the middle of the object.
   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 < 2 then
         diff = 2
      end
      if diff < 65 then --Range of effect. 65 pixels for this case.
         local diffx = actor.Pos.X - self.Pos.X
         local diffy = actor.Pos.Y - self.Pos.Y
         local ang = math.atan2(diffy,diffx)
         --To be honest I dont how these two below work but if you
         --make them have higher values, they will make the pull stronger.
         actor.Vel.Y = actor.Vel.Y - (20 / diff * math.sin(ang))
         actor.Vel.X = actor.Vel.X - (200 / diff * math.cos(ang))
--         if diff < 35 then
--            actor:GibThis()
--         end
      end
   end
   --The following is the same for items.
   for item in MovableMan.Items do
      local diff = math.sqrt(math.pow((item.Pos.X-self.Pos.X),2) + math.pow((item.Pos.Y - self.Pos.Y),2))
      if diff < 5 then
         diff = 5
      end
      if diff < 70 then --Range within it will affect. In this case 70 pixels.
         local diffx = item.Pos.X - self.Pos.X
         local diffy = item.Pos.Y - self.Pos.Y
         local ang = math.atan2(diffy,diffx)
         item.Vel.Y = item.Vel.Y - (20 / diff * math.sin(ang))
         item.Vel.X = item.Vel.X - (200 / diff * math.cos(ang))

      end
   end
end


Tue May 05, 2009 4:10 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)
New idea:
Grenade that makes a temporary are where all velocity is put on hold. What I mean is that they stop moving until the zone dissappears, at which point they will regain their velocity.


Wed May 06, 2009 10:40 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)
411570N3 wrote:
New idea:
Grenade that makes a temporary are where all velocity is put on hold. What I mean is that they stop moving until the zone dissappears, at which point they will regain their velocity.


Slow field is pretty much that. No need to make a slightly different version of it.


Wed May 06, 2009 11:13 am
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)
He might want it to stop all tougether.

Set veloctiy of everyting to 0 on creation, saving it into a table.

Then when the feild stops, write the speeds recorded in the table to the actors/particles/ect.

This assumes that lua always goes though the list in the same order, and that nothing unexpected hops in or out during processing.


Thu May 07, 2009 1:28 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Lua based map objects, help! (BW related)
Pinning does the exact same thing, as it conserves velocity. The table would be good for storing what was already pinned before, though.


Thu May 07, 2009 4:18 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 134 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9

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.040s | 13 Queries | GZIP : Off ]