HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

could this be done better?

08-27-2006, 12:23 AM#1
darkwulfv
In order to limit a spell from being cast, i used the tech requirement method. I have 3 triggers, but i want to know if it could be done with less. I am using WEU if that helps.
1. Creates the unit for the tech requirement
Trigger:
Flaming Egg Limit
Collapse Events
Unit - A unit Learns a skill
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
Collapse Actions
Unit - Create 1 The previous Phoenix must be dead. for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Set FlamingEggDummy[(Player number of (Owner of (Triggering unit)))] = (Last created unit)

2.kills the tech unit, thus preventing casting
Trigger:
Flaming Egg Limit 2
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Flaming Egg
Collapse Actions
Unit - Kill FlamingEggDummy[(Player number of (Owner of (Triggering unit)))]
Set FlamingEggDummy[(Player number of (Triggering player))] = No unit

3.remakes the tech unit again
Trigger:
Flaming Egg Limit 3
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Phoenix [1]) or (((Unit-type of (Dying unit)) Equal to Phoenix [2]) or ((Unit-type of (Dying unit)) Equal to Phoenix [3]))
Collapse Actions
Unit - Create 1 The previous Phoenix must be dead. for (Owner of (Dying unit)) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Set FlamingEggDummy[(Player number of (Owner of (Dying unit)))] = (Last created unit)

Sorry for all the trigger but this is the only way i could think up... :p If any of you guys know a better way to do this, please let me know! +rep
08-27-2006, 12:30 AM#2
Anitarf
You could merge the first and last trigger. Give it both events and both conditions inside an or statement. It's not much of an improovement for in-game performance, but you get one trigger less which might be of some convenience when organizing them in the editor.
08-27-2006, 12:39 AM#3
darkwulfv
yea i thought about that after words it would be a little more organized.
New trigger:
Trigger:
Flaming Egg Limit 3
Collapse Events
Unit - A unit Dies
Unit - A unit Learns a skill
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
Collapse Or - Any (Conditions) are true
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Phoenix [1]) or (((Unit-type of (Dying unit)) Equal to Phoenix [2]) or ((Unit-type of (Dying unit)) Equal to Phoenix [3]))
Collapse Actions
Unit - Create 1 The previous Phoenix must be dead. for (Owner of (Dying unit)) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Set FlamingEggDummy[(Player number of (Owner of (Dying unit)))] = (Last created unit)
08-27-2006, 02:27 AM#4
Wyvernoid
Quote:
Originally Posted by darkwulfv
Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Phoenix [1]) or (((Unit-type of (Dying unit)) Equal to Phoenix [2]) or ((Unit-type of (Dying unit)) Equal to Phoenix [3]))
If you use "Or - any conditions are true", you needn't write those conditions in one line ;-P You wrote something like "A or or B"
Trigger:
Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Phoenix [1]
(Unit-type of (Dying unit)) Equal to Phoenix [2]
(Unit-type of (Dying unit)) Equal to Phoenix [3]
is just OK.
08-27-2006, 09:39 AM#5
Anitarf
Actualy, it should be like this:
Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
((Unit-type of (Dying unit)) Equal to Phoenix [1]) or (((Unit-type of (Dying unit)) Equal to Phoenix [2]) or ((Unit-type of (Dying unit)) Equal to Phoenix [3]))
08-27-2006, 11:14 AM#6
The)TideHunter(
Quote:
Originally Posted by Anitarf
Actualy, it should be like this:
Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
((Unit-type of (Dying unit)) Equal to Phoenix [1]) or (((Unit-type of (Dying unit)) Equal to Phoenix [2]) or ((Unit-type of (Dying unit)) Equal to Phoenix [3]))

Wyvernoid was pointing out you use 2 Or's in one line, so he said change it to:
Trigger:
Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Phoenix [1]
(Unit-type of (Dying unit)) Equal to Phoenix [2]
(Unit-type of (Dying unit)) Equal to Phoenix [3]

Which is right.

The final correct condition would be:

Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Phoenix [1]
(Unit-type of (Dying unit)) Equal to Phoenix [2]
(Unit-type of (Dying unit)) Equal to Phoenix [3]
08-27-2006, 11:45 AM#7
Wyvernoid
Thank you for pointing me out again, TideHunter^^
And darkwulfv... if you've learned boolean calculating, the following would be equivalent to the one TH modified above.
Trigger:
Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Learned Hero Skill) Equal to Flaming Egg
(Unit-type of (Dying unit)) Equal to Phoenix [1]
(Unit-type of (Dying unit)) Equal to Phoenix [2]
(Unit-type of (Dying unit)) Equal to Phoenix [3]
'Cause:
Code:
bool1 or (bool2 or (bool3 or bool4)) = bool1 or bool2 or bool3 or bool4
The 'bool's = 'Boolean', or 'boolexpr' in JASS.
08-27-2006, 01:15 PM#8
Vexorian
Quote:
The 'bool's = 'Boolean', or 'boolexpr' in JASS.

Boolexpr is an or/and combination of pointers to functions that return boolean, so they are not the same as booleans
08-27-2006, 01:17 PM#9
Wyvernoid
Ah my fault ;-) So it should still equal to Boolean in JASS ^^ Sorry for that
08-27-2006, 04:32 PM#10
darkwulfv
Thanks Wyvernoid, +rep. It's more organized that i can say for a fact.