I've got a trigger that isn't working the way I would like it to. My goal is to have 3 units, one owned by player 1, the other two owned by player 2 (a computer). When player one presses the tab key, it cycles to another unit, so player 1 now controls one of the units previously controlled by player 2, and player 2 gets control of the unit previously owned by player 1. Here is how I set up the triggers:
If I initialize Party Member[0] as the Main Character, pressing tab will do absolutely nothing. If I initialize either Party Member[1] or Party Member[2] as the Main Character, with player 1 having control over them right off the bat instead of Party Member [0], pressing tab will always switch control to Party Member [0] and further presses will do nothing. I can't see any problems with my triggers, but it is late, so another pair of eyes would definitely help.
What I have tried so far:
Using the "z" button instead of Tab.
Creating a trigger to confirm that the Main Character and Party Member[#] variables are being properly assigned.
Using an "(Owner of Party Member[#]) == 1" condition instead of the "Party Member[#] == Main Character" condition
None of these changes had an effect on the result.
Give me a moment to try recreating this. Logically everything seems in line to me just glancing over everything.
Edit 1:
Actually, I think I noticed a couple of things that might be wrong. First is that I think (not sure yet) Party Member[0] should be Party Member [1] and they should all move up so it's 1, 2, and 3. The other thing is that when you're changing ownership, you're making it
"Set Variable Main Character == Party Member[2]"
when it should probably be the other way around
Still in the process of recreating this.
Edit 2:
Okay, I recreated this with the changes I've mentioned and I can switch from Party Member [1] to Party Member [2] but I can't switch from Party Member [2] to Party Member [3]. I double checked to make sure that all 3 units are being stored properly. I think I have an idea for how to make this work differently.
Edit 3:
Problem solved. replace the "Main Character == Party Member [X]" Condition with "Owner of Party Member [X] == 1"
I'm also going to see if I can smash all three changes into a single if then trigger, but that might be uglier than having a trigger for each swap.
Edit 4:
... I had everything working and then I removed my verifiers and now for some reason they won't swap any longer.
Edit 5:
Double solved. When I initially created the switch triggers, I gave each swap it's own key, because I'm OCD like that. When I had it working, I started to convert it to a format you would like. Unfortunately, it won't run if you set all 3 triggers to they same key press, which is why it stopped working when I moved them all to tab.
I created that single trigger, which is an if/then chain and set the key press to tab. It works beautifully and swaps through all 3 units. I also through in a little bonus there by clearing the selection and selecting the new unit. You should just be able to copy the trigger from the map I uploaded.
As a learning process I'm going to make this into a trigger library.
Thank you so much for the help! The editor sure can be a bit temperamental at times, can't it? =)
I was able to successfully implement your system into my map, and, after toying around with it for a bit, was able to apply your cleaner if/then model to several of my other triggers! This will definitely save me a ton of time and effort.
I've got a trigger that isn't working the way I would like it to. My goal is to have 3 units, one owned by player 1, the other two owned by player 2 (a computer). When player one presses the tab key, it cycles to another unit, so player 1 now controls one of the units previously controlled by player 2, and player 2 gets control of the unit previously owned by player 1. Here is how I set up the triggers:
If I initialize Party Member[0] as the Main Character, pressing tab will do absolutely nothing. If I initialize either Party Member[1] or Party Member[2] as the Main Character, with player 1 having control over them right off the bat instead of Party Member [0], pressing tab will always switch control to Party Member [0] and further presses will do nothing. I can't see any problems with my triggers, but it is late, so another pair of eyes would definitely help.
What I have tried so far: Using the "z" button instead of Tab. Creating a trigger to confirm that the Main Character and Party Member[#] variables are being properly assigned. Using an "(Owner of Party Member[#]) == 1" condition instead of the "Party Member[#] == Main Character" condition
None of these changes had an effect on the result.
Thanks in advance for the help!
Give me a moment to try recreating this. Logically everything seems in line to me just glancing over everything.
Edit 1:
Actually, I think I noticed a couple of things that might be wrong. First is that I think (not sure yet) Party Member[0] should be Party Member [1] and they should all move up so it's 1, 2, and 3. The other thing is that when you're changing ownership, you're making it
"Set Variable Main Character == Party Member[2]"
when it should probably be the other way around
Still in the process of recreating this.
Edit 2:
Okay, I recreated this with the changes I've mentioned and I can switch from Party Member [1] to Party Member [2] but I can't switch from Party Member [2] to Party Member [3]. I double checked to make sure that all 3 units are being stored properly. I think I have an idea for how to make this work differently.
Edit 3:
Problem solved. replace the "Main Character == Party Member [X]" Condition with "Owner of Party Member [X] == 1"
I'm also going to see if I can smash all three changes into a single if then trigger, but that might be uglier than having a trigger for each swap.
Edit 4:
... I had everything working and then I removed my verifiers and now for some reason they won't swap any longer.
Edit 5:
Double solved. When I initially created the switch triggers, I gave each swap it's own key, because I'm OCD like that. When I had it working, I started to convert it to a format you would like. Unfortunately, it won't run if you set all 3 triggers to they same key press, which is why it stopped working when I moved them all to tab.
I created that single trigger, which is an if/then chain and set the key press to tab. It works beautifully and swaps through all 3 units. I also through in a little bonus there by clearing the selection and selecting the new unit. You should just be able to copy the trigger from the map I uploaded.
As a learning process I'm going to make this into a trigger library.
Thank you so much for the help! The editor sure can be a bit temperamental at times, can't it? =)
I was able to successfully implement your system into my map, and, after toying around with it for a bit, was able to apply your cleaner if/then model to several of my other triggers! This will definitely save me a ton of time and effort.
Thanks once again!
You're welcome. I had fun playing with it since it was actually my first time handling an array after learning about them.
Yes, it can be a bit rough and sometimes inconsistent.