Compare a String to an Array?

Yes yes would be possible.

Came with the last Workshop Update if I remember correctly.

Local Player will make the Spectator see their own Variable as well though.
(Since they are specs they don’t have the Variable and it will always be 0)
So you might want to double check on what you would want to see as a spectator if you even can spectate.

Hmm, well as long as it works for the individual player in game, then good enough. I’ve never bothered setting up anything for people to Spectate and watch while the games in progress. Good to know…thx for the Tip

20 characters required

Just an Update****

TLDR;
So after some more testing, Im 100% it’s NOT the 128 Text Limit issue…It’s the String condition causing it…but idk y… As it happens randomly in the middle of a 15+ Min game… Soooo many Workshop Inspector elements to look through to guess when/where/why it bugged… Honestly, i can easily remove it, as its only purpose is to lower Server Load IF BOTS are active in the game. This way the “bots/AI” Can’t trigger any Rules. But once enough ppl join a game, the Bots/AI are removed anyways…

variables
{
player:
9: DmgCheck
25: Pts
}

rule(“Add Damage Points”)
{
event
{
Player Dealt Damage;
All;
All;
}

conditions
{
String Contains(Custom String(“Ana; McCree; Roadhog; Zarya; Zenyatta;”), Custom String("{0}", Hero Of(Event Player))) != True;
}

actions
{
Event Player.Pts[0] += Event Damage;
Victim.DmgCheck = True;
}
}

conditions
String Contains(Custom String(“Ana; McCree; Roadhog; Zarya; Zenyatta;”), Custom String("{0}", Hero Of(Event Player))) != True

^^^This part^^^
It works flawlessly, for a while…then this condition for whatever reason triggers as TRUE. Thus, everyone fails the condition. So no one can earn points from dealing damage.
Randomly throughout the game, you’ll notice your NOT gaining any points from dealing damage…
About the only clue i can give to maybe y: it happens after a Round as been complete. (In a control game mode) & all players return to Spawn.

I’d guess the player’s hero is “unspecified” which when casted to string is “” or " ".

To prevent these kinds of problems, do not cast to string:

Array Contains(Array(Hero(Ana), Hero(Mccree), ...), hero of(event player))

I am also confused as to why you want it to only prevent the Action from running when the Bots would execute them.

Do you have more than those Ana, Cree Hog, Zarya, and Zen Bots that could and should trigger the Rule ?

if other Bots can’t trigger the rule either if there are other Bots in the first place,
why don’t use

conditions
{
Is Dummy Bot(Event Player) == False;
}

Zezombye; I don’t want to Black List specific hero’s, only bots. So no, IF i say Hero Of &/Or compare to an array OF heros, then im effectively eliminating the use OF those heros…Not my intention.

Teawy; the reason i want to prevent Bots from executing Rules is…well server load. If these Workshop games were more robust, this wouldn’t be needed. It seemed to me, my games have crash far less ever since I implemented this “Bot” Condition.
Anyways, (maybe it has changed since i last tried it) adding AI via the Lobby menu is NOT the same as adding a Dummy Bot. So using the condition “is Dummy Bot(event Player)” does nothing.
& Yes, there are 11 AI you can Add, so i want to “black list” those 11 select-able AI/Bots. Originally, i had all 11 listed in the String. But i shortened it down to those 5 to see if that made a difference w/ it 'buggy.ing out"…it didn’t…

If added via the Lobby Menu or not they are Bots and all Bots whether they use the built in AI by blizzard or not they trigger the
Is Dummy Bot(Event Player) Condition.

Never mind the Test I set up confused me.


Hmm.

How many Rules do you have running then,
and @ which position is the Rule that fails with the String Condition ?


Actually had a different idea;
do you have a Rule that triggers when the “Event Player Has Spawned” or a “Player Joined Match”
You could add the Custom String Check there and Set a Player Variable True if it passes

actions
{
If(String Contains(Custom String(“Ana; McCree; Roadhog; Zarya; Zenyatta;”), Custom String("{0};", Event Player)));
Event Player.AD = True;
End;
}

But you are using “hero of” in your original code :thinking: in that case you should replace it by just event player.

I actually thought about trying this late last night.

& it Does work (In my test server that is, But real test will be if i can get through an actual game w/out it bugging out)

Also, something i didn’t even think about…Zezombye kinda pointed it out too.
You originally sent me THIS to try:

String Contains(Custom String(“Ana; McCree; Roadhog; Zarya; Zenyatta;”), Custom String("{0}", Hero Of(Event Player))) != True

& now you sent me this:

String Contains(Custom String(“Ana; McCree; Roadhog; Zarya; Zenyatta;”), Custom String("{0};", Event Player)))

This difference is; Hero Of(Event Player) vs. Event Player

You think, that by calling it out as Hero Of, can somehow change ‘value’? in between rounds?

Idk. Either way, imma give setting a "check variable " when a player Joins a game based on IF they satisfy the String Condition.

Appreciate the help. Both of u.

because we were there still talking about the possibility of Name Checking Heroes with String Contains and I didnt know at the time you did that because of the AI names~

But it shouldn’t cause a difference except for when you find a player with the name of a Hero.
(Aaaand that it might not trigger for Players then because they play that Hero)

but you might want to move the Rule higher as well.

Rules that reevaluate their Conditions often shouldn’t be buried below Rules that just execute once per player or game.

You think, that by calling it out as Hero Of, can somehow change ‘value’? in between rounds?

Yes because between rounds, i’m pretty sure players are unspawned for a bit and their hero is null, though idk if that’s the case for AI bots. And by using “hero of” your gamemode won’t work on other languages than english, but that may also be the case for AI bot names?

A better way is to not rely on the names (they can have false positives, there are plenty of players named “genji” or “mercy”) but tests that AI bots pass but players don’t:

  • Not being able to change heroes
  • Not being able to communicate
  • Not being able to start facing or start forcing throttle

Actually they do ‘heavily’ make use of the “Hello” communication while the game is preparing.
\\ At least on Control maps

“Just an Update”
So setting a ‘Check Variable’ when a player joins worked perfectly. Had no problems w/ several games i played/hosted yesterday. The AI weren’t able to trigger any Rules & no players (at least no one complained) had any issues with missing HUDs or Scripts not functioning properly. Thx for all your help!

Zezombye; Yes, excluding “players” by their names IS a problem…every once in a while someone will join the game with a hero name. And yes…those people are SOL. But, those people are far and few between.

Not sure how I’d test if i an AI/Bot can’t change heros or force throttle. But the AI does communicate…alot actually lol.

The AI communicates by itself, but can you do “start communicating” on an AI bot and make it work?

Didn’t know the answer so I tested.

They can’t be forced to communicate via Workshop,
they can only communicate through their pre programmed stuff.

So you could make a check if it’s a player via

Communicate(Event Player, Hello);
Wait(0.500, Ignore Condition);
Event Player.IsBot = Is Communicating(Event Player, Hello) ? True : False;

but you’d also need to make sure that the Voice Line still triggers the Condition if you’re facing a player / the Bot doesn’t randomly communicate the Voice Line at that very moment.


For the protocol, some “Is Communicating(Event Player, X)” conditions fail to evaluate as True when the Player is using it while looking at any player allied or hostile.