View unanswered posts | View active topics It is currently Tue Jun 04, 2024 11:17 am



Reply to topic  [ 4 posts ] 
 [Help] Teleportation Delivery 
Author Message
User avatar

Joined: Mon Oct 22, 2012 4:09 am
Posts: 22
Location: Columbus, Ohio
Reply with quote
Post [Help] Teleportation Delivery
I've got the concept, sprite, and methodology down, but here's my main problem.

To describe my situation, I am effectively making an invisible, massless drop crate that falls down, gibs into a wormhole emitter via Lua code, and by the simple act of gibbing, releases its contents, appearing to be a warp-in from off-map. I'm not going to pretend it's the most elegant thing ever or even terribly inventive from a beginner's perspective, but that's aside from the point.

I want the delivery method to have a purchase icon, so the false drop crate is a sprite with two frames; one of a frame halfway through the wormhole animation, the other entirely blank for when it actually exists in the game.
Initially, it worked just as I wanted it to. The icon showed up fine and the fake drop crate would be invisible until gibbed. Now, however, and I've absolutely no idea as to what I could have done wrong, the drop crate is using the first frame of its sprite at all times. I've tried forcing it to stick to the blank frame in the Update() function, but that just results in it appearing for a single frame until turning invisible.

As stated, I haven't the foggiest clue as to what I did wrong here or if it was just sheer luck or blindness on my part that I didn't see the first frame displaying earlier. I have a hunch that it's trying to open itself, which is causing the animation, but how I would prevent that or why it started now and not earlier are both questions I once again lack the answers to.

Here is the code I have so far. I'll say it again; it ain't pretty, but it works. Sort of.
INI Code:


Lua Code:


Additional things I would appreciate assistance on are how to:
1. Make the aforementioned fake teleportation refund its purchase price on activation. √ Figured this one out on my own. I used a fake secondary crate that spawns with the wormhole and zips back up into orbit through a combination of Lua positioning and INI-defined initial velocity.
2. Ensure the teleportation effect always happens at a set distance above the ground and doesn't move away from the delivery marker. √ Thanks go to Azukki, post #2.
3. Render the fake drop crate invisible to AI-controlled actors. As it stands, there's a brief period where the AI spots it, but realizes it can't affect it in any way or form, then returns to its previous business. √ Possibly fixed itself. Will report in if otherwise.
4. Likewise, make the fake drop crate unselectable. I have it invisible to the HUD, but it can still be selected as a controllable entity while it's waiting to deploy itself.


Last edited by Insano-Man on Wed Dec 12, 2012 8:52 pm, edited 2 times in total.



Mon Dec 10, 2012 10:40 pm
Profile YIM WWW
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post Re: [Help] Teleportation Delivery
It might be best overall to just use Lua to instantaneously take it from the top of the sky, to the desired height, and gib it, instead of letting it fall. Being instantaneous would completely negate most of your problems.

I think the following would be basically all you'd need to make the teleporter, well, teleport, close to the ground. This obviously doesn't conserve all those sounds and special effects and whatever you've got in the Lua, but it looks like you could just copy and paste that stuff in.

function Create(self)
self.Pos.Y = self.Pos.Y + (self.Altitude - 32)
self:GibThis()
end


But, in the future, or if you still want your teleporter to be an invisible drop crate instead of a teleporter for whatever reason, search the forums for SpriteAnimMode, that's suspect number one for when animation isn't working how you'd like. Also, having the Frame = 1 thing in the update function will keep it at frame 1, whereas having it in the create function will just start it at frame 1. Making things uncontrollable, iunno, maybe you could switch its team to the wildlife team? That might switch the teams of the contents, though, iunno. Or just make it go to the next/previous actor when someone selects it, with Lua.


Tue Dec 11, 2012 5:41 am
Profile
User avatar

Joined: Mon Oct 22, 2012 4:09 am
Posts: 22
Location: Columbus, Ohio
Reply with quote
Post Re: [Help] Teleportation Delivery
That worked perfectly, thank you.

I've noticed that, now that the wormhole placeholder isn't falling from space, the AI doesn't pay any mind to it.
However, the one problem is that it still shows up for a split second at the top of the map in its first frame. I would have this all done instantaneously to bypass it, but the issue is that I have some effects that I want to play before the portal effect appears. Namely, a radio chatter sound effect that indicates where the delivered cargo will spawn a couple seconds before it actually appears. Additionally, the way the sprite's animation plays, the payload needs to warp in a fraction of a second after it starts playing, otherwise it visibly pops out of nothing rather than popping out of the wormhole.

I tried fiddling with the team to make the placeholder unselectable, but that just ended up causing a generic "Cortex Command is not responding" crash when its cargo spawned. I used "self.Team = -1" in the Create() block - that's not wrong, is it?


Tue Dec 11, 2012 9:47 pm
Profile YIM WWW

Joined: Thu Jan 13, 2011 1:31 pm
Posts: 158
Reply with quote
Post Re: [Help] Teleportation Delivery
self.Scale = 0

can be used to make something invisible for the frame that it is called in.


Sat Jan 12, 2013 9:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

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.035s | 17 Queries | GZIP : Off ]