| 01-03-2008, 09:47 AM | #1 |
i have no ****ing clue what is wrong here. this trigger sometimes works and sometimes does not. I stripped the trigger down so its less complicated and have a better chance of finding whats wrong. i've tested this new trigger and it has the same exact problem my original trigger had. so can anyone see what's wrong with this trigger? JASS://These things can be changed constant function Shadow_Stab_SpellId takes nothing returns integer return 'A01Y' endfunction constant function Shadow_Stab_BuffId takes nothing returns integer return 'B00H' endfunction constant function Shadow_Stab_Create_Illusion_SpellId takes nothing returns integer return 'A01Z' endfunction constant function Shadow_Stab_Illusion_BuffId takes nothing returns integer return 'B00G' endfunction constant function Shadow_Stab_Illusion_Count takes integer L returns integer return L+2 endfunction constant function Create_Illusion_Order takes nothing returns integer return 852274 endfunction //Condition for spell being cast function Trig_Shadow_Stab_Conditions takes nothing returns boolean return GetSpellAbilityId() == Shadow_Stab_SpellId() endfunction //Actions for trigger that moves the illusions around the target and pauses them function Summon_Illusion_Function takes nothing returns nothing local trigger Trig = GetTriggeringTrigger() local unit C = H2U(GetHandleHandle(Trig, "C")) local unit T = H2U(GetHandleHandle(Trig, "T")) local integer L = GetHandleInt(Trig, "L") local group G = H2G(GetHandleHandle(Trig, "G")) local unit I = GetSummonedUnit() local integer N = Shadow_Stab_Illusion_Count(L) local integer InG local real D = 150.0 local real A = 360.0/N local real X = GetUnitX(T) local real Y = GetUnitY(T) local real X2 local real Y2 call DisplayTextToForce(GetPlayersAll(), "Inside Summon_Illusion_Function") if G == null then set G = CreateGroup() call SetHandleHandle(Trig, "G", G) endif call GroupAddUnit(G, I) set InG = CountUnitsInGroup(G) call SetUnitPathing(I, false) set X2 = X + D * Cos(A*InG * bj_DEGTORAD) set Y2 = Y + D * Sin(A*InG * bj_DEGTORAD) call SetUnitX(I, X2) call SetUnitY(I, Y2) call SetUnitFacing(I, A*InG+180) call PauseUnit(I, true) if InG == N then call FlushHandleLocals( Trig ) call DestroyTrigger( Trig ) endif set Trig = null set C = null set T = null set G = null endfunction //main trigger actions function Trig_Shadow_Stab_Actions takes nothing returns nothing local unit C = GetSpellAbilityUnit() local unit T = GetSpellTargetUnit() local trigger Trig = CreateTrigger() local unit Temp local real X = GetUnitX(C) local real Y = GetUnitY(C) local player P = GetOwningPlayer(C) local integer N = 0 local integer L = GetUnitAbilityLevel(C, Shadow_Stab_SpellId()) call TriggerSleepAction(0.3) loop set N = N+1 set Temp = CreateUnit(P, Dummy_Unit_TypeId(), X, Y, 0) call SetUnitPathing(Temp, false) call UnitAddAbility(Temp, Shadow_Stab_Create_Illusion_SpellId()) call IssueTargetOrderById(Temp, Create_Illusion_Order(), C) call UnitApplyTimedLife(Temp, 'BTLF', 2.0) exitwhen N >= Shadow_Stab_Illusion_Count(L) endloop call TriggerRegisterPlayerUnitEvent( Trig, P, EVENT_PLAYER_UNIT_SUMMON, null ) call TriggerAddAction( Trig, function Summon_Illusion_Function ) call SetHandleInt( Trig, "L", L ) call SetHandleHandle( Trig, "C", C ) call SetHandleHandle( Trig, "T", T ) set C = null set T = null set Trig = null set Temp = null set P = null endfunction //=========================================================================== function InitTrig_Shadow_Stab takes nothing returns nothing set gg_trg_Shadow_Stab_Copy = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_Stab_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Shadow_Stab_Copy, Condition( function Trig_Shadow_Stab_Conditions ) ) call TriggerAddAction( gg_trg_Shadow_Stab_Copy, function Trig_Shadow_Stab_Actions ) endfunction the problem is that sometimes (it appears to be random with no apparent cause) the local trigger that is created does absolutely nothing. The illusions are created from the dummy units casting Item Illusion on the caster and the local trigger is supposed to go off when an image is created and move the images to surround the target and pause the illusions. now sometimes it works and some times it just creates the illusions, leaves them where they were created, and does not pause them. like that local trigger was never created. and its so random i cannot narrow it down to find the cause it'll work perfectly like 5 times and then it ****s up once and then it will work perfectly 2 times and then it ****s up once and then it will work perfectly 12 times and then it ****s up once and then it works perfectly 7 times and then it ****s up once. i am completely stumped. |
| 01-03-2008, 10:13 AM | #2 |
In before cohadar saying it's due to your attachment system. Personally, I think it's your attachment system. I2H, H2U, local triggers, etc can not be good. Knowing me, however I've probably just overlooked something. I'd try writing this with CS_Cache, or even better structs and see if it works then. Also, triggers sans vJass are horrible to look at |
| 01-03-2008, 12:26 PM | #3 |
GetHandleHandle = I2H = Random issues. But it sounds like your random issues are easier to reproduce than often. Besides of I2H I can say there are a lot of nasty things you are doing in your trigger, for example, you should seriously not use a group there, you actually just want a counter. If I could show you a theory it would be that CountUnitsInGroup function that exploits that terrible bj_wantDestroyGroup hack, I am 95% sure you got a trigger somewhere in which that variable is wrongly assigned to true and is causing a destruction of the group. Want to check if I am right? try adding this: JASS:if CountUnitsInGroup(G)!=InG then call BJDebugMsg("ouch") endif after : set InG = CountUnitsInGroup(G) |
| 01-04-2008, 10:24 PM | #5 |
They might have a mac. Besides, forcing stuff on people = bad. Educate them, but if they still don't want to then don't force then. Good idea there Vex. If that doesn't work out, starting adding debug messages to everything. |
| 01-05-2008, 01:18 AM | #6 |
Thats why... GetHandleUnit is more safer... sheez, dman these ppl are under educated -Av3n |
| 01-05-2008, 08:23 AM | #7 | |
Quote:
|
