• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Spell Problem

Status
Not open for further replies.
Level 13
Joined
Oct 25, 2009
Messages
995
i have a problem with spell,what happen to this spell?If i cast,the target unit will keep moving...
  • FM Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Force Move
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FM_Index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on FM Loop <gen>
        • Else - Actions
      • Set FM_Index1 = (FM_Index1 + 1)
      • Set FM_Index2 = (FM_Index2 + 1)
      • Set FM_Target[FM_Index2] = (Target unit of ability being cast)
      • Set FM_Boolean[FM_Index2] = True
      • Set FM_Point1[FM_Index2] = (Position of FM_Target[FM_Index2])
      • Set FM_Point2[FM_Index2] = ((Position of FM_Target[FM_Index2]) offset by 600.00 towards (Facing of FM_Target[FM_Index2]) degrees)
      • Set FM_MaxDistance[FM_Index2] = (Distance between FM_Point1[FM_Index2] and FM_Point2[FM_Index2])
      • Custom script: call RemoveLocation(udg_FM_Point1[udg_FM_Index2])
      • Custom script: call RemoveLocation(udg_FM_Point2[udg_FM_Index2])
  • FM Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FM_IndexLoop) from 1 to FM_Index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FM_Boolean[FM_IndexLoop] Equal to True
            • Then - Actions
              • Set FM_Point1[FM_IndexLoop] = (Position of FM_Target[FM_IndexLoop])
              • Set FM_Point2[FM_IndexLoop] = ((Position of FM_Target[FM_IndexLoop]) offset by 600.00 towards (Facing of FM_Target[FM_IndexLoop]) degrees)
              • Set FM_MaxDistance[FM_IndexLoop] = (Distance between FM_Point1[FM_IndexLoop] and FM_Point2[FM_IndexLoop])
              • Unit - Move FM_Target[FM_IndexLoop] instantly to ((Position of FM_Target[FM_IndexLoop]) offset by 15.00 towards (Facing of FM_Target[FM_IndexLoop]) degrees)
              • Special Effect - Create a special effect at (Position of FM_Target[FM_IndexLoop]) using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FM_MaxDistance[FM_IndexLoop] Less than or equal to 100.00
                • Then - Actions
                  • Set FM_Index1 = (FM_Index1 - 1)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_FM_Point2[udg_FM_IndexLoop])
              • Custom script: call RemoveLocation(udg_FM_Point1[udg_FM_IndexLoop])
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FM_Index1 Equal to 0
        • Then - Actions
          • Set FM_Index2 = 0
          • Set FM_Boolean[FM_IndexLoop] = False
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Last edited:
replace the boolean to this >>> FM_MaxDistance[FM_IndexLoop] Greater than or equal to 100.0

then reduce it by this >>> set FM_MaxDistance[FM_IndexLoop] = FM_MaxDistance[FM_IndexLoop] - REDUCE VALUE

now when the distance reaches below 100, that's the time you excecute the boolean...

if FM_Boolean[FM_IndexLoop] Equal to True then
Set FM_Index1 = (FM_Index1 - 1)
set FM_Boolean[FM_IndexLoop] = false //this is needed for it NOT to run again...

this should be the last setup
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • FM_Index1 Equal to 0
  • Then - Actions
  • Set FM_Index2 = 0
  • Trigger - Turn off (This trigger)
EDIT:
tell me what the spell do coz I really dont get this line >>> Set FM_MaxDistance[FM_IndexLoop] = (Distance between FM_Point1[FM_IndexLoop] and FM_Point2[FM_IndexLoop])
 
then you've done it all wrong, post the map here i'll fix it...

EDIT:
OK, I made a mistake, instead of reducing >>> ADD it (because Im thinking of a timer)...
In the casting time you should make another real array variable that's equal to zero...
sample: FM_MinDistance[FM_Index2]=0


if FM_MaxDistance[FM_IndexLoop] Less than or equal to 600.00 then
set FM_MinDistance[FM_IndexLoop] = FM_MinDistance[FM_IndexLoop] + SPEED

OK if you want to post the map I can explain it more...
 
If i understood well, i think you want a sepll that moves unit for 600 distance away.
Here is your map with fixed spell (if its not what you wanted, post it)

EDIT: here are your mistakes: you were setting max distance to 600 for every unit in loop, so the distance could never be lower than 100.
wasnt looking on your indexing, hope you got it right.
 

Attachments

  • Force Move.w3x
    18.8 KB · Views: 49
Last edited:
Status
Not open for further replies.
Top