• 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.

Dummies following on one unit

Status
Not open for further replies.
Level 4
Joined
Aug 7, 2010
Messages
77
Ok, first of all, i would like to say sorry if this question had been asked before or i am asking a dumb question.

Basically it is like this. I've created a spell called "infinity". The spell is basically increase attack by 20% every 10second and duration for "infinity" is 40seconds. What i want is to create 4 orbs thats facing South 80range, north 80range, east 80 range and west 80 range such that it will appear like this


And this is the simple trigger


But i wanna make like every 10second one orb will appear such that each orb will appear during the 0s, 10s, 20s and 30s when the skill "infinity" is being casted. And most importantly, those orbs must follow the caster during the duration of infinity.

Any pros can help me in this? thanks lots.

edited* i've already done with the skill, just having problems with the orb spawning and moving with the unit.
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) Never use "Every 0.01 seconds". Most people use 0.03 seconds, with reason. 32 FPS is probably the way to go: it's easier on the game and allows humans to see a fluid motion.
Some people prefer 0.03125 seconds (this equates to exactly 32 FPS), but it isn't possible in GUI, so we use 0.03 seconds.
It depends on what you're trying to do though. Sometimes you need 0.05, or 0.10, but as a rule of thumb: never go below 0.03.

2) You have to remove leaks.
Leaks are pieces of memory that Warcraft remembers, but never deletes or re-uses.
Locations, for example, leak. Warcraft remembers all locations you've used and will never delete them, nor re-use them (even if they have the exact same coordinates as a location you used previously).
If Warcraft needs to remember too many of these leaks, it will slow down (this can be game-breaking).
The 4 most common leaks are: locations, unit groups, player groups and special effects.
The only one that can be removed in pure GUI are special effects.

Removing special effects:
  • Special Effect - Destroy (Last created special effect)
Removing locations:
  • Custom script: call RemoveLocation( udg_tempLoc )
Now this might be a little tricky at first, but there's really nothing to it. The most important thing you need to know is that everything here is case-sensitive!
The first part always stays the same: "call RemoveLocation( ". This just indicates you're going to remove a location.
Then what's inside the brackets is "udg_" + the variable name.
"udg" stands for "User Defined Global" and is added before all globals (this is what you create with the variable editor).
So when you create a point variable, let's name it "tempLoc", the actual name will be "udg_tempLoc".
Fill in the correct variable name, close the brackets and done!

Removing unit groups - method 1:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
This is the easiest as it doesn't require any variables.
Remember: from the moment you use a group, bj_wantDestroyGroup will be set to false automatically! If you use 2 groups right after each other, you need to set bj_wantDestroyGroup to true again!

Removing unit groups - method 2:
  • Custom script: call DestroyGroup( udg_tempGroup )
Same as before: udg_tempGroup is a variable here.

Removing player groups:
  • Custom script: call DestroyForce( udg_tempForce )
A "Player Group" is actually called a "Force". Hence the name.



Back to the spell!
I don't think you're trying to make this work for multiple units (in your trigger, if 2 units cast the spell at the same time, it will epicly fail), so I'm not going to try that either.

You could do something like this:
This is the initialization of the spell:
  • Init Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set caster = (Triggering unit)
      • Set realTimer = 9.97
      • Set tempInt = 0
      • Trigger - Turn on Loop Spell <gen>
      • Special Effect - Destroy (Last created special effect)
This is the loop of the spell:
  • Loop Spell
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Set Variables --------
      • Set realTimer = (realTimer + 0.03)
      • Set tempLoc1 = (Position of caster)
      • -------- Every 10 seconds - do actions --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • realTimer Greater than or equal to 10.00
        • Then - Actions
          • -------- Reset timer --------
          • Set realTimer = (realTimer - 10.00)
          • -------- Increase dummy count --------
          • Set tempInt = (tempInt + 1)
          • -------- Check if spell ends --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt Equal to 5
            • Then - Actions
              • For each (Integer loopInt) from 1 to 4, do (Actions)
                • Loop - Actions
                  • Unit - Remove spellDummy[loopInt] from the game
              • Custom script: call RemoveLocation( udg_tempLoc1 )
              • Trigger - Turn off (This trigger)
              • Skip remaining actions
            • Else - Actions
          • -------- Create dummy --------
          • Set tempLoc2 = (tempLoc1 offset by 80.00 towards (90.00 x (Real(tempInt))) degrees)
          • Unit - Create 1 Footman for Player 1 (Red) at tempLoc2 facing Default building facing degrees
          • Set spellDummy[tempInt] = (Last created unit)
          • Custom script: call RemoveLocation( udg_tempLoc2 )
        • Else - Actions
      • -------- Move dummies --------
      • For each (Integer loopInt) from 1 to tempInt, do (Actions)
        • Loop - Actions
          • Set tempLoc2 = (tempLoc1 offset by 80.00 towards (90.00 x (Real(loopInt))) degrees)
          • Unit - Move spellDummy[loopInt] instantly to tempLoc2
          • Custom script: call RemoveLocation( udg_tempLoc2 )
      • -------- Cleanup --------
      • Custom script: call RemoveLocation( udg_tempLoc1 )
Note that the above example will finish 10 seconds after the last orb has spawned.
This also needs quite some variables, I hope you're familiar with those :D.

If you have any questions related to this topic, ask away.
If you have any questions not related to this topic, please create another topic.
If you do not have any questions, that's great! It means you understood everything.
 
Level 4
Joined
Aug 7, 2010
Messages
77
@moderator, thanks a thousand for the detailed explanation, it really helps me.

@Xtrheo, thanks too for your reference and comments on your trigger.

Once again thanks both for helping, appreciated it very much. i feel very happy that the community is much more helpful and friendly than other forum which i've surfed.

Problem solved, and therefore thread closed. :)
 
Status
Not open for further replies.
Top