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



Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
 Changing an Actor's body sprite depending on condition? 
Author Message

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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).


Sun Jun 28, 2009 7:29 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: Changing an Actor's body sprite depending on condition?
http://www.datarealms.com/wiki/index.ph ... rite#Frame
That should work.


Sun Jun 28, 2009 7:35 pm
Profile WWW
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post 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 )


Sun Jun 28, 2009 8:08 pm
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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)


Sun Jun 28, 2009 8:26 pm
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Sun Jun 28, 2009 9:07 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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.


Sun Jun 28, 2009 11:17 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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.


Sun Jun 28, 2009 11:28 pm
Profile WWW
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post 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?


Mon Jun 29, 2009 6:58 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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.


Mon Jun 29, 2009 7:37 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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).


Mon Jun 29, 2009 7:40 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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..


Tue Jun 30, 2009 12:50 am
Profile WWW
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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?


Tue Jun 30, 2009 12:54 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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.


Tue Jun 30, 2009 1:03 am
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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


Tue Jun 30, 2009 1:08 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Changing an Actor's body sprite depending on condition?
Fun stuff. Maybe that could be used in build 24/25.


Tue Jun 30, 2009 1:10 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page 1, 2  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.092s | 13 Queries | GZIP : Off ]