Jump to content

Thought some might be interested in this dragonfly strategy


Recommended Posts

On 3/20/2018 at 3:27 PM, Dekay said:

I’ve tried to figure out the logic behind Dragonfly in the past but I wasn’t familiar enough with the LUA language or the DST codebase. What you present here though confirms the random nature of DF enraging I observed. 50/50 chance eh if Lavae die naturally?

Well, in prefabs/dragonfly.lua there's a "TransformFire" function that looks promising. That file only saves that function for later though. At the bottom, it does a few things including

inst:SetStateGraph("SGdragonfly")

and "on fire and extremely angry" sure sounds like a "state" to me!

So in stategraphs/SGdragonfly.lua, "TransformFire" is called once, in the "timeline" function, in a thingy called "State" named "transform_fire." And... of course they had to get fancy and say:

inst.sg:GoToState("transform_"..data.transformstate)

so "transform_" .. whatever -> "transform_fire" if you call transform(inst, ...transformstate = "fire"...) That's the end of that lead though, because again that transform function's only defined, not used. There is

EventHandler("transform", transform)

But again, that only sets up things to happen, when something else causes the "transform" event, with "transformstate" set to fire. However, after randomly searching the code for "transformstate" I see that our original prefabs/dragonfly.lua file sets

Quote

        inst:PushEvent("transform", { transformstate = "fire" })

in a function called "OnLavaeDeath." Following the breadcrumbs, that's called when "rampingspawner_death" event happens. Now "rampingspawner" is a component, that can spawn anything with sort of a "ramping up in waves" algorithm. And wouldn't you know, absolutely nothing does that other than a dragonfly's lavae, so spawn_prefab = "lavae" is hardcoded into components/rampingspawner.lua by default.

Continuing to work backward... rampingspawner:SpawnEntity, called by dragonflybrain:OnSpawnLavae, called by the "lavae" state in stategraphs/SGdragonfly.lua, but only if "wantstospawn" is true. We already know the dragon fly wants to spawn lavae once she takes enough damage, so no need to look further. When she takes enough damage, she enters the "lavae" state, calls OnSpawnLavae in that state's timeline, which spawns a lavae using "rampingspawner" and then... keeps doing so until the latest wave of puked fire grubs is done. Then whenever a lavae dies, OnLavaeDeath is called, and in that function, an event is pushed where transformstate = "fire," but only if there are no lavae left alive in the current wave.

There's nowhere that it says "if randomfiftypercentIguesslol() and data.remaining_spawns <= 0" so it's safe to say that 100% of the time, once the last lavae in a wave dies, the dragonfly gets enraged. Annnnd that's how I figure out how to follow the code's logic. Just start in prefabs/ work backwards, and if all else fails, grep the source files for what you seek!

7 hours ago, kertinker said:

Yes, I realize this. And if you spend 1.4 pan flutes in order to kill two dragonflies for guaranteed 2 green gems, then you lose 1 pan flute before you can deconstruct it. If you get green gems from a "worst" source first, you save the first pan flute. Which is kind of dumb considering you can afford to lose one pan flute, if you'll be able to reconstruct another one after that forevermore. I was just remarking that maybe if you were going to explore the ruins already, you might not have to lose the first pan flute. For one-off boss rush speed runs, it'd be extra dumb to spend a lot of time avoiding wasting "irreplacable" resources.

I saw the video. When the dragonfly died, the panflute had only 3 uses left. Was OP using the pan flute too much?

I mean, you could quench the enraged state with water balloons, instead of panfluting her. Is that what you do, to reduce the amount of panflute uses down to 3 or 4 instead of 7 or 8? Might take a while to hunt a dozen or so mosquitos.

I mean even assuming one pan flute per combat it’s still pretty good, for a green gem each time just fighting dfly twice will fund 5 fights even with the worst luck, and if you manage to get two gems then you’ll fund 5 fights instantly.

Assuming you kill dragonfly day 1 two green gems or one deconstruction staff will fund you to day 100. You have to go to the ruins anyways to get a deconstruction staff so extra green gems are easy to come by.

I’ll try to see if I can cut down on pan flute use for long-term situations though.

6 hours ago, kertinker said:

Well, in prefabs/dragonfly.lua there's a "TransformFire" function that looks promising. That file only saves that function for later though. At the bottom, it does a few things including


inst:SetStateGraph("SGdragonfly")

and "on fire and extremely angry" sure sounds like a "state" to me!

So in stategraphs/SGdragonfly.lua, "TransformFire" is called once, in the "timeline" function, in a thingy called "State" named "transform_fire." And... of course they had to get fancy and say:


inst.sg:GoToState("transform_"..data.transformstate)

so "transform_" .. whatever -> "transform_fire" if you call transform(inst, ...transformstate = "fire"...) That's the end of that lead though, because again that transform function's only defined, not used. There is


EventHandler("transform", transform)

But again, that only sets up things to happen, when something else causes the "transform" event, with "transformstate" set to fire. However, after randomly searching the code for "transformstate" I see that our original prefabs/dragonfly.lua file sets

in a function called "OnLavaeDeath." Following the breadcrumbs, that's called when "rampingspawner_death" event happens. Now "rampingspawner" is a component, that can spawn anything with sort of a "ramping up in waves" algorithm. And wouldn't you know, absolutely nothing does that other than a dragonfly's lavae, so spawn_prefab = "lavae" is hardcoded into components/rampingspawner.lua by default.

Continuing to work backward... rampingspawner:SpawnEntity, called by dragonflybrain:OnSpawnLavae, called by the "lavae" state in stategraphs/SGdragonfly.lua, but only if "wantstospawn" is true. We already know the dragon fly wants to spawn lavae once she takes enough damage, so no need to look further. When she takes enough damage, she enters the "lavae" state, calls OnSpawnLavae in that state's timeline, which spawns a lavae using "rampingspawner" and then... keeps doing so until the latest wave of puked fire grubs is done. Then whenever a lavae dies, OnLavaeDeath is called, and in that function, an event is pushed where transformstate = "fire," but only if there are no lavae left alive in the current wave.

There's nowhere that it says "if randomfiftypercentIguesslol() and data.remaining_spawns <= 0" so it's safe to say that 100% of the time, once the last lavae in a wave dies, the dragonfly gets enraged. Annnnd that's how I figure out how to follow the code's logic. Just start in prefabs/ work backwards, and if all else fails, grep the source files for what you seek!

I’ve already explained why this is wrong in the threads I linked.

Essentially there’s a pointless timer running increasing the spawns of the lavae which happens by health trigger stuff anyways, which runs on the same exact time that the lavae death timer runs on.

The code has to choose which one to run first.

So if the spawns increase first it won’t enrage, and if the lavae dies first it will.

@kertinker Water ballons is a fun alternative to try. But seriously, the panflute vs DF situation is not an actual situation. I mean, you can have easily 4 pan flutes in a world, you can kill 3 DF with one pan flute and you can deconstruct 10 pan flutes with one green staff. 

Easy peezy lemon squanchy

12 hours ago, Whoneedspacee said:

Essentially there’s a pointless timer running increasing the spawns of the lavae which happens by health trigger stuff anyways, which runs on the same exact time that the lavae death timer runs on.

The code has to choose which one to run first.

Oh, I didn't see any race conditions. That's... actually kind of interesting! So if the next wave triggers, increasing the amount in a wave, so then the last one is now far from the last one, even though the rest never got a chance to be created.

Anyway mostly I was just describing how I figure out the logic of stuff, in case it helped Dekay with code analysis in general. Or at least to show people how bad I am at code analysis. :?

 

From the video conditions, you only need 1 pan flute use per lavae wave (would have been 3) as you can wait out the enrage if it's out of aggro range.

It can be reduced even more by exploiting the race condition as long as you can do damage during the lavae phase.

15 hours ago, HamBatter said:

From the video conditions, you only need 1 pan flute use per lavae wave (would have been 3) as you can wait out the enrage if it's out of aggro range.

It can be reduced even more by exploiting the race condition as long as you can do damage during the lavae phase.

Yeah if you’re playing Wolfgang with armor you can just straight up kill the lavae, but it’s generally hard and basically impossible with weak characters like Wes and Wendy so I wanted to show off that strategy.

The video abuses pan flute uses to not get hit as well, so as you stated simply wait out it’s enrage and take a hit when you enter back into the fight. I needed to pan flute because I obviously didn’t want to get hit when re-initiating the fight.

At best this strategy could be done by Wendy / Wes with a football helmet and only using 3 pan flute uses for the time to kill the last lavae, easily.

Or just ice staff now that I think about it, you could pretty easily just forego the pan flute when you can wait out the enrage and destroy lavae.

8 hours ago, Whoneedspacee said:

The video abuses pan flute uses to not get hit as well, so as you stated simply wait out it’s enrage and take a hit when you enter back into the fight. I needed to pan flute because I obviously didn’t want to get hit when re-initiating the fight.

Oh okay, that makes more sense. It's still an awesomely epic boss rush, even if you abused that poor pan flute.

Does the ice staff work? The only thing I knew that put out the enraged dragonfly was if she got too wet, i.e. water balloons.

1 hour ago, kertinker said:

Oh okay, that makes more sense. It's still an awesomely epic boss rush, even if you abused that poor pan flute.

Does the ice staff work? The only thing I knew that put out the enraged dragonfly was if she got too wet, i.e. water balloons.

I abused the pan flute because taking hits by re-initiating the fight would've killed me cause I had no armor, picking up a football helmet and not using the pan flute to re-initiate would've been easy.

I was talking about using the ice staff to kill all of the lavae and then waiting out the enrage.

A problem to consider is the dragonfly not losing aggro unless you stun him so you may still have to use the pan flute?

If that's the case the dragonfly won't enrage while he's on the ground so just kill the lavae while he's sleeping and that's just one use.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...