Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Battle System Error
Battle System Error
This topic is locked. You can no longer write replies here.
May 19 2009, 6:35 am
By: Vrael  

May 19 2009, 6:35 am Vrael Post #1



I have an obscure little glitch in my battle system, that I am having a difficult time replicating and I don't know how to get rid of it because I'm not quite sure what's causing it. In my battle system, it's like Xuru or Dk3, you walk around in the world map and an enemy comes up to you, you get teleported to a little battle system and fight like 8 zerglings or something, then when you win you get moved back to the "world map" and the zergling explodes, you get gold/exp, all is right with the world. You can enter other people's fights after they've already started, but on rare occasion ( I think we're talking like 1/350 here ) if you enter someone else's fight at just the right moment, you get stuck in their battle arena. The next time they enter, you're still there, you two fight and kill the monsters, they leave and you're still stuck there. The only way to undo it is to have them kill you while you're stuck there, then you respawn in town. I was testing this earlier with Loveless (SafeReality), I was P2 and he was P3 and he got stuck. Here are the relevant P3 triggers (in order as in the trigger editor):


Trigger("Player 3"){
//This trigger denotes that P3 is not currently fighting any monsters because his/her Victory Trigger has fired and he's gotten the $$ for the fight
Conditions:
Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 0);
Deaths("Player 3", "Zerg Zergling", Exactly, 0);
Deaths("Player 3", "Terran Ghost", Exactly, 0);
Deaths("Player 3", "Jim Raynor (Marine)", Exactly, 0);
Deaths("Player 3", "Protoss Zealot", Exactly, 0);
Deaths("Player 3", "Zerg Ultralisk", Exactly, 0);
Deaths("Player 3", "Aldaris (Templar)", Exactly, 0);
Deaths("Player 3", "Tassadar (Templar)", Exactly, 0);
Deaths("Player 3", "Goliath Turret", Exactly, 0);
Deaths("Player 3", "Terran Goliath", Exactly, 0);
Deaths("Player 3", "Hunter Killer (Hydralisk)", Exactly, 0);
Deaths("Player 3", "Terran Vulture", Exactly, 0);

Actions:
Set Deaths("Player 3", "Kyadarin Crystal Formation", Set To, 1);
Preserve Trigger();
}

//-----------------------------------------------------------------//


Trigger("Player 3"){
Conditions:
Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 1);
Deaths("Player 3", "Zerg Zergling", At least, 1);

Actions:
Set Deaths("Player 3", "Kyadarin Crystal Formation", Set To, 0);
Preserve Trigger();
}

//-----------------------------------------------------------------//

Trigger("Player 3"){
//This trigger initiates a battle for P3 vs a zergling solo
Conditions:
Bring("Player 3", "Men", "Location 123", At least, 1);
Bring("Player 8", "Zerg Zergling", "Location 123", At least, 1);
Switch("Switch9", not set);
Deaths("Player 3", "Floor Hatch (UNUSED)", Exactly, 0);
Deaths("Player 3", "Protoss Gateway", Exactly, 0);
Bring("Player 3", "Terran Firebat", "Location 134", Exactly, 0);
Bring("Player 3", "Terran Marine", "Location 134", Exactly, 0);
Bring("Player 3", "Zerg Hydralisk", "Location 134", Exactly, 0);
Bring("Player 3", "Zeratul (Dark Templar)", "Location 134", Exactly, 0);

Actions:
Set Switch("Switch9", set);
Move Location("Player 3", "Terran Firebat", "Location 123", "Location 140");
Move Location("Player 3", "Terran Marine", "Location 123", "Location 140");
Move Location("Player 3", "Zerg Hydralisk", "Location 123", "Location 140");
Move Location("Player 3", "Zeratul (Dark Templar)", "Location 123", "Location 140");
Move Location("Player 8", "Map Revealer", "Location 164", "Location 134");
Remove Unit At Location("Player 8", "Zerg Zergling", 1, "Location 123");
Move Unit("Player 3", "Terran Marine", All, "Location 95", "Location 141");
Move Unit("Player 3", "Zerg Hydralisk", All, "Location 95", "Location 141");
Move Unit("Player 3", "Zeratul (Dark Templar)", All, "Location 95", "Location 141");
Move Unit("Player 3", "Terran Firebat", All, "Location 95", "Location 141");
Set Invincibility("The Tenebrous", "Men", "Location 134", disabled);
Create Unit("Player 3", "Terran Marine", 1, "Location 140");
Give Units to Player("Player 3", "Player 12", "Terran Marine", 1, "Location 140");
Set Invincibility("Player 12", "Terran Marine", "Location 140", enabled);
Create Unit("Player 6", "Zerg Zergling", 1, "Location 140");
Set Invincibility("Player 6", "Zerg Zergling", "Location 140", enabled);
Create Unit("Player 8", "Zerg Zergling", 10, "Location 142");
Modify Unit Hit Points("Player 8", "Zerg Zergling", 8, 0, "Location 142");
Order("Created by: Vrael@USEast", "Men", "Location 142", "Location 141", attack);
Set Deaths("Player 3", "Zerg Zergling", Set To, 1);
Center View("Location 141");
Display Text Message(Always Display, "\x013\x004-= \x008B A T T L E \x004=-\r\n\r\n\r\n");
Preserve Trigger();
Comment("Goblin");
}

//-----------------------------------------------------------------//

Trigger("Player 3"){
//This trigger lets P3 win and get moved back to the world map and get money/exp, solo or shared battle
Conditions:
Bring("Foes", "Men", "Location 134", Exactly, 0);
Deaths("Player 3", "Zerg Zergling", At least, 1);
Deaths("Player 3", "Floor Hatch (UNUSED)", At most, 60);
Bring("Player 3", "Men", "Location 134", At least, 1);

Actions:
Remove Unit At Location("Player 12", "Terran Marine", 1, "Location 140");
Center View("Location 140");
Set Invincibility("The Tenebrous", "Men", "Location 134", enabled);
Move Unit("Player 3", "Terran Marine", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zerg Hydralisk", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zeratul (Dark Templar)", All, "Location 134", "Location 140");
Move Unit("Player 3", "Terran Firebat", All, "Location 134", "Location 140");
Set Deaths("Player 3", "Floor Hatch (UNUSED)", Set To, 60);
Set Deaths("Player 3", "Cocoon", Set To, 1);
Set Deaths("Player 3", "Zerg Zergling", Set To, 0);
Set Switch("Switch9", clear);
Kill Unit At Location("Player 6", "Zerg Zergling", 1, "Location 140");
Preserve Trigger();
Comment("Goblin Victory");
}

//-----------------------------------------------------------------//



Trigger("Player 3"){
//This trigger is for when something goes wrong for some reason and P3's victory trigger doesn't move him back properly
//there are also a couple other triggers like this one in case this one can't move him back, but they have the same conditions, so clearly aren't firing
Conditions:
Bring("Created by: Vrael@USEast", "Men", "Location 134", Exactly, 0);
Bring("Foes", "Men", "Location 134", Exactly, 0);
Bring("Player 3", "Men", "Location 134", At least, 1);
Deaths("Player 3", "Floor Hatch (UNUSED)", At most, 50);
Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 1);

Actions:
Set Invincibility("Player 3", "Men", "Location 134", enabled);
Move Unit("Player 3", "Terran Marine", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zerg Hydralisk", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zeratul (Dark Templar)", All, "Location 134", "Location 140");
Move Unit("Player 3", "Terran Firebat", All, "Location 134", "Location 140");
Set Deaths("Player 3", "Floor Hatch (UNUSED)", Set To, 50);
Set Switch("Switch9", clear);
Preserve Trigger();
Comment("Generic Victory Hero");
}

//-----------------------------------------------------------------//

Trigger("Player 3"){
//This trigger allows P3 to enter a P2 battle
Conditions:
Bring("Player 3", "Men", "Location 136", At least, 1);
Switch("Switch8", set);
Deaths("Player 3", "Floor Hatch (UNUSED)", Exactly, 0);
Switch("Switch9", not set);

Actions:
Set Switch("Switch9", set);
Move Location("Player 3", "Men", "Location 123", "Location 140");
Move Location("Player 9", "Zerg Drone", "Location 133", "Location 134");
Move Unit("Player 3", "Terran Firebat", All, "Location 123", "Location 134");
Move Unit("Player 3", "Terran Marine", All, "Location 123", "Location 134");
Move Unit("Player 3", "Zerg Hydralisk", All, "Location 123", "Location 134");
Move Unit("Player 3", "Zeratul (Dark Templar)", All, "Location 123", "Location 134");
Set Invincibility("Player 3", "Terran Firebat", "Location 134", disabled);
Set Invincibility("Player 3", "Terran Marine", "Location 134", disabled);
Set Invincibility("Player 3", "Zerg Hydralisk", "Location 134", disabled);
Set Invincibility("Player 3", "Zeratul (Dark Templar)", "Location 134", disabled);
Center View("Location 134");
Move Location("Player 8", "Map Revealer", "Location 133", "Location 134");
Preserve Trigger();
Comment("Hero Enter P2 Hero Battle");
}

//-----------------------------------------------------------------//

Trigger("Player 3"){
//This trigger sets P3's death count to the correct setting based on what unit P2 is fighting
Conditions:
Bring("Player 3", "Men", "Location 133", At least, 1);
Bring("Player 8", "Men", "Location 133", At least, 1);
Deaths("Player 3", "Zerg Zergling", Exactly, 0);
Deaths("Player 2", "Zerg Zergling", Exactly, 1);
Bring("Player 3", "Men", "Location 134", At least, 1);
Switch("Switch9", set);

Actions:
Set Deaths("Player 3", "Zerg Zergling", Set To, 1);
Preserve Trigger();
Comment("Multi-Player-DC");
}

Trigger keys:
Location 123 = constantly centered on Player 3's hero
Location 95 = constantly centered on Player 3's hero
Location 133 = Battle Location for Player 2
Location 134 = Battle Location for Player 3
Location 164 = Unmoving location in the center of Player 3's battle arena
Location 140 = Moving Location centered on Player 3's hero at the start of every battle for P3's hero to move back to (just sits there while battle is in progress)
Location 141 = Unmoving Location Near Location 164 for allied units to move to
Location 142 = Unmoving Location Near Locatin 164 for enemies to spawn at
Switch9 = Player 3's "I AM IN A BATTLE" switch (gets "Set" at the start of every battle, and "Cleared" upon victory or death)
Switch8 = Player 2's "I AM IN A BATTLE" switch
Floor Hatch (UNUSED) = Battle Cooldown Death Timer (cannot enter a battle while this death is greater than 0 )
Cocoon = Death Count used to denote which payment player is to recieve (ex 1 cocoon = 50 gold, 2 cocoon = 100 ect)
Zerg Zergling = denotes player is in a battle with a zergling
Kyadarin Crystal Formation = denotes player has recieved all payments due to battles and is not engaging enemies

Post has been edited 1 time(s), last time on May 19 2009, 6:25 pm by Vrael.



None.

May 19 2009, 10:22 am Chubacca Post #2



i saw this and isnt kyadarin death count set at 1 mean that your not in battle. if im wrong, i apologize

Quote
Trigger("Player 3"){
//This trigger is for when something goes wrong for some reason and P3's victory trigger doesn't move him back properly
//there are also a couple other triggers like this one in case this one can't move him back, but they have the same conditions, so clearly aren't firing
Conditions:
Bring("Created by: Vrael@USEast", "Men", "Location 134", Exactly, 0);
Bring("Foes", "Men", "Location 134", Exactly, 0);
Bring("Player 3", "Men", "Location 134", At least, 1);
Deaths("Player 3", "Floor Hatch (UNUSED)", At most, 50);
Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 1);

Actions:
Set Invincibility("Player 3", "Men", "Location 134", enabled);
Move Unit("Player 3", "Terran Marine", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zerg Hydralisk", All, "Location 134", "Location 140");
Move Unit("Player 3", "Zeratul (Dark Templar)", All, "Location 134", "Location 140");
Move Unit("Player 3", "Terran Firebat", All, "Location 134", "Location 140");
Set Deaths("Player 3", "Floor Hatch (UNUSED)", Set To, 50);
Set Switch("Switch9", clear);
Preserve Trigger();
Comment("Generic Victory Hero");
}




None.

May 19 2009, 6:22 pm Vrael Post #3



The conditions for Kyadarin to be set to 1 are that you have suffered 0 deaths of all possible units that you can battle. When you enter a battle, Kyadarin gets set to 0 by a trigger which is ommitted but I assure you that it's there (I'll edit it in in a second). After you defeat the zergling or vulture or whatever it is you're battling, there is a "Victory" trigger which sets the death of the zergling/vulture/whatever else to 0 (as seen in the triggers above). The next trigger cycle, the conditions for Kyadarin will be met and the player will have 1 death of Kyadarin again. If the Victory trigger runs but fails to move the unit back correctly, the "Generic Victory" trigger you quoted will have to wait 1 cycle to run, but that's really inconsequential (unless someone finds that it affects the system to cause this glitch, but I don't see how).

Kyadarin death count set at 1 means that you aren't currently battling anything, yes, but it says nothing about where your unit actually is.



None.

May 19 2009, 7:15 pm Vi3t-X Post #4



Wasn't this the problem I told you?



None.

May 19 2009, 8:11 pm Vrael Post #5



Quote from Vi3t-X
Wasn't this the problem I told you?
Yes. I can't figure out how to fix it though.



None.

May 20 2009, 6:47 am Kaias Post #6



It's Khyadarin



None.

May 20 2009, 6:50 am Vrael Post #7



Nope, not this time. Triggers are as they appear in the editor.



None.

May 20 2009, 6:52 am Kaias Post #8



Ah, I see. I'll try to find it.

Post has been edited 1 time(s), last time on May 20 2009, 7:13 am by Kaias.



None.

May 21 2009, 2:16 am Vrael Post #9



Finnally found the glitch again with a test game. The condition that is not being met is:

"Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 1);"

From the "Generic Victory Hero" trigger.

Here are the conditions from the Gobln Victory and Generic Victory triggers (rearranged for easier viewing order):
They share 3 of the same conditions:
Goblin Victory
Bring("Foes", "Men", "Location 134", Exactly, 0);
Bring("Player 3", "Men", "Location 134", At least, 1);
Deaths("Player 3", "Floor Hatch (UNUSED)", At most, 60);
Deaths("Player 3", "Zerg Zergling", At least, 1);

Generic Victory
Bring("Foes", "Men", "Location 134", Exactly, 0);
Bring("Player 3", "Men", "Location 134", At least, 1);
Deaths("Player 3", "Floor Hatch (UNUSED)", At most, 50);
Bring("Created by: Vrael@USEast", "Men", "Location 134", Exactly, 0);
Deaths("Player 3", "Kyadarin Crystal Formation", Exactly, 1);

From my recent test I can say that the first 3 conditions of the Goblin Victory trigger are fulfilled, because the first 4 conditions of the Generic Victory trigger are fulfilled, and the first 3 of each are the same. So this leaves me with the following: Deaths of Zergling are not at least 1, and Kyadarin is not exactly 1. Based on a text trigger search, there are no actions which set kyadarin to 2 for any players, or that add 1 for kyadarin, so kyadarin must be 0, and zerg zergling must be 0. This is what puzzles me: if they are both exactly 0, the first trigger shown in my first post should set Kyadarin to 1, then the Generic Victory trigger should start up, but no luck. HELP!!!

I think I found the problem actually. "Goliath Turret" in the first trigger is set to 200 at the end of a cutscene, not 0, hence Kyadarin will not be reset to 1.

Post has been edited 1 time(s), last time on May 21 2009, 2:25 am by Vrael.



None.

May 22 2009, 3:21 am scwizard Post #10



If this were me, instead of debugging I'd just use a hack to fix this.

If it detects you're still in a battle after the battle is over, move your character back to the location your character is supposed to be moved back to.

If it detects you're STILL in the battle, then show a text message saying an error occurred, and then move the character back to the town.

If it detects you're STILL SOMEHOW in the battle despite the battle having ended, then show a text message saying a serious error occurred, give the character an extra life and then kill the character.

My guess is that this is a result of the move trigger failing to move stuff, which is a problem I've experienced before. However I don't know, and it sounds like you have a bunch of triggers at this point, so it would be very difficult to debug. Considering that this is a rare error, I would just hack around it using the technique I just described.

Ignore me, unless your fix doesn't work that is.



None.

May 22 2009, 4:20 am Vrael Post #11



The problem is fixed. Whenever Nude gets his internet back, he can close this.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[07:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[06:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[03:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Roy, NudeRaider