Author |
Message |
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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 |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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.
|
Mon May 04, 2009 2:58 pm |
|
|
piipu
Joined: Mon Jun 30, 2008 9:13 pm Posts: 499 Location: Finland
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
piipu
Joined: Mon Jun 30, 2008 9:13 pm Posts: 499 Location: Finland
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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! 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 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 |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
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 |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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 |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
|