Trigger Happy

Here you can post about your scenario's, mods, custom maps and YouTube channels!
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Trigger Happy

Post by Root_Foot »

Hi all. I'm trying to do the "kill method" as described in The Triggers Tutorial AOE V3 so that killing an enemy unit grants 10 "looted" gold.

Trigger Name: Kill_Wood Conditions:
Active: yes Stat Value:
Loop: yes enemy units killed:
Run Immediately: yes equal to 1.
Priority: High
Effects:
Grant Resources:
Wood, food or gold
Depending in what
is the shop.

However, this method clearly has issues, namely that after one enemy unit is killed, the trigger loop checks that number and accumulates 10 gold continuously upward to infinite gold. Hilariously, the grant resource effect ceases after the second enemy unit is killed because Stat Value: enemy units killed: now equals 2.

Quite sure this is a n00b question but can't find anything online that solves it. Pls help. Also, if this thread gains traction I'll post more trigger questions that I've been having.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

hi, i've never used it so far, but i think it will work with the quest var trigger (set QV)

M925 triggerpack + explaination: "QVs (Quest Vars) are a way to save numbers in your scenario. QVs can be set, randomized, and modified. They can be used to keep track of Player Stats, Unit Stats, or really anything that is a number."

[spoiler=link]http://aoe3.heavengames.com/downloads/showfile.php?fileid=2902&ci=44576fbadcde6e46737490538e671fefYToxOntpOjA7YToyOntpOjA7czoxNDoiU2VhcmNoIFJlc3VsdHMiO2k6MTtzOjM3OiJsaXN0ZXIucGhwP3N0YXJ0PTAmYW1wO3NlYXJjaD10cmlnZ2VyIjt9fQ==[/spoiler]

gl (maybe somebody can explain it in detail)
France Kaiserklein
Pro Player
Posts: 10278
Joined: Jun 6, 2015
Location: Paris
GameRanger ID: 5529322

Re: Trigger Happy

Post by Kaiserklein »

Dunno exactly what kind of triggers you get in musketeer's pack, so I'm not sure that this is how it would look or even if it's doable, but it shows the idea at least.
You'd need to create this pair of triggers for each player (so 16 triggers if you want 8 players to get gold when they kill a unit), and replace "x" by his number (x = 1 for player 1).



- 1st trigger: Set var QVx (or whatever you want to call that var) to 1. Just initializing QVx here. Run immediately.

Effect:
Type: Quest Var Modify
Var Name: QVx
Operator: =
Value: 1



- 2nd trigger: when stat value "Enemy Units Killed" is equal to QVx for player x, set QVx to QVx + 1 and grant 10 gold to player x. Loop.

Condition:
Type: Stat Value
Fake Player: x"
Stat Type: Enemy Units Killed
Operator: ==
Value: QVx


Effects:
Type: Quest Var Modify
Var Name: QVx
Operator: +
Value: 1

Type: Grant Resources
Player: x
Resource: Gold
Amount: 10
Image
Image
Image
LoOk_tOm wrote:I have something in particular against Kaisar (GERMANY NOOB mercenary LAMME FOREVER) And the other people (noobs) like suck kaiser ... just this ..
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

Post by Root_Foot »

:hmm: I downloaded the M925 trigger pack and tried the triggers detailed by kaiserklein. Unfortunately entering letters in the stat value box disables all my triggers :cry:
France Kaiserklein
Pro Player
Posts: 10278
Joined: Jun 6, 2015
Location: Paris
GameRanger ID: 5529322

Re: Trigger Happy

Post by Kaiserklein »

Maybe the other way around, try to compare QVx with the value "Enemy Units Killed"? If that doesn't work then idk
Image
Image
Image
LoOk_tOm wrote:I have something in particular against Kaisar (GERMANY NOOB mercenary LAMME FOREVER) And the other people (noobs) like suck kaiser ... just this ..
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

Usually you've made an error in the typetest file (trigger 3, game installation folder), when you can't select a trigger anymore. I hope you've saved your typetest file before editing it. If you spend some time and have some coding experience, then you'll find a solution. Otherwise you're quite on your own and have to spend a lot of time, because there are no good explainations for advanced scenario triggers on the Internet.
Tip: You can save a scenario with a working shop and then go to the trigtemp.xs file (trigger 3, personal aoe folder) and see the triggers + the code, that was used in the scenario.

There are only a few experts, but if you don't have coding experience they usually hardly help and i understand why. Once i tried to explain some basic stuff (as a self-taught person) to a total layman and then he quit at 90% progress because he was to lazy to go the extra mile and find an error = some hours wasted.
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

!

Post by Root_Foot »

supahons wrote:Usually you've made an error in the typetest file (trigger 3, game installation folder), when you can't select a trigger anymore.


It's not the trigger selection that's the issue - when I playtest scenario none of my triggers are active because I'd entered a non-numeral into the Stat Value box. The same thing happened to me once when I had a "Change Name" effect with the letter è in it.

Kaiserklein wrote:Maybe the other way around, try to compare QVx with the value "Enemy Units Killed"? If that doesn't work then idk


I appreciate the advice. I'm a fan of your work!

I'll post again if I get it working.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

i wanted to see if i can find a solution -> i've used a colloseum trigger for this
[spoiler]rule _P1_Gold
highFrequency
active
{
bool bVar0 = (trGetStatValue(1, 2) >= trQuestVarGet("P1 Kill")+ 1);


bool tempExp = (bVar0);
if (tempExp)
{
trQuestVarSet("P1 Kill", trQuestVarGet("P1 Kill") + 1);
trPlayerGrantResources(1, "Gold", 1);
trPlayerGrantResources(1, "Wood", 1);
xsDisableRule("_P1_Gold");
trEcho("Trigger disabling rule P1_Gold");
trDelayedRuleActivation("_P1_Gold");
}
}

from the trigtemp.xs file:
(trGetStatValue(1, 2) >= trQuestVarGet("P1 Kill")+ 1) = condition

converted in the typetest file:

<Condition name="QV Stat Value">
<Param name="PlayerID" dispName="$$22534$$Fake Player" VarType="player">1</Param>
<Param name="StatID" dispName="$$25424$$Stat Type" VarType="kbstat">0</Param>
<Param name="Op" dispName="$$22297$$Operator" VarType="operator">==</Param>
<Param name="QuestVar" dispName="$$32955$$Var Name 1" varType="string">QV1</Param>
<Param name="Op2" dispName="$$22297$$Operator" VarType="string">+</Param>
<Param name="Value" dispName="$$25372$$Value" VarType="float">0</Param>
<Expression>trGetStatValue(%PlayerID%, %StatID%) %Op% trQuestVarGet("%QuestVar%")%Op2% %Value%</Expression>
</Condition>[/spoiler]

add this code to your conditions +

Effect:
Questvar Modify
QV1 + 1
Grant resources

you're welcome ;)
Attachments
trigtemp.xs
(5.91 KiB) Downloaded 33 times
Coloseum settler Final.age3Yscn
(224.18 KiB) Downloaded 29 times
Testscenario_solved.age3Yscn
(40.88 KiB) Downloaded 17 times
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

  • Quote

Post by Root_Foot »

supahons wrote:i wanted to see if i can find a solution -> i've used a colloseum trigger for this
[spoiler]rule _P1_Gold
highFrequency
active
{
bool bVar0 = (trGetStatValue(1, 2) >= trQuestVarGet("P1 Kill")+ 1);


bool tempExp = (bVar0);
if (tempExp)
{
trQuestVarSet("P1 Kill", trQuestVarGet("P1 Kill") + 1);
trPlayerGrantResources(1, "Gold", 1);
trPlayerGrantResources(1, "Wood", 1);
xsDisableRule("_P1_Gold");
trEcho("Trigger disabling rule P1_Gold");
trDelayedRuleActivation("_P1_Gold");
}
}

from the trigtemp.xs file:
(trGetStatValue(1, 2) >= trQuestVarGet("P1 Kill")+ 1) = condition

converted in the typetest file:

<Condition name="QV Stat Value">
<Param name="PlayerID" dispName="$$22534$$Fake Player" VarType="player">1</Param>
<Param name="StatID" dispName="$$25424$$Stat Type" VarType="kbstat">0</Param>
<Param name="Op" dispName="$$22297$$Operator" VarType="operator">==</Param>
<Param name="QuestVar" dispName="$$32955$$Var Name 1" varType="string">QV1</Param>
<Param name="Op2" dispName="$$22297$$Operator" VarType="string">+</Param>
<Param name="Value" dispName="$$25372$$Value" VarType="float">0</Param>
<Expression>trGetStatValue(%PlayerID%, %StatID%) %Op% trQuestVarGet("%QuestVar%")%Op2% %Value%</Expression>
</Condition>[/spoiler]

add this code to your conditions +

Effect:
Questvar Modify
QV1 + 1
Grant resources

you're welcome ;)


Woohoo it works! Thank you so much! This will really improve the immersion of this scenario that I am working on.
dumb esoc meme.jpg


Unless I'm being a bother, I will mention another issue I'm having. There is a police force in this scenario that will switch from ally to enemy if you kill another player's unit and then attack you. I was able to successfully create a trigger for this HOWEVER, the scenario does not differentiate between enemy units killed (another police-protected player) and Gaia's bandits, coyotes, etc. Anyone tried a trigger like this where a player needs to be excluded? I am brand new to these QV triggers so I have a feeling that might be the route I'll have to take.
France Kaiserklein
Pro Player
Posts: 10278
Joined: Jun 6, 2015
Location: Paris
GameRanger ID: 5529322

Re: Trigger Happy

  • Quote

Post by Kaiserklein »

wtf XD
Image
Image
Image
LoOk_tOm wrote:I have something in particular against Kaisar (GERMANY NOOB mercenary LAMME FOREVER) And the other people (noobs) like suck kaiser ... just this ..
User avatar
United States of America musketeer925
Retired Contributor
Donator 01
Posts: 2483
Joined: Mar 28, 2015
ESO: musketeer925

Re: Trigger Happy

Post by musketeer925 »

I don't think it's possible to differentiate what types of units have died. Glad someone is finding use of my trigger pack still.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

@musketeer925 yes, thx for the triggerpack, it has helped me ;)
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

@Root_Foot u crazy, bro? take this and leave me alone :lol:

[spoiler]from the Onfiregun17 triggerpack
active, infinte loop

<Condition name="QV Player Dead Units Onfiregun17">
<Param name="PlayerID" dispName="Player" VarType="long">1</Param>
<Param name="UnitType" dispName="Unit Type" VarType="unittype">Unit</Param>
<Param name="Op" dispName="Operator" VarType="operator">==</Param>
<Param name="QVName" dispName="QV PointZero" VarType="string">QVxyz</Param>
<Param name="Value" dispName="Value" VarType="long">0</Param>
<Command>for(all=1600;>=-1){ if (kbGetUnitTypeName(all)=="%UnitType%") break;}</Command>
<Command>//a loop which ends if the Unit Type ID matchs the Unit Type</Command>
<Command>//My query starts... it is a search for units function where you can add filters</Command>
<Command>xsSetContextPlayer(%PlayerID%);</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>for(unitQueryID=kbUnitQueryCreate("get%PlayerID%i%result%");>5000){}</Command>
<Command>kbUnitQuerySetPlayerID(unitQueryID,%PlayerID%);</Command>
<Command>kbUnitQuerySetUnitType(unitQueryID, all);</Command>
<Command>kbUnitQuerySetState(unitQueryID,4);//Means Dead</Command>
<Command>kbUnitQueryResetResults(unitQueryID);</Command>
<Command>for(result=kbUnitQueryExecute(unitQueryID);>=50000){}</Command>
<Expression>result %Op% trQuestVarGet("%QVName%")+ %Value%</Expression>
</Condition>

Effect:
Questvar Modify
QVxyz + 1
Grant resources
-x (subtract them)[/spoiler]
Attachments
Testscenario_solved_v2.age3Yscn
(41.45 KiB) Downloaded 17 times
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

  • Quote

Post by Root_Foot »

supahons wrote:@Root_Foot u crazy, bro? take this and leave me alone :lol:

[spoiler]from the Onfiregun17 triggerpack
active, infinte loop

<Condition name="QV Player Dead Units Onfiregun17">
<Param name="PlayerID" dispName="Player" VarType="long">1</Param>
<Param name="UnitType" dispName="Unit Type" VarType="unittype">Unit</Param>
<Param name="Op" dispName="Operator" VarType="operator">==</Param>
<Param name="QVName" dispName="QV PointZero" VarType="string">QVxyz</Param>
<Param name="Value" dispName="Value" VarType="long">0</Param>
<Command>for(all=1600;>=-1){ if (kbGetUnitTypeName(all)=="%UnitType%") break;}</Command>
<Command>//a loop which ends if the Unit Type ID matchs the Unit Type</Command>
<Command>//My query starts... it is a search for units function where you can add filters</Command>
<Command>xsSetContextPlayer(%PlayerID%);</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>for(unitQueryID=kbUnitQueryCreate("get%PlayerID%i%result%");>5000){}</Command>
<Command>kbUnitQuerySetPlayerID(unitQueryID,%PlayerID%);</Command>
<Command>kbUnitQuerySetUnitType(unitQueryID, all);</Command>
<Command>kbUnitQuerySetState(unitQueryID,4);//Means Dead</Command>
<Command>kbUnitQueryResetResults(unitQueryID);</Command>
<Command>for(result=kbUnitQueryExecute(unitQueryID);>=50000){}</Command>
<Expression>result %Op% trQuestVarGet("%QVName%")+ %Value%</Expression>
</Condition>

Effect:
Questvar Modify
QVxyz + 1
Grant resources
-x (subtract them)[/spoiler]


Haha nah bruv, just a silly guy who can't pass up the opportunity to use a good meme.

Thanks all for contributing to the thread. It's especially a treat to see likes and comments from people I've watched in the ESOC tournaments/recognize from AOE3 Heaven.
Have a .gif that I found on tumblr.
trade route snorkel.gif
User avatar
Malaysia Aizamk
Pro Player
ESOC WarChiefs Classic 2017
Posts: 1459
Joined: Feb 26, 2015
Location: ded

Re: Trigger Happy

Post by Aizamk »

This unit attacked by player-> Police raid is possible (using the same concept in the obs UI that shows raids as blips on the minimap) but you need to give more detail on what you want.
oranges.
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

Post by Root_Foot »

Aizamk wrote:This unit attacked by player-> Police raid is possible (using the same concept in the obs UI that shows raids as blips on the minimap) but you need to give more detail on what you want.


Currently my formula is basically if(enemy units killed >10), then (police division attack town area). Each player has this trigger that corresponds to their town. Ideally I would have instead if(enemy units [excluding gaia]>1) so that killing treasure guardians does not trigger the police raid. I haven't tried the last solution offered by @supahons yet, so maybe the answer is already in this thread.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

My response was mainly to this M925 quote "I don't think it's possible to differentiate what types of units have died."

current solution:
infinite trigger 1: if random unit is killed then QV+1, grant resources +x

infinite trigger 2: cancel effect with the onfiregun17-trigger
if unit x/y/z is killed then effect QV+0, grant resources -x (to cancel the other infinite trigger, and subtract a few units+ cancel the resources)

That's only a botched solution and i didn't know what you exactly wanted to do, it will trigger your raid trigger one unit too early in this case and adds the gold for a moment + counts gaia units (idk?) ;)


new solution with the onfiregun17-trigger: but then you have to define every unit in the game that gives you gold, should be counted

infinite trigger:
if unit a is killed OR(check the box) unit b is killed, OR unit c is killed ....

then QV+1, grant resources +x

If you know how you can exclude certain units from the trigger then it's even faster to do, but it should work.

*note: there are sometimes problems with the gaia player and some triggers don't work. then you have to make the gaia player0 a real player 2-8.
User avatar
Rainbow Land onfiregun17
Skirmisher
Posts: 163
Joined: Feb 20, 2016
ESO: onfiregun17

Re: Trigger Happy

Post by onfiregun17 »

Supahons, I'm not entirely sure what your example is trying accomplish in this case. Would you mind elaborating? But M925 is correct, it's impossible to track which specific type of units that you've killed.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

@onfiregun17
i only answered the original question:
"I'm trying to do the "kill method" as described in The Triggers Tutorial AOE V3 so that killing an enemy unit grants 10 "looted" gold.
However, this method clearly has issues, namely that after one enemy unit is killed, the trigger loop checks that number and accumulates 10 gold continuously upward to infinite gold."

The first trigger version used the condition if any unit gets killed then grant resources (does it include treasure guardians?, idk) + subtract the resources if a certain unit gets killed
Then i replaced it with your condition if a certain unit type gets killed then effect grant resources (look at the map infinitely, if a certain unit dies grant res) - i thought that's what your trigger is doing in a loop

The trigger worked for me, when i've tested it with a hackapell + a lot of settlers and didn't produce the infinite accumulation of gold effect.
If sth doesn't work later on or has limitations i'm not aware of yet, well then i'm wrong, as i've mentioned before i'm not an expert. i'm confused now :D
User avatar
Rainbow Land onfiregun17
Skirmisher
Posts: 163
Joined: Feb 20, 2016
ESO: onfiregun17

Re: Trigger Happy

Post by onfiregun17 »

supahons wrote:@onfiregun17
The first trigger version used the condition if any unit gets killed then grant resources (does it include treasure guardians?, idk) + subtract the resources if a certain unit gets killed
Then i replaced it with your condition if a certain unit type gets killed then effect grant resources (look at the map infinitely, if a certain unit dies grant res) - i thought that's what your trigger is doing in a loop


Okay I think I see what you're doing now. You're using my condition "QV Player Dead Units." This effectively keeps track of what units of yours have died, but it in no way can be used to tell what units you've killed. So really, the only solution is as follows:

Trigger
Active: Yes
Loop: Yes

Conditions
QV Stat Value
Player: 1
Stat Type: Enemy Units Killed
Operator: >=
QV: QV1
Value: 25

Effects
Grant Resources
Player: 1
Resource: Gold
Amount: 10

QV Modify
Var Name: QV1
Operator: +
Value: 25

The example that was posted earlier in the thread was actually incorrect. It listed the operator in QV Stat Value as "==" which means their kills would have to be exactly 25 to work. With the operator as ">=" it would allow any kills 25 or higher to work.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

i thought the whole point of QV is to keep track of numbers - yes i've changed the operator in the scenario to >= but nobody has downloaded it ;)

look at this now: no need to explain just test it once
Attachments
Testscenario_solved_v3.age3Yscn
(43.16 KiB) Downloaded 15 times
User avatar
Rainbow Land onfiregun17
Skirmisher
Posts: 163
Joined: Feb 20, 2016
ESO: onfiregun17

Re: Trigger Happy

Post by onfiregun17 »

Alright, so I took a look at your map. You're using the condition "QV Player Dead Units" to keep track of what kind of units have died. Now, if your scenario only has Player 1 and Player 2, this would work for keep tracking track of what units have died. This is because what ever units of your enemy have died, only you could have killed. So this doesn't scale to more players at all, as it's impossible to distinguish who is killing which unit. You'll have to use my method above, there's no work-a-round unfortunately.

Now onto Quest Variables (QVs). A QV is merely a variable that you can modify the amount of. So for example, in algebra the variable is typically "x", but in this case we're just using a word. We can use this variable to adjust how much of something needs to be accounted for in a condition.

In my trigger example, we're using kills so let's use that. Once you reach 25 kills, we'll use the effect "QV Modify" to +25 to the quest variable "QV1". Now the condition still requires 25 kills, but it's also adding in the QV. So really it requires 25 kills + QV1. Since QV1 is now equal to 25, its 25 + 25 = 50 kills. Because of the QV increasing, we can loop triggers that otherwise couldn't be.

It looks like you have the logic down for QVs, so you're already on the right track.
User avatar
Austria supahons
Dragoon
Posts: 357
Joined: Feb 11, 2018
ESO: supahons

Re: Trigger Happy

Post by supahons »

@onfiregun17
ok thx, yes my triggers will only work in a single-player scenario, it makes sense now
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

Post by Root_Foot »

The scenario I've been working on if anyone is interested :P It's meant to be more RPG like, so don't complain that it's boring. All players besides P1 use AILoaderStandard and all besides P5 have vills restricted. I also know that I could have done shop trick triggers, but my computer started crashing @≈80 conditions and effects.

I am open to suggestions!
Attachments
maiden lake.age3Yscn
(545.51 KiB) Downloaded 17 times
User avatar
No Flag Root_Foot
Crossbow
Posts: 18
Joined: Oct 7, 2018
ESO: Root_Foot
Location: Arizona

Re: Trigger Happy

Post by Root_Foot »

Root_Foot wrote:The scenario I've been working on if anyone is interested :P It's meant to be more RPG like, so don't complain that it's boring. All players besides P1 use AILoaderStandard and all besides P5 have vills restricted. I also know that I could have done shop trick triggers, but my computer started crashing @≈80 conditions and effects.

I am open to suggestions!

I've been trying to make a power equilibrium. In this version Russia is too strong because I was trying to compensate for their collapsing so early each playthrough.

Who is online

Users browsing this forum: No registered users and 4 guests

Which top 10 players do you wish to see listed?

All-time

Active last two weeks

Active last month

Supremacy

Treaty

Official

ESOC Patch

Treaty Patch

1v1 Elo

2v2 Elo

3v3 Elo

Power Rating

Which streams do you wish to see listed?

Twitch

Age of Empires III

Age of Empires IV