• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] GUI

Status
Not open for further replies.
Good Day!, I've got 2 problems.
I'm trying to make a GUI Spell Pack. I won't spoil about it(just a bit though).

[Q] -
[W] - Summons a unit, can summon multiple units within 2-3seconds
[W] will initially be your first spell, before you can cast [Q] and [E], meaning both spells are useless without it.
[E] - Caster dashes towards the last summoned unit.
[R]
My problem is, I tried casting [E] first without casting [W].
So when I casted [E] the caster dashed to an unknown point, but not outside the map. Every time I test the map, it always dashes to that same location. [W] hadn't been cast so it means, I haven't set a point for it but still dashes

  • Set ST_Loc = (Position of ST_Caster[ST_TempInt])
  • Set ST_Loc2 = (Position of ST_Unit[ST_TempInt])
  • Set ST_Angle[ST_TempInt] = (Angle from ST_Loc to ST_Loc2)
  • Set ST_Distance = (Distance between ST_Loc and ST_Loc2)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ST_Distance Greater than 50.00
    • Then - Actions
      • Unit - Make ST_Caster[ST_TempInt] face ST_Unit[ST_TempInt] over 0.03 seconds
      • Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_ST_SFX, udg_ST_Caster[udg_ST_TempInt], udg_ST_Attachment))
      • Custom script: call SetUnitX(udg_ST_Caster[udg_ST_TempInt], GetUnitX(udg_ST_Caster[udg_ST_TempInt]) + udg_ST_Speed * Cos(udg_ST_Angle[udg_ST_TempInt] * bj_DEGTORAD))
      • Custom script: call SetUnitY(udg_ST_Caster[udg_ST_TempInt], GetUnitY(udg_ST_Caster[udg_ST_TempInt]) + udg_ST_Speed * Sin(udg_ST_Angle[udg_ST_TempInt] * bj_DEGTORAD))
      • Set ST_Group = (Units within ST_AoE of ST_Loc)

The second is for [Q]
this one doesn't dash to the target point.
unit group's purpose is to pick all existing units(unit equal to a specific unit-type) to dash to the preferred target point

  • Unit Group - Pick every unit in (Units owned by CT_Owner[CT_TempInt]) and do (Actions)
    • Loop - Actions
      • Set CT_Unit[CT_TempInt] = (Picked unit)
      • Set CT_Loc = (Position of CT_Unit[CT_TempInt])
      • Set CT_Angle[CT_TempInt] = (Angle from CT_Loc to CT_Loc2)
      • Set CT_Distance = (Distance between CT_Loc and CT_Loc2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CT_Distance Greater than 0.00
          • (Unit-type of CT_Unit[CT_TempInt]) Equal to CT_UnitType
        • Then - Actions
          • Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_CT_SFX, udg_CT_Elemental[udg_CT_TempInt], udg_CT_Attachment))
          • Custom script: call SetUnitX(udg_CT_Unit[udg_CT_TempInt], GetUnitX(udg_CT_Elemental[udg_CT_TempInt]) + udg_CT_Speed * Cos(udg_CT_Angle[udg_CT_TempInt] * bj_DEGTORAD))
          • Custom script: call SetUnitY(udg_CT_Unit[udg_CT_TempInt], GetUnitY(udg_CT_Elemental[udg_CT_TempInt]) + udg_CT_Speed * Sin(udg_CT_Angle[udg_CT_TempInt] * bj_DEGTORAD))
        • Else - Actions
          • Set CT_TempDur = 0.00
      • Custom script: call RemoveLocation(udg_CT_Loc)
      • Custom script: call RemoveLocation(udg_CT_Loc2)

EDIT: First one has been solved
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
The code attempts to execute regardless of whether or not your variables have been set. If you reference an un-set non-array variable that will cause a thread crash and the trigger will stop running (once, if it's periodic, then will attempt to execute again the next time unless the variable is still not been set). If you reference an un-set array variable it instead returns the default value for that variable type.

ST_Unit[ST_TempInt] returns null ("no unit"), so ST_Loc2 gets set to Location(0,0) when it tries to find the location of a nonexistent unit. Thus Azir will always dash toward the center of the map. If he has no sand soldiers he shouldn't be able to dash, so you either need to disable Q/E when none exist (and ignore this problem entirely because it will never happen) or perform a check in your Q/E cast triggers that stops the trigger from executing (or maybe the spell from casting) if there aren't any soldiers active.
 
The code attempts to execute regardless of whether or not your variables have been set. If you reference an un-set non-array variable that will cause a thread crash and the trigger will stop running (once, if it's periodic, then will attempt to execute again the next time unless the variable is still not been set). If you reference an un-set array variable it instead returns the default value for that variable type.

ST_Unit[ST_TempInt] returns null ("no unit"), so ST_Loc2 gets set to Location(0,0) when it tries to find the location of a nonexistent unit. Thus Azir will always dash toward the center of the map. If he has no sand soldiers he shouldn't be able to dash, so you either need to disable Q/E when none exist (and ignore this problem entirely because it will never happen) or perform a check in your Q/E cast triggers that stops the trigger from executing (or maybe the spell from casting) if there aren't any soldiers active.
Daaaamn, you've spoiled it hahaha. nevermind, thanks though. i'll look into it
 
Status
Not open for further replies.
Top