HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

New Spell not working right - Race-Building contest!

04-10-2009, 07:19 PM#1
Kyrbi0
(This is copy/pasted from the Race-Building topic, since, as Flame_Phoenix suggested, this might get more "publicity" that way).

~~~

Alright, I'm in crunch time and I've hit a wall as to what to do here. Normally I'd love to keep this a secret, but time is not on my side, so I must swallow my pride (Hey, I'm a poet and I didn't even know-it. :P)

I've got a set of 3 triggers to make an ability I have no previous framework to base off of.
- The base ability (Metalocalypse) is a modified Roar; only targets friendly Mech units, and the duration is 5 seconds (short, for the purposes of the trigger.
- The "inner fire" ability has the same buff as the Roar (Metalocalypse), but this is the actual spell duration (like 60), to differentiate the hero.
- "Automatons" are but one type of unit that I want this to work on. If it works for one, I can copy/paste and change values for the rest.
- "[Dummy] Metalocalypse - Armor" is a dummy, hidden ability (Item-based, no icon) that provides different levels of armor.

Triggers


Trigger:
Metalocalypse Before
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Metalocalypse
Collapse Actions
Custom script: local location udg_TempPoint
-------- First I place the buff that will identify the hero --------
Animation - Change (Casting unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
Unit - Add [Dummy] Metalocalypse - Armor to (Casting unit)
Set TempPoint = (Position of (Casting unit))
Unit - Create 1 Dummy Caster for (Owner of (Casting unit)) at TempPoint facing (Facing of (Casting unit)) degrees
Unit - Order (Last created unit) to Human Priest - Inner Fire (Casting unit)
-------- Then I have to put all the "buffing" abilities in prior to upgrading them --------
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null
Trigger:
Metalocalypse After
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to Metalocalypse
Collapse Actions
Custom script: local location udg_TempPoint
Set TempPoint = (Position of (Casting unit))
-------- Then I remove the units and set the abilities' levels accordingly --------
Collapse For each (Integer A) from 1 to 5, do (Actions)
Collapse Loop - Actions
Collapse Unit Group - Pick every unit in (Random 1 units from (Units owned by (Owner of (Casting unit)) matching ((((Matching unit) has buff Metalocalypse ) Equal to True) and ((Unit-type of (Matching unit)) Equal to Automaton)))) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Move To TempPoint
Unit - Set level of [Dummy] Metalocalypse - Armor for (Casting unit) to ((Level of [Dummy] Metalocalypse - Armor for (Casting unit)) + 1)
Unit - Remove (Picked unit) from the game
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null
Trigger:
Metalocalypse Remove
Collapse Events
Time - Every 2.00 seconds of game time
Conditions
Collapse Actions
Set TempGroup = (Units of type Warmech)
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) has buff Metalocalypse ) Equal to False
Collapse Then - Actions
Animation - Change (Picked unit)'s size to (120.00%, 120.00%, 120.00%) of its original size
Unit - Create (Level of [Dummy] Metalocalypse - Armor for (Picked unit)) Automaton for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
Unit - Remove [Dummy] Metalocalypse - Armor from (Picked unit)
Else - Actions



The point of the spell (I'm gonna hate myself for revealing it :<...) is to 'suck up' all nearby "Automatons" (caps at 5) and increase the level of the "Dummy Armor" ability accordingly. Then, once the buff is removed from the hero, this periodic "Remove" trigger will remove all traces of it (the Dummy Armor ability), and re-spawn the right number of Automatons (based on the level of the ability, since that should be the how many were "sucked up".

~
Speaking of the problems with the spell: after fluctuating between "totally working" and "not working at all" (really, don't ask me; the "Test Map" button hates me), it is "currently" (as of last testing) completing all phases of the skill (buffs and "sucks up" a few Automatons, gives the hero +Armor (ability), after duration removes the +Armor and re-spawns Automatons).
However, it is not working in terms of magnitude...
It "sucks" up as many as are close, up to 5 (does not always pick 5). Then, it always increases the level of the "Dummy Armor" skill to 6, giving a +10 bonus to armor. Finally, upon the end of the duration, it always creates 6 Automatons (due to the level of the ability being 6), regardless of how many it "sucked up".

I attribute most (if not all) of the problem to the fact that, within the double-loop (for each integer A 1-5, Pick every (Random 1 unit....))) ), I increase the level of the ability. Regardless of whether or not it "sucks up" an Automaton (it comes after it, but it doesn't necessarily require it).

So is there a way to make that happen? Say "IF a unit is ordered, THEN increase ability level for casting unit", or something? Or have I done something entirely wrong?
Further, will this work with several different unit-types? Lots of different loops going around?

Thank you for your time and help, if possible.

--EDIT--
Also, even though it shouldn't do this by right, it's completely ignoring the line that says "turn casting hero 50% transparent. It was ignoring the "add Dummy Armor ability" line, too, until I moved it before the "dummy caster" bit. Same thing? Why!?
04-11-2009, 01:11 AM#2
Michael Peppers
Quote:
Originally Posted by Kyrbi0
(This is copy/pasted from the Race-Building topic, since, as Flame_Phoenix suggested, this might get more "publicity" that way).
...but I answered to you in the other thread... xD (checkitcheckitcheckit)