Data Realms Fan Forums
http://45.55.195.193/

Changing an Actor's body sprite depending on condition?
http://45.55.195.193/viewtopic.php?f=73&t=15606
Page 1 of 2

Author:  numgun [ Sun Jun 28, 2009 7:29 pm ]
Post subject:  Changing an Actor's body sprite depending on condition?

I'm making a multimode vehicle, and if what the topic title says its possible, it will make the vehicle look much more dynamic.

So let me rephrase the question:

Is is possible to change an Actor, AHuman, ACrab or an ACraft's main sprite with Lua ingame on the run?
Say let it check for a condition or a switch and then assign the sprite the function is supposed to give it.


An an example, a variable spider tank: When in position A, it would switch to sprite A (spider mode).
And relatively when in position B, it would switch to sprite B (tank treads mode).

Author:  TheLastBanana [ Sun Jun 28, 2009 7:35 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

http://www.datarealms.com/wiki/index.ph ... rite#Frame
That should work.

Author:  Areku [ Sun Jun 28, 2009 8:08 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

A spider robot that transforms into a tank with threads? You've definitely been playing too much Lost Planet, Numgun.

But wouldn't it be better to make the legs rotate until under the main body ( you may remember that the spider robot in LP had the treads attached to the outer part of the legs ) using a crouchpath or something, and then making the unit move using a jeep-like script? That way, the leg movement would look more dynamic, and you could define the movement speed on each of the modes more easily. ( I guess :P )

Author:  numgun [ Sun Jun 28, 2009 8:26 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

Areku wrote:
You've definitely been playing too much Lost Planet, Numgun.


Hahaha stop it! xD
You busted me again although that was really just an example,
but yes, the idea is certainly from that NEVEC tank in Lost Planet.

I'm really making the Turbokat from Swat Kats. (Its a VTOL jet fighter)
It will need this to change between flight modes:
(VTOL mode <-> Jet mode)

Author:  piipu [ Sun Jun 28, 2009 9:07 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

If you want to use Mail's attachable lua, you could have a few attachables on top of the chest and do Scale = 0 to all but one of them. This way it could have animations.

Author:  numgun [ Sun Jun 28, 2009 11:17 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

piipu wrote:
If you want to use Mail's attachable lua, you could have a few attachables on top of the chest and do Scale = 0 to all but one of them. This way it could have animations.


: /

No thanks.
Thats just making the simple matter way too complicated.

The function TLB pointed out is pretty much exatcly what I could use.
And not only that, but it can do alot more than I though.

Author:  Geti [ Sun Jun 28, 2009 11:28 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

self.Frame works fine. just animate it with lua timers.
something like
Code:
[create stuff]
self.issquirtingfluideverywhere = false
self.frametimer = Timer()
self.framedelay = number
self.framenumber = 0
self.frameamount = self.FrameCount / 2

[updatestuff]
if self.frametimer:IsPastSimMS(self.framedelay) then
self.frametimer:Reset()
if self.issquirtingfluideverywhere then
self.Frame = self.frameamount + self.framenumber
else
self.Frame = self.framenumber
end
end
self.framenumber = self.framenumber + 1
if self.framenumber > self.frameamount then
self.framenumber = 0
end
end

or whatever.

Author:  Asatruer [ Mon Jun 29, 2009 6:58 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

A spider-tank that can walk or roll brought to my mind images of Shirow's Fuchikoma/Tachikoma/Think-Tank from the various Ghost in the Shell comics/movies/tv-shows. That video has a number of annoying graphics effects added, but it was the most complete look at the movement abilities.

Could the same Frame lua work on the legs of an ACrab, or AHuman? Or is it limited to the main sprite?

Author:  numgun [ Mon Jun 29, 2009 7:37 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

I wonder if this Frame() will work on guns. Then 'd be able to make dymanic energy guns that will open up to show its deadliness when it has been charged enough.

Author:  Grif [ Mon Jun 29, 2009 7:40 pm ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

Frame() would be a function.

gun.Frame is a property; it indicates the frame number.

If you iterate through all attachables and then make sure that your gun is attached to the right actor, then you should be able to animate through the frames, yes (object oriented programming yano).

Author:  Geti [ Tue Jun 30, 2009 12:50 am ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

yes it could. it can also be used to animate pinned objects. it would only work on dedicated actors though, unless you wanted to do a heap of iteration..

Author:  CrazyMLC [ Tue Jun 30, 2009 12:54 am ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

Could you, say, make a dropship more damaged when it's health went below 30?

Author:  Geti [ Tue Jun 30, 2009 1:03 am ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

yes. if you can check a variable on something, you can change something in response to it. just try ♥♥♥♥ out, its not that hard.

Author:  numgun [ Tue Jun 30, 2009 1:08 am ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

CrazyMLC wrote:
Could you, say, make a dropship more damaged when it's health went below 30?


Absolutely. With the sound of things it might be as easy as this:

Code:
if self.Health < 30 then
--Sprite changing function is a GO
end

Author:  CrazyMLC [ Tue Jun 30, 2009 1:10 am ]
Post subject:  Re: Changing an Actor's body sprite depending on condition?

Fun stuff. Maybe that could be used in build 24/25.

Page 1 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/