| 04-27-2008, 06:46 AM | #1 |
Name says it all. PROBLEM! The units are meant to be given a custom value. 10 is what's given to units which have no specific properties, 1 to 4 are given to represent multiples of 90 (90, 180, 270, 360). I have messages set up (as highlighted) and only 2 of the possible 18 show up. The "Starting initiation" message and "Finished initiation" show up, however the other 16 don't show up at all. So yeah, could someone who isn't blind like me find my problem? JASS:function Trig_Melee_Initialization_Actions takes nothing returns nothing local real temp = 0. local unit u local group g = CreateGroup() call BJDebugMsg("Starting initiation.") call GroupEnumUnitsOfType(g, "Direction", null) loop set u = FirstOfGroup(g) exitwhen u==null call SetUnitUserData( u, 10 ) set temp = (ModuloReal(GetUnitX(u), 512.) - GetUnitX(u)) call SetUnitX(u, temp) set temp = (ModuloReal(GetUnitY(u), 512.) - GetUnitY(u)) call SetUnitY(u, temp) if GetUnitX(u)>5000. then call SetUnitUserData(u, 4) elseif GetUnitY(u)>5000. then call SetUnitUserData(u, 1) elseif GetUnitY(u)<5000. then call SetUnitUserData(u, 3) elseif GetUnitX(u)<5000. then call SetUnitUserData(u, 2) endif call BJDebugMsg("Value given, "+I2S(GetUnitUserData(u))) call GroupRemoveUnit(g, u) endloop // call SetUnitUserData( gg_unit_h000_0013, 4 ) // In case I ever need these, I have them here... // call SetUnitUserData( gg_unit_h000_0006, 4 ) // // call SetUnitUserData( gg_unit_h000_0001, 1 ) // For some ungodly reason, the ABOVE LOOP things contradict these... no matter what I do, so I've cut them out. // call SetUnitUserData( gg_unit_h000_0000, 1 ) // // call SetUnitUserData( gg_unit_h000_0002, 2 ) // // call SetUnitUserData( gg_unit_h000_0009, 2 ) // // call SetUnitUserData( gg_unit_h000_0014, 3 ) // // call SetUnitUserData( gg_unit_h000_0015, 3 ) // call DestroyGroup(g) set u = null set g = null call BJDebugMsg("Finished initiation.") endfunction //=========================================================================== function InitTrig_Melee_Initialization takes nothing returns nothing set gg_trg_Melee_Initialization = CreateTrigger( ) call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions ) endfunction |
| 04-27-2008, 06:58 AM | #2 |
Between these two lines check that u isn't null first time: JASS:set u = FirstOfGroup(g) exitwhen u==null Edit: BJDebugMsg(UnitId2String(GetUnitTypeId(UNIT))) will give the actual unitname for use in GroupEnumUnitsOfType. It should be "custom_h000" instead of "Direction". |
| 04-27-2008, 07:06 AM | #3 |
your explanation of the problem was too bad to be understandable. |
| 04-27-2008, 08:01 AM | #4 | |
Quote:
_____ @ Alexander That's weird, it changes their facing angle and everything *forgot to mention*, yet it doesn't give them custom value. I'll be sure to check that, gimme a sec. EDIT! That's weird, it is... any idea on how I could set it without it being ignored? |
| 04-27-2008, 08:15 AM | #5 |
Doesn't using "custom_h000" instead of "Direction" fix the problem? |
| 04-27-2008, 08:16 AM | #6 |
Forgot to try that, I'll give it a shot now. EDIT! Magically worked. +Rep |
