How would I go about using this "catalog function"?
Use them in the way I described above.
Here is an example trigger that when pressing esc it will print out all base damage amounts of all weapons (including hidden) for all selected units.
Weapon Damage Test
Events
UI - Player Any Player presses Escape key Down with shift Allow, control Allow, alt Allow
Local Variables
display player = (Triggering player) <Integer>
display player group = (Player group(display player)) <Player Group>
u = No Unit <Unit>
p = 0 <Integer>
i = 0 <Integer>
weapon n = 0 <Integer>
weapon = No Game Link <Game Link - Weapon>
effect = No Game Link <Game Link - Effect>
damage = 0.0 <Real>
text = No Text <Text>
Conditions
Actions
Unit Group - For each unit u in (Selected units for player (Triggering player)) do (Actions)
Actions
Variable - Set p = (Owner of u)
Variable - Set i = 1
Variable - Set weapon n = (Number of weapons on u)
General - While (Conditions) are true, do (Actions)
Conditions
i <= weapon n
Actions
Variable - Set weapon = (u weapon i)
Variable - Set effect = (Game Link((Value of Weapons weapon DisplayEffect for player p)))
Variable - Set damage = (Real((Value of Effects effect Amount for player p)))
Variable - Set text = (Combine ((Text((Unit tag of u))), " ", (Name of u), " : ", (Game text for (Value of Weapons weapon Name for player p)), " -> ", (Text(damage) with Any Precision decimal places)))
UI - Display text for display player group to Subtitle area
Variable - Modify i: + 1
How would I use triggers to find the damage of the caster's current weapon?
You can dynamically lookup the weapon a unit is using, then use catalog functions to look up its tooltip damage effect (which should be the weapon damage) and then use catalog functions again to get the damage effect's various damage fields. You then multiply this by your damage factor, and use triggers to deal the damage to the appropriate unit. Trigger dealt damage will automatically inherit all damage modifiers from the source (damaging) unit as permitted by the effect used to deal the damage. Eg if a unit has +400% weapon damage and the damage effect used is modified by weapon damage then the trigger damage will also deal +400%, hence why it is sufficient to look up the base effect damage.
For usability I recommend a trigger enhanced effect to do this. A trigger enhanced effect is a dummy effect, eg a Set effect that does nothing, that is used to fire a trigger using the Effect trigger event. As the event references a single effect link, the trigger will only fire when that dummy effect is used making it very efficient and highly scalable. Since a dummy effect is used, it merges seamlessly with data and the effect can be used in place of a normal damage effect. The trigger would resolve the weapon damage of the effect source unit, compute the damage to deal, and then deal damage from source effect unit to target effect unit using an appropriate Damage effect, which could be either a generic dummy damage effect used by many triggers or a special purpose dummy effect created just for a specific source of damage.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Use them in the way I described above.
Here is an example trigger that when pressing esc it will print out all base damage amounts of all weapons (including hidden) for all selected units.
Here is the same trigger but in galaxy form.
You can dynamically lookup the weapon a unit is using, then use catalog functions to look up its tooltip damage effect (which should be the weapon damage) and then use catalog functions again to get the damage effect's various damage fields. You then multiply this by your damage factor, and use triggers to deal the damage to the appropriate unit. Trigger dealt damage will automatically inherit all damage modifiers from the source (damaging) unit as permitted by the effect used to deal the damage. Eg if a unit has +400% weapon damage and the damage effect used is modified by weapon damage then the trigger damage will also deal +400%, hence why it is sufficient to look up the base effect damage.
For usability I recommend a trigger enhanced effect to do this. A trigger enhanced effect is a dummy effect, eg a Set effect that does nothing, that is used to fire a trigger using the Effect trigger event. As the event references a single effect link, the trigger will only fire when that dummy effect is used making it very efficient and highly scalable. Since a dummy effect is used, it merges seamlessly with data and the effect can be used in place of a normal damage effect. The trigger would resolve the weapon damage of the effect source unit, compute the damage to deal, and then deal damage from source effect unit to target effect unit using an appropriate Damage effect, which could be either a generic dummy damage effect used by many triggers or a special purpose dummy effect created just for a specific source of damage.