Joined: Mon Oct 22, 2012 4:09 am Posts: 22 Location: Columbus, Ohio
[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:
AddEffect = MOPixel PresetName = Hallick Device Particle Primary Mass = 0 LifeTime = 100 Sharpness = 8 HitsMOs = 0 GetsHitByMOs = 0 Color = Color R = 130 G = 255 B = 80 Atom = Atom Material = Material CopyOf = Air TrailColor = Color R = 130 G = 255 B = 80 TrailLength = 2 ScreenEffect = ContentFile FilePath = Base.rte/Effects/Glows/GreenSmall.bmp EffectStartTime = 0 EffectStopTime = 100 EffectStartStrength = 0.4 EffectStopStrength = 0.0 EffectAlwaysShows = 1
AddEffect = MOPixel PresetName = Hallick Device Particle Secondary Mass = 0 LifeTime = 50 Sharpness = 20 HitsMOs = 0 GetsHitByMOs = 0 Color = Color R = 255 G = 255 B = 255 Atom = Atom Material = Material CopyOf = Air TrailColor = Color R = 255 G = 255 B = 255 TrailLength = 2
AddEffect = MOPixel PresetName = Hallick Device Particle Tertiary Mass = 0 LifeTime = 25 Sharpness = 800 HitsMOs = 1 GetsHitByMOs = 0 Color = Color R = 0 G = 0 B = 0 Atom = Atom Material = Material CopyOf = Air TrailColor = Color R = 0 G = 0 B = 0 TrailLength = 2
AddActor = ACRocket PresetName = Hallick Device Activation Description = Teleports the purchased troops and equipment to a location in open terrain, damaging any nearby enemy units on arrival. Very expensive and unable to return cargo, the Hallick Device still remains one of the most effective assault deployment options available - particularly since it refunds itself as soon as it activates. Mass = 0 MaxMass = 500 Position = Vector X = 520 Y = 20 Velocity = Vector X = 0 Y = 0 HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = IMWD.rte/Effects/HDField/HDFieldDummy.bmp FrameCount = 2 ScriptPath = IMWD.rte/Effects/HDField/HDFieldActivate.lua SpriteAnimDuration = 30000 SpriteOffset = Vector X = -50 Y = -50 EntryWound = AEmitter CopyOf = Dent Metal ExitWound = AEmitter CopyOf = Dent Metal GoldValue = 350 Buyable = 1 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Air PresetName = Hallick Device Information Friction = 1.0 Bounce = 0.0 Resolution = 0 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Hallick Device Information Resolution = 0 Depth = 0 DeepCheck = 0 BodyHitSound = Sound CopyOf = Metal Body Blunt Hit Status = 0 Health = 100 ImpulseDamageThreshold = 80000 Team = 0 HUDVisible = 0 AimAngle = 0 AimDistance = 0 CharHeight = 0 HolsterOffset = Vector X = 0 Y = 0 HatchDelay = 5000 RLeg = Leg CopyOf = Null Rocket Leg ParentOffset = Vector X = 0 Y = 0 LLeg = Leg CopyOf = Null Rocket Leg ParentOffset = Vector X = 0 Y = 0 RFootGroup = AtomGroup CopyOf = Rocket Landing Gear Foot Right LFootGroup = AtomGroup CopyOf = Rocket Landing Gear Foot Left MThruster = AEmitter CopyOf = Null Emitter ParentOffset = Vector X = 0 Y = 0 RThruster = AEmitter CopyOf = Null Emitter ParentOffset = Vector X = 0 Y = 0 LThruster = AEmitter CopyOf = Null Emitter ParentOffset = Vector X = 0 Y = 0 URThruster = AEmitter CopyOf = Null Emitter ParentOffset = Vector X = 0 Y = 0 ULThruster = AEmitter CopyOf = Null Emitter ParentOffset = Vector X = 0 Y = 0 RaisedGearLimbPath = LimbPath PresetName = Rocket Gear Raised Path StartOffset = Vector X = 0 Y = 0 StartSegCount = 0 SlowTravelSpeed = 0 NormalTravelSpeed = 0 FastTravelSpeed = 0 PushForce = 0 LoweredGearLimbPath = LimbPath PresetName = Rocket Gear Lowered Path StartOffset = Vector X = 0 Y = 0 StartSegCount = 0 SlowTravelSpeed = 0 NormalTravelSpeed = 0 FastTravelSpeed = 0 PushForce = 0 LoweringGearLimbPath = LimbPath PresetName = Rocket Gear Lowering Path StartOffset = Vector X = 0 Y = 0 StartSegCount = 0 SlowTravelSpeed = 0 NormalTravelSpeed = 0 FastTravelSpeed = 0 PushForce = 0 RaisingGearLimbPath = LimbPath PresetName = Rocket Gear Raising Path StartOffset = Vector X = 0 Y = 0 StartSegCount = 0 SlowTravelSpeed = 0 NormalTravelSpeed = 0 FastTravelSpeed = 0 PushForce = 0
Taken from IMWD.rte\Effects\HDField\HDField.ini
Lua Code:
Code:
function Create(self)
self.SpawnDelay = Timer()
self.Spawned = false
self.Frame = 1
end
function Update(self)
if self.SpawnDelay:IsPastSimMS(2150) and self.Spawned == false then self.SpawnSound = CreateAEmitter("Hallick Device Spawn Dummy") self.SpawnSound.Pos = self.Pos self.SpawnSound.PinStrength = 1000 MovableMan:AddParticle(self.SpawnSound); self.Spawned = true end
if self.SpawnDelay:IsPastSimMS(2700) then self.SpawnEmitter = CreateAEmitter("Hallick Device Field Emitter") self.SpawnEmitter.Pos = self.Pos self.SpawnEmitter.PinStrength = 10000 MovableMan:AddParticle(self.SpawnEmitter); self.SpawnField = CreateAEmitter("Hallick Device Field Main") self.SpawnField.Pos = self.Pos self.SpawnField.PinStrength = 10000 MovableMan:AddParticle(self.SpawnField); for Act in MovableMan.Actors do if Act.Team ~= self.Team and Act.Vel.Largest < 4 then local Trace = SceneMan:ShortestDistance(self.Pos, Act.Pos, false) if Trace.Magnitude - Act.Radius < 80 then Act.Health = Act.Health - 20 end end end self:GibThis() end
end
Taken from IMWD.rte\Effects\HDField\HDFieldActivate.lua
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
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
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
Insano-Man
Joined: Mon Oct 22, 2012 4:09 am Posts: 22 Location: Columbus, Ohio
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
DudeAbides
Joined: Thu Jan 13, 2011 1:31 pm Posts: 158
Re: [Help] Teleportation Delivery
self.Scale = 0
can be used to make something invisible for the frame that it is called in.
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