• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

This is not completely working

Status
Not open for further replies.
Level 6
Joined
Sep 13, 2013
Messages
155
I have a spell that was not MUI, and I tried to make it MUI, but it doesn't work.

Arcane Wagon
Description: Catches an unit in the arcane wagon for a duration, making it hidden. After the duration the wagon is broken and the target is free.

and here is the trigger :
  • Arcane Wagon
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Wagon
    • Actions
      • Set WagI = (WagI + 1)
      • Set WagonCaster[WagI] = (Triggering unit)
      • Set WagonTargetq[WagI] = (Target unit of ability being cast)
      • Unit - Hide WagonTargetq[WagI]
      • Unit - Create 1 Arcane Wagon for (Owner of (Triggering unit)) at (Position of WagonTargetq[WagI]) facing Default building facing degrees
      • Set Wagon[WagI] = (Last created unit)
      • Set WagTime[WagI] = (1.00 + (2.00 x (Real((Level of Arcane Wagon for WagonCaster[WagI])))))
      • Trigger - Turn on Wagon Dead <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WagI Equal to 1
        • Then - Actions
          • Trigger - Turn on Wagon Loop <gen>
        • Else - Actions
  • Wagon Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer WagIndex) from 1 to WagI, do (Actions)
        • Loop - Actions
          • Set WagTime[WagI] = (WagTime[WagI] - 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WagTime[WagI] Less than or equal to 0.00
            • Then - Actions
              • Unit - Kill Wagon[WagI]
            • Else - Actions
the problem is that it is not completely working. I tested this spell with five casters casting this ability at the same time, the first target will never come back from the wagon and gets to the oblivion (lol). the second one gets out correctly and the third one gets out with a lesser duration than what I set. The fourth and fifth seem to work correctly. please help.
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
I don't see you unhiding the WagonTargetq -> you only destroy the "wagon", but you do not unhide the actual unit.

You could also insert and show debug messages, so you can see how much time was calculated and how much time actually passed, etc.
 
Level 6
Joined
Sep 13, 2013
Messages
155
I forgot to post one of the three triggers

  • Wagon Dead
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to Wagon[WagI]
    • Actions
      • Unit - Unhide WagonTargetq[WagI]
      • Set WagonCaster[WagIndex] = WagonCaster[WagI]
      • Set WagonTargetq[WagIndex] = WagonTargetq[WagI]
      • Set Wagon[WagIndex] = Wagon[WagI]
      • Set WagI = (WagI - 1)
      • Set WagIndex = (WagIndex - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WagI Equal to 0
        • Then - Actions
          • Trigger - Turn off Wagon Loop <gen>
        • Else - Actions
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
The third trigger is the problematic one.
The condition checks if dying unit equals to the currently last indexed unit, if yes, it unhides the target.

You need to change it to this:
Code:
Event
    Unit Dies
Condition
    Unit-type of (triggering unit) equal to wagon
Actions
    set u1 = (triggering unit)
    For each loop from 1 to X:
        If (Conditions)
            Wagon[loop] equals to u1
        Then
            *here are actions to unhiding the correct unit + deindexing*
        Else

Though there is actually no reason to do it like that -> put all the actions from the third trigger in the "Then" block of the second trigger, where you kill the wagon. It achieves the same result.

also I don't see you setting WagonIndex anywhere
 
Level 6
Joined
Sep 13, 2013
Messages
155
i just did whatever it was written in purgeandfire's tutorial for unit indexing. And honestly I don't know what exactly that WagonIndex stands for :D

This is the Tutorial

EDIT: Im starting to think that maybe i must just use ships' transport ability for the wagons to hide the units inside them and add them an expiration timer.
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,405
Yes, that may simplify the spell a lot.
Else if you want to do it via triggers, you either need to fix the 3rd trigger, as right now it only works for the last created wagon; or use hashtable, where you can easily save all spell-related data and then just load them using the wagon's handle ID.
 
Status
Not open for further replies.
Top