View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:22 am



Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
 Lua Request- HALP 
Author Message
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post Re: Lua Request- HALP
piipu wrote:
You should not go guessing things like that. Anyways, for the script:
Code:
function Update(self)
 if not MovableMan:IsActor(self.target) then
  local dist = 600
  for actor in MovableMan.Actors do
    local distvec = SceneMan:ShortestDistance(self.Pos , actor.Pos , true)
    if distvec.Magnitude < dist then
      dist = distvec.Magnitude
      self.target = actor
    end
  end
 else
  local distvec(self.Pos , self.target.Pos , true) --if the objects seem to be gravitating away from each other, swap self.Pos and self.target.Pos
  self.Vel = self.Vel + distvec / distvec.Magnitude ^ 2 * 100 --you can increase gravity by increasing the 100 here.
 end
end

so wait, thats the actual function.update() i need? wow thanks! Imma try this out as soon as I get this other thing to work... but its not a lua problem.

Maybe one of you can help me with this... its really dumb. I had an object with 1 gib, and it worked perfectly. I added a second gib, and then neither gib works, but it doesn't crash. would 2 hitsMOS = 0 things gibbing at the same x,y coordinate make it not work, or can you use an MOPixel as a gib?

CrazyMLC wrote:
Geti wrote:
CrazyMLC wrote:
Fine, fine. function.
you're still wrong with the rest of what you said.. you do not need an "== true" to check for trueness, if there is no equality expressed the interpreter checks for trueness, meaning you can use things like "if MovableMan:IsActor(thing) then" and it will work fine.

I was referring to that particular function needing an argument, according to the Wiki. It seems you didn't read my post saying why I think that. You also didn't see the disclaimer. Or the link. Or the quote from the Wiki
If you think you're correct then change the Wiki, because then it is wrong.


The wiki is wrong, I've used that code without the "== true", the wiki is wrong.


Tue Oct 13, 2009 12:58 am
Profile YIM WWW
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 Request- HALP
Miles is right, you don't need to check for trueness most of the time.


Tue Oct 13, 2009 1:39 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua Request- HALP
TheLastBanana wrote:
Miles is right, you don't need to check for trueness most of the time.
hey man.

Miles_T3hR4t wrote:
so wait, thats the actual function.update() i need? wow thanks! Imma try this out as soon as I get this other thing to work... but its not a lua problem.

Maybe one of you can help me with this... its really dumb. I had an object with 1 gib, and it worked perfectly. I added a second gib, and then neither gib works, but it doesn't crash. would 2 hitsMOS = 0 things gibbing at the same x,y coordinate make it not work, or can you use an MOPixel as a gib?
it isn't function.update(), its just Update(), function is telling the interpreter that you are defining a function.
that niggle aside, yes you can use a MOPixel as a gib, no i dont know what the problem is. do you mean 2 things gibbing or 2 gibs being produced by 1 thing gibbing?


Tue Oct 13, 2009 7:23 am
Profile WWW
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post Re: Lua Request- HALP
TDE Gibs into AEmitter, works fine

TDE Gibs into AEmitter AND an MOPixel, Neither the AEmitter nor MOPixel are created.

I also wouldn't need the MOPixel if i could get a screen effect / glow to work on the AEmitter. for some reason when I add the glow, it doesn't work either. if it makes any difference the glow is 376 x 376.


Tue Oct 13, 2009 2:49 pm
Profile YIM WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua Request- HALP
glow should be attached to the flash of the aemitter, not the aemitter itself.


Tue Oct 13, 2009 8:21 pm
Profile WWW
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post Re: Lua Request- HALP
Geti wrote:
glow should be attached to the flash of the aemitter, not the aemitter itself.

Well, I didn't have a flash, so I added one... and now it has the proper glow, but its placing it about 80 pixels to the RIGHT of the AEmitter itself. wtf is going on with this?

and now i'm having another problem, again... the TDE i'm using that creates the AEmitter, as a gib, when the TDE Gibs, it isn't creating ANY of its gibs. If I can't get this to work, I may have to totally re-design my entire mod.... again...


Tue Oct 13, 2009 10:45 pm
Profile YIM WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua Request- HALP
modify the jointoffset of the flash to be 0,0, and spriteoffset to be in.. actually it shouldnt matter if you have the jointoffset on 0,0, but make it the center for good measure.
you're probably defining the gibs wrong if they arent appearing, or your .ini is corrupted.


Wed Oct 14, 2009 1:04 am
Profile WWW
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post Re: Lua Request- HALP
Geti wrote:
modify the jointoffset of the flash to be 0,0, and spriteoffset to be in.. actually it shouldnt matter if you have the jointoffset on 0,0, but make it the center for good measure.
you're probably defining the gibs wrong if they arent appearing, or your .ini is corrupted.


I didn't define the offsets at all for the flash, which makes it automatically 0,0. my gibs are in the proper place because it WAS working. the ini isn't corrupted because then it would give me an error, it does not.

If I load the scene editor, I can place the AEmitter, and it works, so it isn't corrupt, but the flash, is appearing about 100-200 pixels to the right, even though I didn't define the offsets, making it 0,0, and since the only offset in the AEmitter is 1.5, 1.5, on a 3x3 null sprite.... I don't have any clue what's wrong, I've actually re-made it from scratch, by re-typing the code, re-arranging the code, re-naming it, flipping around where in what object things are defined (like the glow in the AEmitter, theres about 3 places it will load, only one works, or the TDE). I've tried using lua to pu the AEmitter in the right place, it didn't work.

My game just hates me.

If I can't get that part working in the next week, which should be F-ing simple but for some reason it isn't, then I'm out of the contest. I'll probably re-use the lua for a different mod though just so it doesn't seem like I wasted y'all's time. in the mean time, I need a break for a day or so. if anyone thinks of anything that could be whats wrong, it'd be much appreciated.


Wed Oct 14, 2009 3:12 am
Profile YIM WWW
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: Lua Request- HALP
I'm pretty sure flashes automatically offset the glow to be exactly 50% vertically and 100% horizontally to the right of the flash (if the emitter is facing 0').


Wed Oct 14, 2009 3:32 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Lua Request- HALP
Duh102 wrote:
I'm pretty sure flashes automatically offset the glow to be exactly 50% vertically and 100% horizontally to the right of the flash (if the emitter is facing 0').
really? i thought all glows were placed at the spriteoffset.

also miles, thats giving up way too easy. we have much more than a week from now, but i need to get mine in before then for exams. unless you have a simmilar excuse "my game hates me" is a dumb excuse. download CC again.

for the corrupt .ini, i meant for the gibs not appearing. why are you using a TDE anyway? they're just MOSRs that behave weirdly at times, and come with a free timer. try doing the addparticles thing, like the old flak cannon did on the TDE. if that doesnt work, use a MOSR or AEmitter for the bullet, and see if using a TDE is your problem. you can Lua timers into those for gibbing anyway, or use the delay variable on emissions of the emitter. for someone advocating the use of .ini over Lua coding so strongly a while ago, you seem to be neglecting backdoors.


Wed Oct 14, 2009 5:00 am
Profile WWW
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post Re: Lua Request- HALP
Geti wrote:
Duh102 wrote:
I'm pretty sure flashes automatically offset the glow to be exactly 50% vertically and 100% horizontally to the right of the flash (if the emitter is facing 0').
really? i thought all glows were placed at the spriteoffset.

also miles, thats giving up way too easy. we have much more than a week from now, but i need to get mine in before then for exams. unless you have a simmilar excuse "my game hates me" is a dumb excuse. download CC again.

for the corrupt .ini, i meant for the gibs not appearing. why are you using a TDE anyway? they're just MOSRs that behave weirdly at times, and come with a free timer. try doing the addparticles thing, like the old flak cannon did on the TDE. if that doesnt work, use a MOSR or AEmitter for the bullet, and see if using a TDE is your problem. you can Lua timers into those for gibbing anyway, or use the delay variable on emissions of the emitter. for someone advocating the use of .ini over Lua coding so strongly a while ago, you seem to be neglecting backdoors.


I'm using a TDE because it is a grenade >_>


Wed Oct 14, 2009 5:25 pm
Profile YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 26 posts ]  Go to page Previous  1, 2

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.050s | 15 Queries | GZIP : Off ]