Why doesn't kbIsPlayerHuman() work for rm scripts?

Here you can post about your scenario's, mods, custom maps and YouTube channels!
User avatar
No Flag RevarloVlabius
Crossbow
Posts: 7
Joined: May 7, 2021

Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by RevarloVlabius »

I wrote a random map that needs to check if player is human. So I tried using kbPlayerIsHuman(). But it doesn't seem to work. Any alternatives?
User avatar
Czech Republic EAGLEMUT
ESOC Dev Team
Donator 05
Posts: 4513
Joined: Mar 31, 2015
ESO: EAGLEMUT
Clan: WPact

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by EAGLEMUT »

Generally you can only call functions starting with rm during random map script generation. Functions starting with kb are for triggers and/or AI scripts.
I don't see an equivalent to kbIsPlayerHuman() in RM context https://mythicfreak.github.io/aomcodere ... layer.html
User avatar
Malaysia Aizamk
Pro Player
ESOC WarChiefs Classic 2017
Posts: 1459
Joined: Feb 26, 2015
Location: ded

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

  • Quote

Post by Aizamk »

Unfortunately there is no equivalent RMS-level function. Assuming you really do need it to be RMS-level (i.e. the map gets spawned depending on human players) then your best alternative is to create a function that checks the player names using rmGetPlayerName to see if they are that of an AI (i.e. the full list of Queen Isabella etc). Be warned though that this would only work if the host's game is in English. There is no way to use special characters in RMS, so it's not possible to extend this to other languages.
oranges.
User avatar
Nauru Dolan
Ninja
Posts: 13064
Joined: Sep 17, 2015

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Dolan »

There were some triggers you could use to pop a dialog on the screen, afaik, with a bunch of choices.
You could maybe pop one of those on the screen, asking the player to click an option.
But the problem with this is that it's likely to go OOS, if players click at different times.
An AI wouldn't answer.

But I don't know how this would work on DE, if your map is for that version, considering that they rewrote the networking part and it's no longer a peer-to-peer connection. Maybe on DE it wouldn't OOS.
User avatar
Malaysia Aizamk
Pro Player
ESOC WarChiefs Classic 2017
Posts: 1459
Joined: Feb 26, 2015
Location: ded

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Aizamk »

Dolan wrote:There were some triggers you could use to pop a dialog on the screen, afaik, with a bunch of choices.
You could maybe pop one of those on the screen, asking the player to click an option.
But the problem with this is that it's likely to go OOS, if players click at different times.
An AI wouldn't answer.

But I don't know how this would work on DE, if your map is for that version, considering that they rewrote the networking part and it's no longer a peer-to-peer connection. Maybe on DE it wouldn't OOS.
This won't help at RMS level. If it's after the map has started then he can just use the original kbPlayerIsHuman() at trigger level.
oranges.
User avatar
Nauru Dolan
Ninja
Posts: 13064
Joined: Sep 17, 2015

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Dolan »

Another idea that could work would be: let the map include some kind of objective and let players know about it.
And if they go to an area on the map to collect a treasure you've let them know about, then this means they're not AI. They have self-directedness.
The drawback would be that this would take a while, so if you need to check if players are human immediately after the map is loaded, then maybe the name-checking method is what you're looking for.
User avatar
Malaysia Aizamk
Pro Player
ESOC WarChiefs Classic 2017
Posts: 1459
Joined: Feb 26, 2015
Location: ded

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Aizamk »

RMS level refers to the level at which the map dimensions are determined, hunt is spawned etc. This is the only stage at which rm-prefixed functions will work.

Trigger level refers to the level that starts "after" the map has spawned. "after" can include immediately, if you set the trigger to run immediately. rm functions will not work here, however it is possible to freely call on xs, kb, ui etc functions, and on DE, even ai functions.

Again, it goes back to what the OP's intention is. If it is to change map spawn and dimensions, then the name check is the only alternative. If it is nothing to do with map generation, then there is a lot more flexibility.
oranges.
User avatar
No Flag RevarloVlabius
Crossbow
Posts: 7
Joined: May 7, 2021

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by RevarloVlabius »

Well, What I am trying to do is create triggers only if the player is human.
User avatar
Nauru Dolan
Ninja
Posts: 13064
Joined: Sep 17, 2015

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Dolan »

@RevarloVlabius
kb- functions are functions used inside the game. KB stands for Knowledge Base. So they are functions used to gather data about the current state of the game.
If you're trying to run them before the map is generated, there's nothing to apply them on.
Maybe you should clarify whether you're trying to check if a player is human before the map is loaded or after. And if after, does this need to happen immediately or can it also happen somewhat later after the map was loaded.
User avatar
Nauru Dolan
Ninja
Posts: 13064
Joined: Sep 17, 2015

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by Dolan »

RevarloVlabius wrote:Well, What I am trying to do is create triggers only if the player is human.
You could also create the triggers but simply not run them if the player is not human.
Which means you don't have to check if a player is human during map generation. You can just only run the triggers when a player inside the game does a human action or meets a condition that only applies to humans.
User avatar
No Flag RevarloVlabius
Crossbow
Posts: 7
Joined: May 7, 2021

Re: Why doesn't kbIsPlayerHuman() work for rm scripts?

Post by RevarloVlabius »

Nevermind, Imma apply this method (You could also create the triggers but simply not run them if the player is not human.).

Who is online

Users browsing this forum: No registered users and 5 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