Posted: Thu Oct 17, 2024 9:53 pm Post subject:
Attaching Triggers in YR - Possible to chain triggers?
I'm experimenting with attaching triggers together to achieve a desired result. I've wondered for a while how attaching triggers work (because I know an object can have multiple triggers interacting with it like in YR Allied #06) and wanted to know what I could get a away with. But uh... it's not working.
What I'm trying to do is make it so that a group of oil derricks need to be captured by the player and then defended until the end of the mission. I also want to give a warning to the player when one of the derricks is under attack. I tried to make triggers so that when all of the derricks are captured, it sets a local variable that will trigger the first objective as being completed. Making a single trigger of type "1" didn't work, so I resorted to multiple triggers. I then attached a single "attacked" trigger and a "destroyed" trigger that are of type "0" and "1" respectively, and I attached them to each of the capture triggers in a chain. It doesn't appear to be working, likely because I have one trigger that is attached to multiple triggers and the game is just getting confused. For reference, the buildings each are attached to a trigger indicating when they've been captured, then those four trigger have a single trigger attached to them that's supposed to fire once when one of them has been attacked, and finally that trigger has another trigger attached that's supposed to fire when all the buildings have been destroyed. What happens is that each of the capture triggers work fine, but the attacked and destroyed triggers don't fire at all.
What I might try next is doing individual sets of triggers for every building, have each one attached to its own chain of triggers in the order of "captured <-> attacked <-> destroyed," then have each of the destroyed triggers set a local variable. Once all four buildings are destroyed and their local variables are set, it triggers the failure sequence. No idea how that's going to work, but it's worth a shot at least, and it'll help me to understand how to attach triggers to one another efficiently.
What are your guys' thoughts on this? Rampastring's World-Altering Editor really helped me understand triggers a bit better so hopefully I can get better at this with time. _________________ Content creator for Command and Conquer: Tiberian Sun and Red Alert 2 games and mods.
Update: It turns out that in YR, capturing a building removes a tag from it automatically (because it counts that building as being destroyed), which it means it wasn't anything wrong with my trigger arrangement/execution, but rather I didn't account for the fact that the tags for the oil derricks were gone by the time those triggers were set to activate.
This does complicate things, but at least I learned something from it. _________________ Content creator for Command and Conquer: Tiberian Sun and Red Alert 2 games and mods.
You made your description to wordy... To complicated to read through all points.
Maybe for the all oil rigs captured:
You could make an new house called oil house, just for the oil rigs, kind of like a 2nd civy house.
Then use a trigger event; "10 Destroyed, Buildings, All..." for oil house that would trigger objective 1 complete.
For each oil rig, attach a individual/unique linked tag/trigger attacked/destroyed trigger, to signal under attack or game lost condition. _________________ MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.) QUICK_EDIT
yes, its hard for me to envision the trigger arrangement when you describe it like that. it helps to describe what you are trying to do as simply as possible, and then how your triggers are set
up in some logical order. also screenshots help a lot.
maby try using a dummy house to make the player repair the buildings instead of capturing them, and then use a trigger to change the building owner and see if that circumvents the ownership
change/trigger destruction thing.
for a trigger that can be fired repeatedly try the following setup
trigger type 2, repeating
event 1: local is clear
event 2: (optional) elapsed time
event 3: whatever you want
action 1: set local
action 2: clear local
action 3: whatever you want
when a trigger event is met, it registers it as met continuously making the game fire the actions repeatedly forever until disabled. actions are fired 1 frame apart, in sequence. by setting
the local and then clearing it again the next frame, it resets the loop. so the above trigger will fire one time, every time event 3 is met.
you can use this arrangement the give the player a warning every time the buildings takes damage, using elapsed time to limit how frequently the warning plays.
so you need a duplicate of this whole setup for every oild:
1st trigger
event : repaired
action 1 : set one of 4 capture locals
action 2 : change house
2nd trigger:
the trigger repeat setup mentioned above
3rd trigger:
event: destroyed
action: set one of 4 failure locals
and then 1 of each of these two triggers:
4th trigger
events 1-4: capture locals are set
action 1: whatever you want to happen when they are all captured i guess
5th trigger
events 1-4: failure locals are set
action: mission failed
then uhh.... i think i recall multiple triggers not firing through a single tag unless that tag is set to repeat, so attach trigger 2 to the oild and have triggers 1 and 3 as triggers attached
to trigger 2's tag and see if that works _________________ visit my moddb profile for .shp downloads and stuff QUICK_EDIT
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum