| 09-25-2008, 12:18 PM | #1 |
Hi guys, in my map I have a unit, a king. When this king dies, the owner team loses and the attacking team wins the game. This should be easy and should work, however nothing really happens !! Can some one tell me what is wrong on the triggers ? JASS:scope EndGameConds initializer Init globals private constant unit NORTH_KING = gg_unit_H00D_0012 private constant unit SOUTH_KING = gg_unit_H00D_0228 private constant string DEFEAT_MESS = "Defeat!" endglobals //=========================================================================== private function SouthWin takes nothing returns nothing //Shouth player wins call CustomVictoryBJ(Player(7), true, true) call CustomVictoryBJ(Player(8), true, true) call CustomVictoryBJ(Player(9), true, true) call CustomVictoryBJ(Player(10), true, true) //North Player loses call CustomDefeatBJ(Player(0), DEFEAT_MESS) call CustomDefeatBJ(Player(1), DEFEAT_MESS) call CustomDefeatBJ(Player(2), DEFEAT_MESS) call CustomDefeatBJ(Player(3), DEFEAT_MESS) endfunction //=========================================================================== private function NorthWin takes nothing returns nothing //North Player wins call BJDebugMsg("WIN") call CustomVictoryBJ(Player(0), true, true) call CustomVictoryBJ(Player(1), true, true) call CustomVictoryBJ(Player(2), true, true) call CustomVictoryBJ(Player(3), true, true) //South Player loses call CustomDefeatBJ(Player(7), DEFEAT_MESS) call CustomDefeatBJ(Player(8), DEFEAT_MESS) call CustomDefeatBJ(Player(9), DEFEAT_MESS) call CustomDefeatBJ(Player(10), DEFEAT_MESS) endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger EndGameCondsTrg = CreateTrigger( ) call TriggerRegisterUnitEvent(EndGameCondsTrg, NORTH_KING, EVENT_UNIT_DEATH ) call TriggerAddAction( EndGameCondsTrg, function SouthWin ) set EndGameCondsTrg = CreateTrigger( ) call TriggerRegisterUnitEvent(EndGameCondsTrg, SOUTH_KING, EVENT_UNIT_DEATH ) call TriggerAddAction( EndGameCondsTrg, function NorthWin ) set EndGameCondsTrg = null endfunction endscope |
| 09-25-2008, 01:10 PM | #2 | |
Quote:
So please tell us EXACTLY what happens when one of the kings dies, and what not. And do the normal steps, like making sure the init function executes until its end, the global variables have the right values, etc etc. Oh and btw, you do NOT need to null the trigger at then end of the Init function. |
| 09-25-2008, 03:33 PM | #3 |
Slightly related suggestion: don't use the custom win and custom defeat functions. They're what shows the taunting "Continue playing" button that should be shot. |
| 09-25-2008, 09:10 PM | #4 | |||
Quote:
Quote:
The globals are correct ... Quote:
EDIT EDIT EDIT Guys I fixed the problem... Thing is, It doesn't work with the globals .. If I use this code everything runs like it should: JASS:scope EndGameConds initializer Init globals private constant string DEFEAT_MESS = "Defeat!" endglobals //=========================================================================== private function SouthWin takes nothing returns nothing //Shouth player wins call CustomVictoryBJ(Player(7), true, true) call CustomVictoryBJ(Player(8), true, true) call CustomVictoryBJ(Player(9), true, true) call CustomVictoryBJ(Player(10), true, true) //North Player loses call CustomDefeatBJ(Player(0), DEFEAT_MESS) call CustomDefeatBJ(Player(1), DEFEAT_MESS) call CustomDefeatBJ(Player(2), DEFEAT_MESS) call CustomDefeatBJ(Player(3), DEFEAT_MESS) endfunction //=========================================================================== private function NorthWin takes nothing returns nothing //North Player wins call CustomVictoryBJ(Player(0), true, true) call CustomVictoryBJ(Player(1), true, true) call CustomVictoryBJ(Player(2), true, true) call CustomVictoryBJ(Player(3), true, true) //South Player loses call CustomDefeatBJ(Player(7), DEFEAT_MESS) call CustomDefeatBJ(Player(8), DEFEAT_MESS) call CustomDefeatBJ(Player(9), DEFEAT_MESS) call CustomDefeatBJ(Player(10), DEFEAT_MESS) endfunction //=========================================================================== private function Init takes nothing returns nothing //North King Dies local trigger EndGameCondsTrg = CreateTrigger( ) call TriggerRegisterUnitEvent(EndGameCondsTrg, gg_unit_H00D_0012, EVENT_UNIT_DEATH ) call TriggerAddAction( EndGameCondsTrg, function SouthWin ) //South King Dies set EndGameCondsTrg = CreateTrigger( ) call TriggerRegisterUnitEvent(EndGameCondsTrg, gg_unit_H00D_0228, EVENT_UNIT_DEATH ) call TriggerAddAction( EndGameCondsTrg, function NorthWin ) set EndGameCondsTrg = null endfunction endscope And btw, how do I REMOVE the Continue box ?? (it doesn't work anyway lol) ?? |
| 09-26-2008, 10:41 AM | #5 | |
looking into a .j script I still had by incident opened in my JassCraft, it looks to me like this: (taken from the script saved by JassHelper): JASS://merged globals block, after JassHelper globals unit gg_unit_H00D_0012 = null(?) unit gg_unit_H00D_0228 = null(?) unit EndGameConds___NORTH_KING = gg_unit_H00D_0012 unit EndGameConds___SOUTH_KING = gg_unit_H00D_0028 //more globals variables... endglobals //now somewhere inside one of blizz' init functions: set gg_unit_H00D_0012 = CreateUnit(...) set gg_unit_H00D_0028 = CreateUnit(...) so, during the initialization your variables would be initialized with null(or maybe value at all, not sure), while the global vars receive their 'true' value(the unit) during init functions which are called function CreateUnitsForPlayer0 takes nothing returns nothing through Player11. Quote:
I can still see those functions in your code. |
| 09-26-2008, 12:45 PM | #6 |
Jass maybe better then gui... this took bout 20 seconds (including the placing of the hero add 20 seconds if ya wanna count opening we) Trigger: tho i suppose ya wanna optimize that trigger that gets fired off what once? OOOOH and it leaks to now thatl make the game unplayable after you win/lose dam No offense but whats the purpose of swatting a gnat with a sledgehammer? |
| 09-26-2008, 01:12 PM | #7 | |
Quote:
practice for what, uselessness? |
| 09-26-2008, 01:13 PM | #8 | |
Quote:
You're missing something. His inevitable goal is getting better at JASS and not at GUI. That's why he's making this trigger in jass, although GUI would've eventually been easier. But the problem he encountered, and the explanation for this problem will give him something in reward for his work, which is: Experience. And that again is something you will never be rewarded with if you just avoid the work. |
| 09-27-2008, 11:28 PM | #9 |
Na i get that i was just kinda poking fun at the "JASS is always better then GUI" people :D |
| 09-28-2008, 06:48 AM | #10 | |
Quote:
|
| 09-28-2008, 08:26 AM | #11 |
Guys seriously, the problem is answered, there is NO NEED to humiliate and try to kill some one just because he likes GUI better than JASS. +Rep to people who actually helped. I just don't know if the globals still work that way ... can some one give me some more details ? Because I do stuff like that in other parts of my map, and it works so far... |
| 09-28-2008, 08:34 AM | #12 |
save your map then, extract the .j and open it(preferably with JassCraft or something similar, or it will get very ugly), and see if you can figure it out. Also, you only can't set the value of your own globals to the value of udgs in your globals block, but you can do it at map init. |
