• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

WC3 crashing issue.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
Players have found a big bug in the game I work on. I think it may have been caused by Blizzard updates since it's never happened until the last few months (That we know of). I tried this same bug with previous map versions, all the way from 2 years ago. And it crashes Warcraft on all versions.

The game is Vampirism Fire.
When a Human dies, code runs to deal with his corpse and other things like updating the multiboard.

The weird thing is, for some reason if the Human dies along the very bottom border of the map he crashes the game for everyone. Except if he dies anywhere else a tad bit higher up the game continues fine.

Screen capture - ef115d1006fbb9048e0e1568821605b6 - Gyazo

^ When a player leaves the game auto kills his player unit (Same as dying to the other team in game)

Screenshot - aea22ad4b17f2bfdba8258f8a5e8a80a - Gyazo

The code that deals with the player leaving is below. This must be a Blizzard bug right? The fact that it only occurs on a certain axis of the map and yet the death scripts have no ties to regions. My quick fix idea is to change the map so players can't be that low on the map since we've tested it 20 times and it only occrus when the human player is right next to the bottom tree lines.


The code, removes the player unit and replaces it with a 'Tombstone' looking model. It then kills all 'worker' type units owned by the player and turns all his buildings to Black/tinted to indicate that these buildings are dead. And the Vampire/other humans can kill these buildings until they expire in 90 seconds. Any info would be appreciated, are other Developers/games having similar issues with Warcraft crashing?


JASS:
public function MainHumanLeaves(integer pD, integer pK) {
    unit u = players[pD].main;
    unit new;
    timer t;
  

    // Update state
    players[pD].state = STATE_DEAD;
   multiboard_isDead[pD] = true;
    players[pD].deathTimeHuman = R2I(GameTime());
    //players[pD].humanKillerLevel = GetHeroLevel(players[pK].main);

    SetPlayerState(Player(pD), PLAYER_STATE_GIVES_BOUNTY, 0);
    //SetPlayerName(Player(pD), players[pD].name + " (Dead)");
    GoldMineIncome.onHumanDies(pD);

    // Replace human with corpse
    ShowUnit(u, false);
    new = CreateUnit(Player(pD), ID_HUMAN_CORPSE, GetUnitX(u), GetUnitY(u), GetUnitFacing(u));
    players[pD].main = new;

    if (GetLocalPlayer() == Player(pD)) {
      SelectUnit(new, true);
      SetCameraPosition(GetUnitX(u), GetUnitY(u));
    }

    RemoveUnit(u);

    // Destroy all non-structures, keep corpse
    GroupEnumUnitsOfPlayer(ENUM_GROUP, Player(pD), null);
    for(ENUM_UNIT = EnumGroupInit(); EnumGroupCheck(); ENUM_UNIT = EnumGroupEnd()) {
      if (IsUnitType(ENUM_UNIT, UNIT_TYPE_STRUCTURE) && !IsUnitType(ENUM_UNIT, UNIT_TYPE_DEAD)) {
        SetUnitOwner(ENUM_UNIT, Player(bj_PLAYER_NEUTRAL_VICTIM), false);
        TriggerRegisterUnitEvent(trg_blackBuildingsDamage, ENUM_UNIT, EVENT_UNIT_DAMAGED);
        SetUnitUserData(ENUM_UNIT, pD); // we don't use UnitUserData for anything else, right?
         SetUnitVertexColorBJ(ENUM_UNIT, 75.00, 75.00, 75.00, 35.00 );
       // Tint above
      
      }
      else if(GetUnitTypeId(ENUM_UNIT) != ID_HUMAN_CORPSE) {
        ExplodeUnit(ENUM_UNIT);
      }
    }

    // Reset Resources
    SetPlayerState(Player(pD), PLAYER_STATE_RESOURCE_GOLD, 0);
    SetPlayerState(Player(pD), PLAYER_STATE_RESOURCE_LUMBER, 0);


    TimerStart(NewTimerEx(pD), 2, false, function HumanDies);
    StartSound(gg_snd_bfbp);

    new = null;
    u = null;
  }


JASS:
  private function HumanDies() {
    timer t = GetExpiredTimer();
    integer pD = GetTimerData(t);
    unit u;

    ReleaseTimer(t);
    Bases.playerUnclaim(Player(pD));

    SetPlayerState(Player(pD), PLAYER_STATE_GIVES_BOUNTY, 1);
    SetPlayerState(Player(pD), PLAYER_STATE_RESOURCE_GOLD, 0);
    SetPlayerState(Player(pD), PLAYER_STATE_RESOURCE_LUMBER, 0);

    TimerStart(NewTimerEx(pD), 90, false, function RemoveBlackBuildings);

    u = players[pD].main;
    UnitAddAbility(u, ID_ABILITY_OBSERVE_HUMAN);
    UnitMakeAbilityPermanent(u, true, ID_ABILITY_OBSERVE_HUMAN);

    if (allowedMini[pD]) {
      UnitAddAbility(u, ID_ABILITY_TURN_MINION);
      UnitMakeAbilityPermanent(u, true, ID_ABILITY_TURN_MINION);
      DisplayTimedTextToPlayer(Player(pD), 0, 0, 30, "|cffff0000You have been bitten by a vampire and have died! You may either return as a vampire minion or observe the human side.");
   // DisplayTimedTextToPlayer(Player(pD), 0, 0, 30, "|cffff0000You are dead! You may continue to observe the human side.");
    }
    else {
      DisplayTimedTextToPlayer(Player(pD), 0, 0, 30, "|cffff0000You are dead! The vampire did not bite you... You may continue to observe the human side.");
   // DisplayTimedTextToPlayer(Player(pD), 0, 0, 30, "|cffff0000You are dead! You may continue to observe the human side.");
    }
    UnitApplyTimedLife(u, 0, 60.0);

    players[pD].main = null;
    players[pD].state = STATE_DEAD;
   multiboard_isDead[pD] = true;
    UpdateAmounts(true);
    UpdateMultiboard();
    u = null;
  }
 
Status
Not open for further replies.
Top