HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Question

11-27-2002, 06:22 PM#1
Milkman
Hi again folks.
Once again i need some help from you trigger masters out there.

I'm making some triggers for a map and i want to summon 4 skeleton warriors and 4 skelton archers when u press the button "S"
It shoule also cost 100 mana and when u have 8 u cant cast again.
Now, this is where my problem comes in. aftet trying most ways possible i still cant figure it out. If u have 7 skeltons, u can cast. which u can at the moment BUT! then 7 of the summoned warriors shall die so that the maximum numbers of summons never become greater than 8. now what happens is this. sometimes all units slowly die off one by one or all is killed or one is killed. I will show you the triggers here so you can tell me whats wrong. I'm using a unitgroup variable called skeletons to keep track of the number of units in region Skeletons.
should i use trigger insted of book of dead? i tried that but that didn't work
Trigger 1:
Event:
--Unit Lich is issued an order without target
Condition:
--Number of units in skeletons less than 8
--Mana of lich greater than or equal to 100
Actions:
--If issued order equal to stop then run trigger Spells else do nothing

Trigger 2:
Conditions:
--Item type of item carried by lich 0001 equal to adept book.
Actions:
--Turn of this trigger
set mana of lich 0001 -100
remove adept book
create book of the dead
order lich to use last created item
Create adept book
add all unit in region to unit group variable (skeltons)
remove lich from skeletons
--Turn of this trigger

Trigger 3: (the I think is the weak link)
Condtions: Number of units in skeltons(Unit group variable) greater than 8
Actions: Kill random unit from skeletons


If u think i explained too much .:gfu: It's because last time i posted i got critic for not describing the problem
11-27-2002, 07:36 PM#2
Guest
Why are you using three triggers? You could do all of this with only one. Just use your main spell trigger and add the conditions from the rest to that one. At least that'll make it simplier to debug.

Instead of using a Unit Group, you could just do a Count Units in Unit Group - All Units controlled by (Owner of Unit(Ordering Unit)) of Type Skeleton Warrior + Count Units in Unit Group - All Units controlled by (Owner of Unit(Ordering Unit)) of Type Skeleton Archer

Edited because:

Sorry, I re-read your post then edited my own.

Alternatively, you could remove the 8 unit limt and just use a IF...THEN statement in your main spell trigger code to remove excess summoned units.

.
11-27-2002, 07:39 PM#3
Milkman
It's already there =O)

Trigger 1:
Event:
--Unit Lich is issued an order without target
Condition:
--Number of units in skeletons less than 8
--Mana of lich greater than or equal to 100
Actions:
--If issued order equal to stop then run trigger Spells else do nothing
11-27-2002, 08:17 PM#4
The_Cyberdemon1
What exactly are you trying to do? I suggest you do something like this:

Event:
----A unit owned by (player 1) uses an item
Condition:
----(Triggering unit) equal to lich 0001
----(Number of units in (units of type skeleton)) less than 9
----Item type of (item being manipulated) equal to book of the dead
----[Real comparison -> Property]mana of lich 0001 greater than or equal to (amount of mana needed)
Action:
----Create 4 skeleton at (position of lich 0001)
----Remove (item being manipulated) from the game
----Set mana of lich 0001 to [arithmetic] (mana of lich 0001) - (amount of mana needed to cast spell)

THat does most of it. If you want to kill the skeletons, just make an "every 2 seconds if number of skeletons owned by player 1 in playing area greater than 8 kill 1" trigger.
11-27-2002, 08:27 PM#5
Milkman
-->Cyberdemon But, that's kinda like what i have. although without the push the "S" button.

Trigger 3: (the I think is the weak link)
Condtions: Number of units in skeltons(Unit group variable) greater than 8
Actions: Kill random unit from skeletons

--->generalmx
i like to use alot of triggers, kinda like an handicap from staredit when u didn't have enough room. =O)

The last thing about if then statement i do not understand. can you explain?
i got a limit IF you have got 8 but id doesn't work when u've got 7 units =O(
11-27-2002, 08:36 PM#6
The_Cyberdemon1
for the unit group variable just do:

Count units in group, (units of type skeleton)

in the () you could do:
Units in region
Owned by player
whatever suits you best
11-27-2002, 08:43 PM#7
Milkman
Ok, hope that will work
11-27-2002, 08:51 PM#8
The_Cyberdemon1
IF it doesn't work, tell me, and i'll see if i can come up with an alternative
11-27-2002, 08:57 PM#9
Milkman
I used Instead of using a Unit Group, you could just do a Count Units in Unit Group - All Units controlled by (Owner of Unit(Ordering Unit)) of Type Skeleton Warrior + Count Units in Unit Group - All Units controlled by (Owner of Unit(Ordering Unit)) of Type Skeleton Archer
instead and i'm checking it right now.
i could e-mail me the map so u could look into it cause i dont fully understand the difference but well. i hope this works
11-27-2002, 08:59 PM#10
Milkman
Now, that didn't work. I could still summon 8 new skeletons when i had seven and they dudn't die. I think the problem lies in the kill action, but the ways of the triggers are evil and mysterious.

should i mail the map to you?
11-28-2002, 01:05 PM#11
The_Cyberdemon1
Oops. Mistake in the condition.

On the count units in group skeleton one, do less than 8.
11-28-2002, 02:18 PM#12
Milkman
That still isn't the problem. the summoing works allright.
But the regualation of the summoning is what messes.
U should never be allowed to have more than 8 skeletons, can you think of a trigger solution to that? if i have 4 and summon 4 of the summoned skeletons shall be killed or not spawned at all. Please find a way to do this!

I know yoy made a misstake in the condition, but is still, dont work
11-28-2002, 02:27 PM#13
Milkman
I'm attaching the file so you can test it out. this is just a map to test some triggers if u wonder about the slacky design
11-28-2002, 04:31 PM#14
The_Cyberdemon1
Ok, i have an idea. This is a bit complicated. 2 variables:

Skeletons - integer
geteight - integer

when creating the skeletons, do this:
Action:
----Set variable skeletons = count number of units in (units of type skeleton)
----If/then/else - If skeletons is less than 5, then create 4 skeletons at position of lich 0001, else do nothing
----If/then/else - If skeletons is less than 5, then Skip remaining actions, else do nothing
----Set variable geteight = 8 - skeletons
----Create (geteight) skeletons for player 1 at (postion of lich 0001)

That makes it so if the player has 4 skeletons, he gets 4. If he has less, he gets the exact number. Hows that?
11-28-2002, 07:12 PM#15
Milkman
Ok, That's really smart. just hope it works. Thanks for all your help regarding this, NOw you can tell weedar that you DO help peolple with triggers =O)