Does anyone know how to do this? It seemed like there used to be something along the lines of IsHuman, but I stopped working with the editor for a long while and appear to have forgotten.
Any help would be greatly appreciated.
Thanks!
Checking to see if human or AI
The Grumpy Old Wizard does it in his maps. Specifically I remember seeing it in his Seize The Throne map script and I'm pretty sure he did it in Shadow Dreams as well. Take a look at his scripts if he doesn't answer this post.
rdeford, Mage Of Soquim
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
On the first day, before your next day script, you need something like this.
I recommend that you have a look at the scripts the scripts of other map makers. You can learn a lot from looking at what other mapmakers have done.
My HOMM5 maps
rdeford's HOMM5 maps
GOW
whoishuman and humanherolist are variables. humanheroelist is an array.whoishuman = GetCurrentPlayer(); --determine human player, always goes first
humanheroelist = GetPlayerHeroes(whoishuman); --get human's heroe choice
humanmainheroe = humanheroelist[0]; --human heroe choice assigned as main heroe
I recommend that you have a look at the scripts the scripts of other map makers. You can learn a lot from looking at what other mapmakers have done.
My HOMM5 maps
rdeford's HOMM5 maps
GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
thanks for the response. I will look at some scripts, I think I played seize the throne so should still have it.
However, in the example, that script would only work for a single player map. My map is multiplayer (up to 3 humans), so while the current player may indeed always be human, the others would not necessarily be AI.
However, in the example, that script would only work for a single player map. My map is multiplayer (up to 3 humans), so while the current player may indeed always be human, the others would not necessarily be AI.
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
In that case you would want to check each of the player positions on day 1 before your new day script. You'll need to use the below function.JagoBC wrote:thanks for the response. I will look at some scripts, I think I played seize the throne so should still have it.
However, in the example, that script would only work for a single player map. My map is multiplayer (up to 3 humans), so while the current player may indeed always be human, the others would not necessarily be AI.
IsHuman is described as being a combat script so I'm not sure if it works outside of a combat script but you can give it a try.
Assuming the positions that are playable by human players are players 1-3 you might try something like:IsHuman
IsHuman – determine whether there is a human playing for the certain party
Syntax
IsHuman(side);
Description
This function returns not nil if the specified party that takes part in combat belongs to a human
(regardless of whether this human controls the party’s actions, or they are under auctomatic
control), and nil if not.
Now bear in mind I dindn't test this script out to make sure I didn't make an error.------------------------
--declare variables--
------------------------
player1human = 0;
player2human = 0;
player3human = 0;
---------------------------------------------
--determine which players are human--
---------------------------------------------
if IsHuman (PLAYER_1) then
player1human = 1;
end;
if IsHuman (PLAYER_2) then
player2human = 1;
end;
if IsHuman (PLAYER_3) then
player3human = 1;
end;
GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
Now, if the above doesn't work (since IsHeroe may only be a combat function) then check the gold resouce for each player and compare it to the gold that a human player would have at that difficulty level.
From the fan manual:
From the fan manual:
Now for the first part of the script, assuming 7 possible human positions:easy 50000 gold
normal 30000 gold
hard 20000 gold
heroic 10000 gold
You might try something like this for the resource checking script (assuming 7 possible playable positions.) Assuming the above script was used to determine difficulty level:
player1human = 0;
player2human = 0;
player3human =0;
player4human = 0;
player5human = 0;
player6human = 0;
player7human = 0;
----------------------------------------------------------------------------------------------------------------
--determine difficulty level and starting gold for human: easy(1), normal(2), hard(3) or heroic(4) --
-----------------------------------------------------------------------------------------------------------------
difficultylevel = 1;
humangold = 50000;
if GetDifficulty() == DIFFICULTY_HEROIC then
difficultylevel = 4;
humangold = 10000;
end;
if GetDifficulty() == DIFFICULTY_HARD then
difficultylevel = 3;
humangold = 20000;
end;
if GetDifficulty() == DIFFICULTY_NORMAL then
difficultylevel = 2;
humangold = 30000
end;
GOW-----------------------------------------------------------------------------------
--compare gold to what human gold should be to detect human players--
-----------------------------------------------------------------------------------
if GetPlayerResource(PLAYER_1 , 6) == humangold then --6 is gold
player1human = 1; --player is human
end;
if GetPlayerResource(PLAYER_2 , 6) == humangold then
player2human = 1; --player is human
end;
if GetPlayerResource(PLAYER_3 , 6) == humangold then
player3human = 1; --player is human
end;
if GetPlayerResource(PLAYER_4 , 6) == humangold then
player4human = 1; --player is human
end;
if GetPlayerResource(PLAYER_5 , 6) == humangold then
player5human = 1; --player is human
end;
if GetPlayerResource(PLAYER_6 , 6) == humangold then
player6human = 1; --player is human
end;
if GetPlayerResource(PLAYER_7 , 6) == humangold then
player7human = 1; --player is human
end;
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Thanks, I did end up using a variation of your script (you did not take into account that players could choose extra gold as a start bonus, but I simply set the test parameters to a range for each difficulty and it seemed to solve the problem)... Except
On hard difficulty the computer appears to start off with 20,000 gold as well... So on hard, the script always returns that all players are human
On hard difficulty the computer appears to start off with 20,000 gold as well... So on hard, the script always returns that all players are human
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
Ah, yes, hard difficulty is the setting where the computer and human are even in resources. Well, playtesting shows things that you forget to consider and errors in your logic.
However, if you designated only 3 positions playable on your map as you said, and have more than three positions total on the map you can see if the sum total of playable postions showing as human is 3 or greater. If it is then you know that each possible human position is filled.
If you don't have more than 3 positions on the map you can make a 4th position that is computer only and stick it in a small walled in area that the player can't get to and that computer can't leave. Or you could make that 4th computer only position a town that can be conquered to fulfil a quest.
Did you try the IsHuman function?
GOW
However, if you designated only 3 positions playable on your map as you said, and have more than three positions total on the map you can see if the sum total of playable postions showing as human is 3 or greater. If it is then you know that each possible human position is filled.
If you don't have more than 3 positions on the map you can make a 4th position that is computer only and stick it in a small walled in area that the player can't get to and that computer can't leave. Or you could make that 4th computer only position a town that can be conquered to fulfil a quest.
Did you try the IsHuman function?
GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
see http://heroescommunity.com/viewthread.php3?TID=25687
there are 2 methods there... my method is fine if you have an introduction messagebox while the other works for any situation.
there are 2 methods there... my method is fine if you have an introduction messagebox while the other works for any situation.
Who is online
Users browsing this forum: No registered users and 1 guest