Goblin Invasion

Discussion in 'PC' started by zenikk, May 20, 2011.

Thread Status:
Not open for further replies.
  1. zenikk

    zenikk Hornet

    i have gone gone the entire game without a goblin invasion and i have been reading that it is just a mater of destroying shadow pearls but the world i am in is almost out of pearls. is that the only trigger or is it something else?
  2. H3xer1n

    H3xer1n Green Slime

    it has nothing to do with shadow pearls. goblin invasions are random, there's literally nothing you can do to influence them
  3. DeLong

    DeLong Green Slime

    Shadow Orbs*
    And just wait. I was just working on my house and they came twice. It was kind of annoying.
  4. SundownMecha

    SundownMecha Green Slime

    I think its based on the size of the house but it might be truly random.
  5. Riion

    Riion Green Slime

    I have also had two attack my mushroom base, their not much of a prolem to deal with considering the sunfury makes short work of everything.
  6. Okiesmokie

    Okiesmokie Squirrel

    Actually it does ;) You have to have at least one orb smashed to get an invasion. You also need to have at least one person in the game with 200+ current* health, and each person with 200+ health increases the size of the invasion by 50. Beyond that, it's completely random when it happens. It checks whether it should start an invasion right when the day starts. Meaning you will never get an invasion at night.

    * Thanks Vinzent Zeppelin for querying about that
    Circulus likes this.
  7. Poring

    Poring Cursed Skull

    I had one on my server when I was alone. GOBLINS EVERYWHERE.
  8. ElGato

    ElGato Green Slime

    And, how did you get this information? :V
  9. Okiesmokie

    Okiesmokie Squirrel

    By using the Microsoft ILDasm tool and having knowledge of MSIL :p
    Trippy clock likes this.
  10. Acanafrog

    Acanafrog Green Slime

    hmm thats funny my friend got on at night ...
  11. Haku

    Haku Green Slime

    I've had 2 invasions so far, both occurred the morning after I fought bosses.
  12. Okiesmokie

    Okiesmokie Squirrel

    Are you sure? It triggers at the very start of day, so it may have looked like night but it wasn't. If you have a screenshot of goblins + zombies/eyes I'd like to see it :)

    The code, I converted it to C# to make it more readable, and placed comments to describe what it's doing :)

    // The time loop:
    if(Main.time 32400) {           // 32400 units is the maximum for the "time" (not sure what they represent)
    if(Main.invasionDelay 0) {    // Checks if you have a recent invasion
    Main.invasionDelay--;       // Reduces the number if you do.  (The number is how many days ago your invasion was)

    // Do various first-of-day cleanups
    WorldGen.spawnNPC 0;
    Main.checkForSpawns 0;
    Main.time 0;              // Resets the time to 0 (Proves that the day cycle is 0-32400 units)
    Main.bloodMoon false;
    Main.dayTime true;        // Self-explanitory, but proves that 0 -> 32400 is day -> night

    Main.moonPhase >= 8) {
    Main.moonPhase 0;

    Main.netMode == 2) {
    NetMessage.SendData(7, -1, -1""00F0F0F);

    // This is the random check to start the invasion
    if((Main.netMode != 1) && (Main.rand.Next(15) == 0)) {
    Main.StartInvasion();   // <- Starts the invasion (See the next function)
    // Invasion starting function:
    private static void StartInvasion() {
    int i;  // Storage variables, for counting later
    int i1;
    WorldGen.shadowOrbSmashed) {    // Checks if you've smashed any orbs
    return;                         // If you haven't, it returns (Doesn't start an invasion)
    Main.invasionType != 0) || (Main.invasionDelay != 0)) {
    // If you had an invasion recently, or there is one goin on right now
    }                                   // it will return and not start an invasion
    i1 0;
    i1 8) {
    // Loop that counts how many people in your game have >= 200 health
    if((Main.player[i1].active) && (Main.player[i1].statLife >= 200)) {
    <= 0) {    // If there are none with 200+ health
    return; // it won't start the invasion
    Main.invasionType 1;
    Main.invasionSize 100 + (50 i); // Increases the invasion size based on how many people
    Main.invasionWarn 0;              // have 200+ health
    if(Main.rand.Next(2) != 0) {        // Random function to determine where the invasion will start
    Main.invasionX = (double)Main.maxTilesX;
    Main.invasionX 0;
    There's no spoiler tags on this forum, so sorry for the wall-of-code :(
  13. Poring

    Poring Cursed Skull

    You're a hero~
    How does it work when you get in and out of the dungeon? When I break the walls and go into the hell world it just spawns hell mobs immediately.
  14. Okiesmokie

    Okiesmokie Squirrel

    It only spawns dungeon mobs within the confines of the dungeon walls, so if you break the dungeon walls it's going to spawn mobs from whatever is on the other side :p
  15. Poring

    Poring Cursed Skull

    So it depends on where my character is located? Because the dungeon is like 5 tiles away.
  16. Teanji

    Teanji Blazing Wheel

    So you have to have at the very least smashed a single Shadow Orb (on the world your currently on) and consumed 5 Heart Crystals for an invasion.
    Sounds pretty fair to me.. Harsh in some instances, but fair.
  17. Okiesmokie

    Okiesmokie Squirrel

    I just poked through the code and yeah. If you broke the wall to the dungeon it would allow hell mobs to spawn inside the dungeon, but dungeon mobs should not be able to spawn outside of the dungeon. Dungeon mobs will only spawn if you are physically inside the dungeon.

    (Also I found something else interesting, I always thought blood moons made things spawn faster, but they don't. Things actually spawn at a 30% rate (not increased rate, 30% of the normal spawn rate), but there is a possibility for *more* spawns, 80% more to be exact)
  18. Vinzent Zeppelin

    Vinzent Zeppelin Cursed Man

    The short version of what Okiesmokie posted: If you have broken at least one shadow orb and have 200 or more health (whether this is maximum or current is unclear), and an invasion hasn't happened recently (again, how the initial value of invasionDelay is determined is unclear), there's a 6.25% chance each morning that an invasion will occur.
  19. Okiesmokie

    Okiesmokie Squirrel

    invasionDelay is set to 7 as soon as you kill the last Goblin from the invasion. So it's 7 in-game days that you must wait to have another invasion.

    private static void UpdateInvasion() {
    Main.invasionType <= 0) {
    Main.invasionSize <= 0) {
    Main.invasionType 0;
    Main.invasionDelay 7;

    // ...
    I also already summarised it in my initial post in this thread ;) And it's actually a 6.666~ percent chance, 1 in 15. (don't let the 0 index confuse you, it goes 0-14 instead of 1-15)

    Edit: And oh wow, you are absolutely correct. it is 200+ *CURRENT* life, not max. That changes things completely. Make sure you are healed up before dawn comes if you want an invasion!

    In the player class:
            public int statLifeMax;
    int statLife;
  20. MarthX

    MarthX Hell Bat

    Really cool info but I wonder, with the map generation program, it lists how many shadow orbs have been broken but it's not a real total. It's the total to see if it should summon eater. It resets at 3. Maybe the game goes by that number. If that's the case then you can't have an Invasion if you haven't broken any orbs after summoning Eater on your third.
    rousseau likes this.
Thread Status:
Not open for further replies.

Share This Page