Welcome to Age of Mythology Heaven
Welcome
Downloads Home
Review Guidelines
Main site
Forums
Code of Conduct
Help
Search

Advanced Search
Utility Programs
Home
New Releases
New Reviews
New Comments
Top-Rated

Submit File
Browse Categories
New Files

Utility Programs » Target Protounit Query Triggers

Download File Post Review Post Comment

Target Protounit Query Triggers

Author File Description
HailToTheOboe TARGET PROTOUNIT QUERY TRIGGERS
HailToTheOboe

This is a pack of triggers, similar to nottud's ySearch triggers, that let you find protounits in an area without selecting object parameters, and target them with any effect/conditions you want.

The idea is to perform multiple actions on protounits under various conditions without making a specific query trigger for every combination of conditions and effects.

Think of it as being very similar to a ySearch, but it uses knowledge base unit queries instead of an exhaustive search through all units. Here are the main differences between v TPQ and ySearch.
1) Faster and more reliable
2) No hassle with "max unit name", rebooting, and the buffer size.
3) Cannot find all units - things like projectiles or SFX will not be found. ySearch on the other hand, can find anything.
4) Does not find the unit "name" just the unit ID, which limits (slightly) the possibilities for effects.

Here is an example of how you may use it.
v Target Protounit Query Start
v Conditional Percent Damaged
v Invoke God Power
v Kill
v Condition zEnd
v Target Protounit Query End

This would find the protounits in the area, and if they are damaged a certain amount it will invoke a GP at the location and kill the unit.
This means you do not need to request a "invoke GP and kill percent damaged protounits in area."
Each individual condition and effect is very easy to code on request, if the non v TPQ version already exists. Additionally, many yTrigger effects can be used directly, and those that can't would only need very small modifications.
In order to code new v TPQ effects, here are things to keep in mind:
1) The unit is already selected by trUnitSelectByID
2) The unit ID is stored in the variable "UnitID"
3) The player of the unit is stored in the variable "pid" and the context is already set.
4) The location of the object can be found with kbUnitGetPosition(UnitID)
5) The protounit can be found with kbGetUnitBaseTypeID(UnitID)

Another feature has been added to some of the Conditions and Effects, this is the "QV?" parameter. When this parameter is set to ON, enter the input as a quest var name, and if it is set to OFF, enter the input as a number. This prevents the need for typing trQuestVarGet("QV1") or making separate triggers for QVs and numbers.

TL - means trigger loader required (downloadable here http://aom.heavengames.com/downloads/showfile.php?fileid=7609)
SP - means Single Player only.


Effects List:

*v 1 Target Protounit Query Start

This is the first effect to put in.
This effect defines which protounits you are looking for, where, and what basic conditions apply.
After this effect, place all of the conditions and effects you want to target the protounits with, and at the very end of the trigger put "v 2 Target Protounit Query End"

Parameters:
Center Unit: A unit located at the centre of the circular area you want to search (optional)
Radius: The radius of the circular area you want to search. If you enter -1, the query will search the entire map.
Player: The player to whom the targeted protounits belong. Enter 99 to search for all players.
Protounit: The type of protounit that will be found. Leaving this parameter blank will search for all units.
Action: The Action ID of the targeted units. For example 9, for idle, or 29 for "Thrown" See the attached list of action IDs. Leaving it at -1 will accept any action.
Unit State: 2 for alive, 4 for dead, 255 for any. Be careful when searching dead units, because long dead units will still be found, but their location will be interpreted as (-1,-1,-1), or the bottom corner. There is a condition available ("Condition Ignore invalid unit") to ignore these.

*v 1 Target Protounit Query Start (Center Army)
Same as above with an army instead of a centre unit. Army of just one unit, please.

*v Secondary Target Protounit Query Start
This effect has all the same parameters except for center unit. This starts a second query, where the centre location is a protounit found by the main query. This lets you target units in area of protounits in area. Make sure you end with a Secondary Target Protounit Query End.

*v Secondary Target Protounit Query End
Closes the secondary search, and goes back to the primary search

*v Condition Else
This is used as part of a multi-stage condition, where the following effects will target units that did not satisfy the previous condition. It is most easily demonstrated by example. You do not need a Condition zEnd to match the Else, just to match the regular conditions.

v Condition Percent Damaged
v Kill
v Condition Else
v Change Unit Type
v Condition zEnd

If the unit is damaged enough, it kills it. If not, it changes it to another unit.

It can also be used to invert a condition.

v Condition Unit Type
v Condition Else
v Change Unit Type
v Condition zEnd

Any unit that is NOT the specified unit type, gets changed.


*v Condition OR
Place this after each Condition that you want to be grouped. For the effect to fire, one condition OR another must be true, not necessarily both. You can use groups of more than 2 conditions, and choose the minimum number that must be satisfied (for example if 2 out of 3 conditions are true, fire the effect).

The last OR in the group should be a v Condition OR last. You only need a Condition zEnd for the OR last, not for the rest of the conditions.

v Condition Percent Damaged
v Condition OR
v Condition Distance to Unit
v Condition OR last
v Change Unit Type
v Condition zEnd


*v Condition Diplomacy of Unit
Select a player, and it will check the unit's diplomacy towards that player.

*v Condition Diplomacy towards Unit
Select a player, and it will check that players diplomacy towards the unit.

*v Condition Distance to Unit

*v Condition Distance to Army

*v Condition Ignore invalid unit
This checks if the unit is "invalid". The condition is true only when the unit is NOT valid. An invalid unit is a unit that does not exist, or has been dead for a very long time. This condition is only necessary when using Unit States of 4 (dead) or 255 (any) in the query.

*v Condition Percent Complete

*v Condition Percent Damaged

*v Condition Unit Action
Checks if a unit is performing specific action. See attached list of action IDs. Example, 9 for idle, 11 for move.

*v Condition Unit Current HP

*v Condition Units in Area

*v Condition Unit Height

*v Army Deploy to Unit
new function for "overlap." Deploys as flying unit, grounds it, and changes type.

*v Camera Cut to Unit

*v Garrison

*v Flare Minimap on Unit

*v Move to Random Location

*v Move Random Direction TL

*v Move away from unit TL
Moves the units found in the search away from the selected unit.

*v Move away from army TL

*v Move unit away from protounit TL
Inverse of the above, moves the select unit away from protounits found in the search. Only works well for small numbers of protounits.

*v Move army away from protounit TL

*v QV Count Units
QV counts upwards, once per unit. NOTE: It starts at its current value, not zero. Initialize it to zero before the query if you want it to start at zero.

*v Teleport to Unit SP
Teleports to the location of the unit + (X,Y,Z)

*v Unit Stance

*v Unit Work

*v Kill

*v Invoke God Power

*v UI Select Unit

*v Conditional zEnd
Closes a condition.

*v 2 Target Protounit Query End
Closes the search.

Thanks to invent00r, Mythic_Freak, nottud, angryzor, pftq, and perpetual_n00b. Whether they knew it or not, they were all a great help, even if it was just me looking at their code.

****************************
Update February 9

Modified:
v 1 TPQ Start
v 1 TPQ Start (Centre army)
v Condition Unit Type

to allow using unit type IDs, as well as protounit type. If you have the trigger loader activated, you can type in constant names like cUnitTypeUlfsark for the unit type of an Ulfsark, or cUnitTypeAbstractArcher, or cUnitTypeLogicalTypeIdleCivilian etc. See the trigger loader or protox for more info on these lists. You can also use the number, if you happen to know the number.

Added:
v Army Add Unit
v Condition Unit Selected (Thanks lostrozzacavalli, although I modded it)
v Condition Random Unit (Thanks perpetual n00b though I modded this too)
v Change Type, v Convert, and a number of others which I had left out previously because they are identical to yEffects. I put them in to try to avoid confusion.

****************************
Update February 14
Modified
v 1 TPQ start
v 1 TPQ start (Centre army)
so that they stop searching after the centre unit dies.

Update June 23
Lots of bugs fixed. Including many effects which broke if you tried to use QVs. Secondary Query is fixed after being broken in a previous update. A couple other small issues fixed.
New trigger subset: Array search.
These are older triggers of mine modified to work in compliance with v triggers. These use QV arrays made by invent00r in the trigger loader.
You store units in this array, and later you can find them by searching through the array. All the v conditions and effects should be usable during an array search. If any are not, let me know.
AuthorComments & Reviews   ( All | Comments Only | Reviews Only )
lostrozzacavalli Wow Hail! First download :P.
Guard of Olympus
Rating
5.0
Rating: 5
This tool is really usefull, as it is much easier to use than the y-triggers. I like how the parameters are laydout and the way these triggers don't lag at all! That's what's so great with them, they run smoothly, they work perfectly and they are very, very usefull as it's like a more foucused form of the transform trigger, only with more uses. This is a must-download for anyone, scenario designer or trigger scripter.

Additional Comments: Great work, Hail. Sorry for my short review, I'll maybe update. :)
Guard of Olympus Just a small thing though. I don't seem to have the v Change unit type trigger...
HailToTheOboe
File Author
You can use yChange Unit Type, because it doesn't need any information about the location of the unit. All it needs is for the unit to be selected beforehand, which both this and ytriggers do.

Quite a few effects work like that yConvert, yChange Unit Type, yChange Name, yMove to Point etc. I tried to find the most important ones that were not compatible, and made effects for those. If I missed any, just let me know.

If you really want, you can copy yChange Unit Type and rename it with a v :P
CharlieDog
Rating
5.0
Rating: 5
These are some of the most useful triggers I've come across. They're really helpful for targeting protounits that the AI has created, or making every unit of one type move towards one place. I use these a lot. And being used in combination with y triggers, these are really something else. Thanks Oboe.
Additional Comments:
Milkman Matty
(id: Khan And Steak)
Are these for AoM or TT? ~ Steak
HailToTheOboe
File Author
Yes
Zenophobia they work for AoM Vanilla? How?
Spike Dragon
Rating
5.0
Rating: 5++
the best triggers on AomH, simple to use, and anything can done whit them.

Additional Comments:
DOWNLOAD!
eine_Gurkensalat
(id: eine_gurkensalad)
-why all effects are not explained in this topic?
example: how works the "add units in army" effect?

-anyway this triggers are perfect !

[Edited on 04/20/17 @ 01:51 AM]


Post Review Post Comment

HGDL v0.8.2

Login
Forum Username:


Password:




Create a new account
Forgot password?
Rating
5.0
Statistics
Downloads:874
Favorites: [Who?]2
Size:231.95 KB
Added:11/29/09
Updated:06/23/10
Recently Updated