How to Use Zenophobia's custom ytriggers
Hello everyone! At Yeebaagooon's request, I've compiled some of my lovely custom ytriggers and angle effects that I've been using in Zeno's Amusement Park in a trigger pack. This explains how to use them.
Angle Triggers
I'll start with the angle triggers because they are fairly straightforward. All my angles are in radians because the triggers like those more. You'll need to convert degrees to radians with PI/180.0
NOTE: Make sure all your values are floats. This can easily be achieved by adding '.0' after a number (i.e. 47 ->
Z00 Quest Var Vector Set 0 0 1
This is the most basic trigger. It takes your quest var vector of choice and sets its value to (0,0,1), which is a unit vector pointing at the 0 degrees heading, useful for lining up the heading of things you want to deploy.
Z01 QV Unit Vector Modify by Angle
The glorious angle trigger. This takes a quest var vector of length 1 and modifies its angle by your chosen number of radians.
IMPORTANT: The quest var vector must be a unit vector (length 1, which btw, is conveniently made by my Z00 Quest Var Vector Set 0 0 1 trigger above.)
NOTE: The angles are inverse to our heading triggers. Therefore, you typically want to subtract the angle rather than adding it.
Z02 QV Set Angle Between Vectors Radians
This trigger takes two quest var vectors as input and gets the angle from one vector to the other and stores it in a Quest Var.
The typical way I achieve my angle magic is with these three triggers. I follow the following steps:- Unit Position to QV Vector for my two
start and target vectors. Z02 QV Set Angle Between Vectors Radians to get the angle I want. Let's call this quest var angle Z00 Quest Var Vector Set 0 0 1 to generate a new quest var vector at the 0 angle. Let's call this shoot. Z01 QV Unit Vector Modify By Angle. Here, I type 'trQuestVarGet(" angle")' into the 'Radians' field, and I make sure the Operator field is negative. I'm modifying shoot by this angle, so now it's pointing in the same direction as the start to target angle. - Quest Var Vector Modify. Remember,
shoot is pointing in the right direction but it still only has a magnitude of 1. So I use Quest Var Vector Modify and multiply its X and Z axis by some large number, like 50. - Quest Var Vector Modify 2. I now add
start to shoot to get the right destination.
After these steps are taken, I can deploy a projectile to the
You can also do crazy stuff in between, like adding more projectiles and modifying their angle so that they fire multiple projectiles in a cone. This is how Angry Rocketmen were created.
Custom yTriggers
Here we go! Time to dive into one of the most complex but not actually trigger systems! Before we get into the triggers, I will be explaining exactly how ytriggers work here so you can be armed with amazing knowledge to do awesome stuff with yTriggers.
How yTriggers Work
Honestly, nottud's a genius for coming up with this stuff before even entering university. Basically, in an Age of Mythology scenario, every unit in the game is given a unique identifier, called a
Here's the important part: Each time a new unit is created, the
Now here comes the fun part.
trUnitSelectClear();
trUnitSelect("47");
trUnitChangeProtoUnit("Anubite");
Let's say that we've placed 500 units on a map. So we will first set
What the ytrigger does is it takes the value of
After the ysearch is done, it will set
y10 Start search all units Lite
This basically does exactly what I've just explained. It searches all names starting from the quest var of choice and selects all valid units.
y11 Search End All units Lite
This is the end of the ysearch. Place all your yEffects in between the y10 and this y11 effect.
y12 Reboot Search Lite
This basically searches some large number of your choice and sets the quest var to the largest name found. Nottud's ysearch actually combines this effect with the ysearch together so you typically don't have to worrying about rebooting your search, but it causes a much bigger workload on the scenario runtime.
y13X Hard Reboot Search Lite
The first of my dangerous ySearch triggers. This will infinitely search upwards until it finds the specified protounit, guaranteeing that your ytrigger quest var will catch back up to the highest unit name. If said unit doesn't exist, your game will enter an infinite while loop and hang forever! (My playtesters can attest to this.)
Don't be afraid to use this trigger though. As long as you know what you're doing, this should never happen. For example, in Zeno's Amusement Park, this trigger runs between minigames, when a Llama Caravan is guaranteed to be on the map.
If you put this inside of a trigger after an Army Deploy trigger and search for that specified unit type, it will be guaranteed to never break your game.
y00X Search Until Unit
Another dangerous trigger. This combines
y00X Search For Unit
This is a trigger I use very often and is incredibly useful. It's a variation of the previous y00X trigger (still just as dangerous) that only finds the specified unit that matches its criteria.
What's really nice about this is that you don't need to add
Keep in mind that this will skip any units that don't match its criteria! For example, if you're using
I use this most often for pairing a specific unit with a quest var so I can select it later. For example, at the start of a minigame, I deploy a Throwing Axeman for each player. Then, I copy a new quest var for each player from
Z Select Unit By QV
And while we're on the previous note, this is the trigger that goes along with
Custom yDatabase Triggers
Next up are my custom yDatabase triggers! Remember, the ysearch only looks at newly created units. But what if you want to save a unit for later? (like with
y20 Add To Database Lite
This will add a unit that's been searched to the database of your choice. Make sure that the "Same var as start" field matches the quest var of your ysearch that this trigger is placed inside of.
y21 Start Search Database Lite
This will start a search inside of a database of your choosing. It behaves exactly like a ysearch, so you can even add units from one database to another one! (which was previously impossible with nottud's ydatabase triggers)
The
y22 End Database search Lite
This is the end of your database search. Place all your yeffects you want between your y21 start and this trigger.
y23 Remove From Database Lite
This removes the unit from the database. The search will automatically remove dead units, so you don't have to worry about including this in your triggers just to remove dead things.
y24 Clear and Reset Database Lite
As the name suggests, this clears the database completely.
Add to Database Lite
This is for manually adding existing units to a database.
That's all for now!
All of my angle triggers require the Trigger Loader to work.[This message has been edited by Zenophobia (edited 02-29-2094 @ 10:60 AM).]
[This message has been edited by Zenophobia (edited 09-15-2019 @ 11:30 AM).]