| 05-30-2009, 11:22 PM | #2 |
local unit array XXX |
| 05-30-2009, 11:51 PM | #3 |
Thanks for the quick answer, but I'm still having an issue (you did shrink it from six errors to one, though). I've attempted Trigger: Custom Script: local unit array udg_UnitTrigger: Custom Script: local unit array udg_Unit[1]But both of them bring me to the same error message: Also, once the arrays get localized, I am going to be removing the location leaks. Will this do the job? Trigger: Custom Script:call RemoveLocation(udg_Point[1])As you can tell, I'm not experienced with using arrays and custom script, and I really appreciate your help. |
| 05-31-2009, 12:04 AM | #4 |
put the local unit array udg_Unit to be the first line in the function |
| 05-31-2009, 05:03 PM | #5 | |
Man, it appears that I am moving from one problem to the next. At least now I am able to enable the trigger, but its not working as intended. From what I can tell, the variables aren't becoming local every time that the trigger runs. For instance, I cast the spell the first time and it works great, but if I cast a second one before the first one finishes and dies off, then the second one will die off and the first will stay. Also, once it has been cast more than once, it messes up the target locations of the portals. Here's my script again, maybe you can see what I can't.
Thanks for the assistance that you guys have provided with me so far, I appreciate it! |
| 05-31-2009, 05:19 PM | #6 |
If I remember correctly and I could be totally wrong but, you can only use the local trick once. So your locations/points are being put into the globals arrays (not the local one) and is being overridden by the second spell. You probably cannot fix it unless you do some more complex GUI, like separate arrays for each spell instance with loops and if-statements, or a manual 2-d array. May I suggest you turn that into JASS? I can fix it, and comment it so you understand it. Trying to get help with GUI is hard because others cannot readily edit it, unlike JASS, and it's just plain hard to read. |
| 05-31-2009, 05:49 PM | #7 |
If you would like to do it in JASS, I would be very grateful. This went from something I thought would be a nice spell for a hero to way more worry than it deserves. I've tried to learn JASS, used Wyrmlord's tutorials a couple different times, I just get lost in it all. |
| 05-31-2009, 06:00 PM | #8 | |
Quote:
Edit: Really, if you want my help you need to post the JASS code, or explain what your doing. I think your making two waypoints for a set amount of time, for units to cross, then destroying it. |
| 06-04-2009, 01:35 AM | #9 |
udg_Unit and udg_Point, not Unit and Point. GUI uses udg_, remember? |
| 06-04-2009, 02:17 AM | #10 |
I'm very sorry; it's Exam week at school and I this had completely slipped my mind :[. Here's my code (finally, lol). I believe this is what you need, correct? JASS:function Trig_Way_Point_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A001' ) ) then return false endif return true endfunction function Trig_Way_Point_Actions takes nothing returns nothing local unit array Unit local location array Point set udg_Point[1] = GetSpellTargetLoc() set udg_Real = GetUnitFacing(GetTriggerUnit()) set udg_Point[2] = PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 300.00, udg_Real) set udg_Real = AngleBetweenPoints(udg_Point[2], udg_Point[1]) call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(GetTriggerUnit()), udg_Point[1], udg_Real ) set udg_Unit[1] = GetLastCreatedUnit() set udg_Real = AngleBetweenPoints(udg_Point[1], udg_Point[2]) call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(GetTriggerUnit()), udg_Point[2], udg_Real ) set udg_Unit[2] = GetLastCreatedUnit() set udg_Integer = GetUnitAbilityLevelSwapped('A001', GetTriggerUnit()) call WaygateSetDestinationLocBJ( udg_Unit[1], udg_Point[2] ) call WaygateSetDestinationLocBJ( udg_Unit[2], udg_Point[1] ) call WaygateActivateBJ( true, udg_Unit[1] ) call WaygateActivateBJ( true, udg_Unit[2] ) call TriggerSleepAction( ( 10.00 * I2R(udg_Integer) ) ) call KillUnit( udg_Unit[1] ) call KillUnit( udg_Unit[2] ) call RemoveLocation(udg_Point[1]) call RemoveLocation(udg_Point[2]) endfunction //=========================================================================== function InitTrig_Way_Point takes nothing returns nothing set gg_trg_Way_Point = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Way_Point, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Way_Point, Condition( function Trig_Way_Point_Conditions ) ) call TriggerAddAction( gg_trg_Way_Point, function Trig_Way_Point_Actions ) endfunction I've also been trying to slug my way through learning JASS, but it's still pretty tough :P |
| 06-04-2009, 02:24 AM | #11 | |
Quote:
|
| 06-04-2009, 06:30 AM | #12 |
The code can be improved to become slightly faster: JASS:function Trig_Way_Point_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A001' endfunction function Trig_Way_Point_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit Unit1 local unit Unit2 // There is no need to use an array. local location l = GetSpellTargetLoc() local real x1 = GetLocationX(l) local real y1 = GetLocationY(l) local real x2 local real y2 local real angle = GetUnitFacing(caster) local integer level = GetUnitAbilityLevel(caster, 'A001') call RemoveLocation(l) set l = null set Unit1 = CreateUnit(GetOwningPlayer(caster), 'n000', x1, y1, angle) set angle = angle*bj_DEGTORAD set x2 = x1 + 300. * Cos(angle) set y2 = y1 + 300. * Sin(angle) set angle = angle*bj_RADTODEG + 180. set Unit2 = CreateUnit(GetOwningPlayer(caster), 'n000', x2, y2, angle) call WaygateSetDestination(Unit1, x2, y2) call WaygateSetDestination(Unit2, x1, y1) call WaygateActivate(Unit1, true) call WaygateActivate(Unit2, true) call TriggerSleepAction(10.00 * I2R(level)) call KillUnit(Unit1) call KillUnit(Unit2) set Unit1 = null set Unit2 = null set caster = null endfunction |
| 06-04-2009, 11:21 AM | #13 |
@0zyx0: Since the only thing your doing after the Wait, is KillUnit(), you can get rid of it, by using UnitApplyTimedLife() instead |
| 06-04-2009, 11:23 AM | #14 | |||
Quote:
Alright... I assume that you are talking about putting udg_ in front of the Arrays? That brings up Quote:
It's only got one problem when I try to run it. Line 56 JASS:call WaygateActivateBJ(Unit2, true) says there in an "Invalid argument type (boolean)". Line 55, which appears to be nearly the same thing but with the first way-gate, works fine. |
| 06-04-2009, 11:45 AM | #15 | |
Quote:
its either JASS:call WaygateActivateBJ(true, Unit2) JASS:call WaygateActivate(Unit2, true) (just remove the BJ) |
