HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adv. Trigger Spell....

08-10-2003, 02:12 PM#1
hodi
Yo,

Let´s see if I can ask this question without revealing to much of my Ability.
Ok here´s the light version emote_sweat

E-
Unit- A unit Owned by Player 1 (red) is issued an order targeting an object

C-
And - All (Conditions) are true
Conditions
(Unit-type of (Ordered unit)) Equal to MyUnit
(Issued order) Equal to (Order(banish))

A-
Set Caster = (Ordered unit)
Set Target = (Target unit of issued order)
Set x = 0
Unit- Pause Caster
Unit- Make Caster invulnerable
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-----everything works fine so far-----
If - Conditions
MySpellLvL Equal to 1
Then - Actions
Set x = (Random integer number between 3 and 4)
Set DummyUnitType = Dummy (level1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MySpellLvL Equal to 2
Then - Actions
Set x = (Random integer number between 6 and 8 )
Set DummyUnitType = Dummy (level2)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MySpellLvL Equal to 3
Then - Actions
Set x = (Random integer number between 9 and 12)
Set DummyUnitType = Dummy (level3)
Else - Actions
Do nothing
-----this loop repeats forever-----
For each (Integer A) from 1 to x, do (Actions)
Loop - Actions
Unit - Create 1 DummyUnitType for Player 1 (Red) at ((Position of Target) offset by ((Random real number between -300.00 and 300.00), 0.00)) facing Default building facing degrees
Set DummyUnit = (Last created unit)
Animation - Change DummyUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
Wait 0.01 seconds
Unit - Order DummyUnit to Attack Once Target
Wait 0.25 seconds
Unit - Remove DummyUnit from the game
Unit - Unpause Caster
Unit - Make Caster Vulnerable


Ok, I´ll give u a little description: I want to Spawn x Dummy´s at the position of the targeted unit, one after another, who attack the Target once and then dissapear.

Now what´s the problem? Well, the Integer A Loop doesn´t seem to work, my guess would be that those random numbers don´t cooperate with it.

Please Help

hodi
08-10-2003, 03:10 PM#2
Shvegait
The only thing I can think of (withoutt knowing anything else about any of your other triggers) is that the MySpellLvl is equal to something other than 1, 2, or 3. I don't know exactly what a For Loop from 1 to 0 would do emote_sweat

Everything looks right in that trigger. The x=0 isn't really necessary though, if it will always be set to something else. Hey, I'm trying to help you save a couple bytes on map size ;)
08-10-2003, 03:19 PM#3
hodi
Quote:
Originally posted by Shvegait
The only thing I can think of (withoutt knowing anything else about any of your other triggers) is that the MySpellLvl is equal to something other than 1, 2, or 3. I don't know exactly what a For Loop from 1 to 0 would do emote_sweat


Here´s the Trig:
function Trig_MySpellLvL_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A016' ) ) then
return false
endif
return true
endfunction

function Trig_MySpellLvL_Actions takes nothing returns nothing
set udg_MySpellLvL = ( udg_MySpellLvL + 1 )
endfunction

//===========================================================================
function InitTrig_MySpellLvL takes nothing returns nothing
set gg_trg_MySpellLvL = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_MySpellLvL, gg_unit_O000_0004, EVENT_UNIT_HERO_SKILL )
call TriggerAddCondition( gg_trg_MySpellLvL, Condition( function Trig_MySpellLvL_Conditions ) )
call TriggerAddAction( gg_trg_MySpellLvL, function Trig_MySpellLvL_Actions )
endfunction
Quote:
The x=0 isn't really necessary though, if it will always be set to something else. Hey, I'm trying to help you save a couple bytes on map size ;)

My map has more than 16k doodads and some imported Sounds and isn´t finished yet. It´s for a SinglePlayer Campaign so I don´t care about the size =)

Thx
hodi
08-10-2003, 03:57 PM#4
Coffein
Try to work around the loop.
08-10-2003, 04:05 PM#5
hodi
Quote:
Originally posted by CoFFeiN
Try to work around the loop.


=/ lotsa work