AceHart
Your Friendly Neighborhood Admin
- Reaction score
- 1,495
So you think you know it all?
You mastered the Art of the Trigger?
You just basically own?
You're uber by nature?
Yes, so it seems, doesn't it?
Well, for us normal WE people, every now and then, we write a trigger that can't possibly go wrong,
and, yet, it fails miserably.
Or, of course, the other way around:
You write a trigger and somehow it works, though you don't really see why.
What follows is a short collection of obvious stuff, that might just have an extra feature.
Nothing truly mysterious here.
Just some triggers.
Anyone can read them.
And, hopefully, think a bit about them.
Any and all discussion welcome.
Should there still remain any "problems" after... we'll see that, I'll post the "solution" so to speak.
Hope you're having fun.
Yours,
AceHart
Problem 1:
The condition sees if the item is still owned.
However, we were waiting for it to be lost.
Conclusion: the action will not run.
Problem 2:
Clearly, the second trigger has no events, so the event response "Dying unit" does not exist there.
Problem 3:
Indeed, can't possibly happen.
Problem 4:
Obviously, UnitCount will be 0 since "map init" happens before any other triggers run, so it will never be updated.
Problem 5:
"Integer A", as we all know, is a global variable, a "bj" actually, called "bj_forLoopAIndex".
Given for loops automatically add +1 on each run, we could use some JASS magic to subtract 2.
Which, in fact, subtracts 1 and we can loop "backwards".
Problem 6:
After that, all players, literally, will be enemies.
This also includes Neutrals.
As such, you will be enemy to, for example, Neutral Passive.
So, obviously, this will show all players 1 to 12, those that are in the game that is.
And, of course, given Neutrals are always there, and we noticed how it works from the previous trigger, this will also show all the Neutrals.
You mastered the Art of the Trigger?
You just basically own?
You're uber by nature?
Yes, so it seems, doesn't it?
Well, for us normal WE people, every now and then, we write a trigger that can't possibly go wrong,
and, yet, it fails miserably.
Or, of course, the other way around:
You write a trigger and somehow it works, though you don't really see why.
What follows is a short collection of obvious stuff, that might just have an extra feature.
Nothing truly mysterious here.
Just some triggers.
Anyone can read them.
And, hopefully, think a bit about them.
Any and all discussion welcome.
Should there still remain any "problems" after... we'll see that, I'll post the "solution" so to speak.
Hope you're having fun.
Yours,
AceHart
Problem 1:
Code:
Losing an item
Events
Unit - A unit Loses an item
Conditions
((Item being manipulated) is owned) Equal to True
Actions
Game - Display to (All players) the text: (Name of (Item being manipulated))
The condition sees if the item is still owned.
However, we were waiting for it to be lost.
Conclusion: the action will not run.
Problem 2:
Code:
Unit dies 1
Events
Unit - A unit Dies
Conditions
Actions
Trigger - Run Unit dies 2 <gen> (ignoring conditions)
Code:
Unit dies 2
Events
Conditions
Actions
Game - Display to (All players) the text: (Name of (Dying unit))
Clearly, the second trigger has no events, so the event response "Dying unit" does not exist there.
Problem 3:
Code:
Triggering Caster
Events
Unit - A unit Spawns a summoned unit
Conditions
(Triggering unit) Not equal to (Summoning unit)
Actions
Game - Display to (All players) the text: This can't happen, ...
Game - Display to (All players) the text: (T: + (Name of (Triggering unit)))
Game - Display to (All players) the text: (C: + (Name of (Summoning unit)))
Indeed, can't possibly happen.
Problem 4:
Code:
Count 1
Events
Map initialization
Conditions
Actions
Set UnitCount = 0
Unit - Create 1 Furbolg for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
Unit - Create 2 Furbolg for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
Unit - Create 3 Furbolg for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
Code:
Count 2
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Set UnitCount = (UnitCount + 1)
Code:
Count 3
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Game - Display to (All players) the text: (Units created: + (String(UnitCount)))
Obviously, UnitCount will be 0 since "map init" happens before any other triggers run, so it will never be updated.
Problem 5:
Code:
Integer A
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
For each (Integer A) from 10 to 1, do (Actions)
Loop - Actions
Game - Display to (All players) the text: (Current value of "Integer A": + (String((Integer A))))
Custom script: set bj_forLoopAIndex = bj_forLoopAIndex - 2
"Integer A", as we all know, is a global variable, a "bj" actually, called "bj_forLoopAIndex".
Given for loops automatically add +1 on each run, we could use some JASS magic to subtract 2.
Which, in fact, subtracts 1 and we can loop "backwards".
Problem 6:
Code:
Alliance 1
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
Player Group - Make (All players) treat (All players) as an Enemy with shared vision
After that, all players, literally, will be enemies.
This also includes Neutrals.
As such, you will be enemy to, for example, Neutral Passive.
Code:
Alliance 2
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Game - Display to (All players) the text: All players:
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Game - Display to (All players) the text: (Name of (Picked player))
So, obviously, this will show all players 1 to 12, those that are in the game that is.
And, of course, given Neutrals are always there, and we noticed how it works from the previous trigger, this will also show all the Neutrals.