[eINFO] Some notes on events

I posted in another topic a mine from elemental.exe showing us the possible triggers for events, thought I'd say a few things about them here.

Functional triggertypes

CityPopulation - the only one used in vanilla. Reads all your cities and if it finds a city with equal or above population, it can trigger the event. This does not have to be the capital city.

        <TriggerType>CityPopulation</TriggerType>
        <TriggerData>25</TriggerData>

TotalPopulation - reads the total population of all your cities. If equal or above the triggerdata, it can trigger the event.

        <TriggerType>TotalPopulation </TriggerType>
        <TriggerData>25</TriggerData>

UnitLevel - Reads the level of a specific unit. If equal (untested: can it trigger if unit is above level?), can trigger the event. Note the very specific unitname here, making this one a bit difficult to use. Player designed units have uniquely generated unitnames, so they can never be the trigger.

One example of an event where this might be useful is if the player starts the game with a pet. If this pet levels up to a certain level, the event could trigger and start a quest where the unit must travel to the capital city. Once it reaches the city, it could be replaced by a stronger unit. In this manner, a unit could potentially be replaced in a chain, leading to an "ultimate evolution". Edit: This is an example of a quest where a pet is changed in power as he levels up. In order for a unit to be destroyable by a quest, it must be spawned by a quest. So, this quest is in two parts: first, spawn the pet. When the pet levels up, send it to your capital to train. When it reaches your capital city, "destroy" the pet and spawn a new one. Note that the quest is actually triggered by a sovereign gaining level 2. It is not possible to trigger a quest from a levelup, and then destroy the unit that triggered the quest.

Another example is a quest that triggers on a certain level for a sovereign, and causes a champion to spawn (a childhood friend perhaps, or why not a spouse?). These would have to be tailored to each sovereign, and would not trigger from custom sovereigns unless they too had quests tailored for them.

Another use could be for example a darkling unit that levels high enough. The player is then prompted with the opportunity to replace the unit with recruit a new, one-time elected shaman. Or it could result in the darklings finally sharing some rare technology with you (maybe simply a map to another darkling village). Or an army of drota, the sworn enemy of darklings, attacking you.

   <TriggerType>UnitLevel</TriggerType>
        <TriggerStringData>Lady_Irane</TriggerStringData>
        <TriggerData>2</TriggerData>

UnknownNonfunctional

ImprovementBuilt - had no luck mixing any <TriggerStringData> and <TriggerData> in.

TechnologyResearched - had no luck <TriggerStringData> and <TriggerData> in, tried techs researched and techs the player had from the start.

SpellResearched - Similarly, no luck after I researched a spell.

 


 

2,652 views 2 replies
Reply #1 Top

From irc, a chat with the guy that programmed the back-end for quests

highlights:

  • when tile-quests are spawned they compete for the spawn with other quests with the same quest tile through triggerchance
  • events use posttriggerchance, which is a random roll each turn from 0-100 each turn if the trigger is fulfilled. Posttriggerchance only accepts real numbers, so we can't use 0.0001 only 1-100.
  • I tested if events also use triggerchance and they do, and that chance is rolled immediately when the trigger is fulfilled (posttriggerchance is rolled at end of turn)
  • the three triggertypes listed above are the only functional
  • there is no way to make quests mutually exclusive

edit: also, I should note that in 1.3 beta the spawnrating tag no longer excludes a player from accepting a quest or event, but I don't know if tile-quests spawn unless your A_QuestingRating is high enough. Either way, a manually placed high-spawnrating tile-quest can be accepted by anyone in 1.3 beta, and an event with a high spawnrating can always be triggered and accepted.


17:21 <dream-er> so cari tells me you have some questions about elemental quests?
17:23 <dream-er> ( she asked me to pop on to help answer any of your questions :) )
17:24 <Heavenfall> yes please =)
17:24 <Heavenfall> If you have a few minutes spare, I would like to ask some questions in regards to how events are rolled for in randomness. Specifically how the tags <SpawnRating>, <TriggerChance> and <PostTriggerChance> work
17:25 <dream-er> sure thing!
17:25 <dream-er> what would you like to know?
17:25 <Heavenfall> What are they? =)
17:26 <Heavenfall> For example, what's the difference between 1 and 500 in spawnrating
17:27 <Heavenfall> And triggerchance, I assume is the % chance for an event to occur when the conditions are fulfilled? And posttriggerchance the same but rolled every turn after?
17:27 <dream-er> so, Spawn rating for quests is used to determine whether or not a player can accept the quest
17:28 <dream-er> and also helps determine what quests are spawned in which areas (the code helps you out by placing quests within your spawn rating range closer to you)
17:29 <dream-er> so i you set SpawnRating to 500, i'm pretty sure you would never see the quest, because no player in the default game could ever get a spawn rating level that high
17:29 <dream-er> Player's quest ratings are determined by their "A_QuestingRating" ability which various techs/abilities modify
17:31 <dream-er> "TriggerChance" is the weighted likelihood across a SpawnRating that this quest is spawned inside of the created goodie hut
17:31 <Heavenfall> I'm more interested in the time-spawned events
17:32 <dream-er> the "time-spawned" events use "PostTriggerChance"
17:33 <dream-er> every turn the player looks through the list of their unspawned quests (if they can support more quests) and if they have a city and then uses the PostTriggerChance (0-100) to determine whether or not to spawn that quest
17:34 <Heavenfall> is the roll only real numbers, or could I use <PostTriggerChance>0.1 ?
17:34 <dream-er> so if you had a PostTriggerChance=0, that quest would never come randomly to a city. if you had a PostTriggerChance=100, that quest would be quaranteed to trigger once during the game
17:35 <dream-er> its only real numbers unfortunately :/
17:35 <Heavenfall> by the way, I hope you don't mind I copy and paste this information on the mod forums
17:35 <dream-er> i don't see why that would be a problem :)
17:35 <Heavenfall> I also have some questions about the triggertypes
17:36 <dream-er> what about them?
17:36 <Heavenfall> CityPopulation and TotalPopulation were easy to understand, UnitLevel I managed to get working as well
17:36 <Heavenfall> but if I wanted to use ImprovementBuilt and
17:36 <Heavenfall> TechnologyResearched & SpellResearched how would I go about doing that in the XML?
17:37 <dream-er> this is for War of Magic, correct?
17:37 <Heavenfall> yes
17:38 <Heavenfall> I got the types straight from the exe, so I don't even know if they are hooked up to anything
17:38 <dream-er> indeed, let me look it up real fast
17:40 <dream-er> unfortunately, it doesn't look as though those Triggers were ever implemented
17:41 <Heavenfall> and one last question, is there any way to make quests mutually exclusive? ie if quest 1 spawns, quest 2 can never spawn
17:43 <dream-er> no. the only functionality that comes across as similar would be if you made a quest that forced you to choice up-front which of two paths you would like to take
17:43 <Heavenfall> Unfortunately choice is the very thing I want to avoid, hehe
17:44 <dream-er> ah, then no, sorry, there isn't anything like that :(
17:45 <dream-er> anything else i can help you with? :) i know the XML tags are sometimes vague since they're poorly documented so i feel for you (even as a dev i have to go double check tags a lot)
17:46 <Heavenfall> I think I've asked all my questions, thanks for the information

Reply #2 Top

Awesome, thanks a lot for the info, Heavenfall!