[H5 EDITOR] Troubleshooting topic
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
Well, I figured out how to make all positions playabe without converting my map to a multiplayer map. Now for the next problem.
My map is a 6 position single player map. The human can play any of those 6 positions and the computer plays the rest. It is not a multiplayer map, 2 players can't play at the same time.
Lol I have't named my map yet so it is still "A Test Map."
I am trying to do something which should be simple.
I am trying to display a message the first time a human player enters a region. I can't find a conditional for determining if a player is human or computer though.
GetCurrentPlayer returns:
PLAYER_NONE = 0
PLAYER_1 = 1
PLAYER_2 = 2
PLAYER_3 = 3
PLAYER_4 = 4
PLAYER_5 = 5
PLAYER_6 = 6
PLAYER_7 = 7
PLAYER_8 = 8
The region part should be simple, but how to see if the heroe entering the region is human or not escapes me. I named the region TownHint1.
function TownHint1( heroname )
If ???????? then
-- do this for the human player only
MessageBox("Maps/SingleMissions/A Test Map/TownHint.txt");
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "townhint1", nil );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "townhint1", "TownHint1" );
GOW
My map is a 6 position single player map. The human can play any of those 6 positions and the computer plays the rest. It is not a multiplayer map, 2 players can't play at the same time.
Lol I have't named my map yet so it is still "A Test Map."
I am trying to do something which should be simple.
I am trying to display a message the first time a human player enters a region. I can't find a conditional for determining if a player is human or computer though.
GetCurrentPlayer returns:
PLAYER_NONE = 0
PLAYER_1 = 1
PLAYER_2 = 2
PLAYER_3 = 3
PLAYER_4 = 4
PLAYER_5 = 5
PLAYER_6 = 6
PLAYER_7 = 7
PLAYER_8 = 8
The region part should be simple, but how to see if the heroe entering the region is human or not escapes me. I named the region TownHint1.
function TownHint1( heroname )
If ???????? then
-- do this for the human player only
MessageBox("Maps/SingleMissions/A Test Map/TownHint.txt");
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "townhint1", nil );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "townhint1", "TownHint1" );
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."
I searched too, and I didn't find anything. It seems not to by any divide between human and computer players made by Nival. I think the only solution here is to make only one player id playable by human, or to allow not only human player to run this region script.Grumpy Old Wizard wrote:I am trying to display a message the first time a human player enters a region. I can't find a conditional for determining if a player is human or computer though.
.
GOW, i do not know whether the combat field IsHuman etc. commands that were suggested on ubi board work for you but one way to do it would be:
The human player is the first to move no matter of flag/player ID. Thus you should be able to define human by adding a simple line to the begin of the script file (not under a function or anything)
The first time the script file is read (day1 of human player turn) variable omosapience gets a value which should remain constant for the rest of game, unless you specifically build a script to change it.
Now, whenever you want to confirm that an even is triggered by human palyer you use:
The human player is the first to move no matter of flag/player ID. Thus you should be able to define human by adding a simple line to the begin of the script file (not under a function or anything)
Code: Select all
omosapience = GetCurrentPlayer();
Now, whenever you want to confirm that an even is triggered by human palyer you use:
Code: Select all
function blah
if GetCurrentPlayer() == omosapience then
bla blah
end
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
I haven't tried the combat script suggestion yet but your solution seems like it should work. I'll give it a try and report back later.Pitsu wrote:GOW, i do not know whether the combat field IsHuman etc. commands that were suggested on ubi board work for you but one way to do it would be:
The human player is the first to move no matter of flag/player ID. Thus you should be able to define human by adding a simple line to the begin of the script file (not under a function or anything)The first time the script file is read (day1 of human player turn) variable omosapience gets a value which should remain constant for the rest of game, unless you specifically build a script to change it.Code: Select all
omosapience = GetCurrentPlayer();
Now, whenever you want to confirm that an even is triggered by human palyer you use:
Code: Select all
function blah if GetCurrentPlayer() == omosapience then bla blah 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
I haven't been able to get it to work with my region scrip thus far, but my HOMM5 scripting sucks so probably something is wrong with it.
I have a region named TownHint1, and the text I want displayed is HavenHint.txt
Here is what I have tried:
Other than the scripting I can finish the map tonight or tomorrow and start playtesting. Maybe this first map will just not have much in the way of scripting.
Well, I'm off to an appointment now.
GOW
I have a region named TownHint1, and the text I want displayed is HavenHint.txt
Here is what I have tried:
This new scripting is killing me.whoishuman = GetCurrentPlayer(); --determine human player, always goes first
--display region hint for human player
function GiveHint()
if GetCurrentPlayer() == whoishuman then
MessageBox("Maps/SingleMissions/A Test Map/HavenHint1.txt");
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", nil );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", "GiveHint");
Other than the scripting I can finish the map tonight or tomorrow and start playtesting. Maybe this first map will just not have much in the way of scripting.
Well, I'm off to an appointment now.
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."
Does your script trigger at wrong time (AI player turn) or not at all?
The script that did work for me:
The script that did work for me:
Code: Select all
player = GetCurrentPlayer();
function messagie()
if GetCurrentPlayer() == player then
OpenCircleFog(25, 25, GROUND, 25, PLAYER_1);
OpenCircleFog(25, 25, GROUND, 25, PLAYER_2);
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "area","messagie", nil );
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
My script did not display any message at all. The heroe did stop when he encountered the region though so something was going on. I'm going to bang my head on it some more.Pitsu wrote:Does your script trigger at wrong time (AI player turn) or not at all?
The script that did work for me:Code: Select all
player = GetCurrentPlayer(); function messagie() if GetCurrentPlayer() == player then OpenCircleFog(25, 25, GROUND, 25, PLAYER_1); OpenCircleFog(25, 25, GROUND, 25, PLAYER_2); end; end; Trigger( REGION_ENTER_AND_STOP_TRIGGER, "area","messagie", nil );
Edit: Actually the script was good. I had changed the name of the text file in the script but forgot to change the name of the file itself.
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 for another problematic script. Well all scripts seem to be problematic for me at this point. ![sad :(](/forums/images/smilies/sad.gif)
I'm trying to buff a neutral Haven town the first day of every week that it remains neutral. The name of the town is Vigil. I also tried assigning a name in the object properties and that did not help.
All troop types I am trying to add are already present in the town garrison.
I am trying to run this script from the town.
Well, I was missing a then in the above script but that did not solve the problem. I also tried running the script from the map properties script instead of the town script but that did not work either.
![sad :(](/forums/images/smilies/sad.gif)
I'm trying to buff a neutral Haven town the first day of every week that it remains neutral. The name of the town is Vigil. I also tried assigning a name in the object properties and that did not help.
All troop types I am trying to add are already present in the town garrison.
I am trying to run this script from the town.
What am I doing wrong?-- do this first day of every week if town is neutral
function BuffHaven()
if GetObjectOwner == PLAYER_NONE
if GetDate(DAY_OF_WEEK) == 1 then
AddObjectCreatures(Vigil, 1, 11); --peasant
AddObjectCreatures(Vigil, 3, 6); --archer
AddObjectCreatures(Vigil, 5, 5); --footman
AddObjectCreatures(Vigil, 7, 2); --griffon
AddObjectCreatures(Vigil, 9, 2); --priest
AddObjectCreatures(Vigil, 11, 1); --cavalier
end;
end;
end;
Trigger(NEW_DAY_TRIGGER, "BuffHaven");
Well, I was missing a then in the above script but that did not solve the problem. I also tried running the script from the map properties script instead of the town script but that did not work either.
GOW-- do this first day of every week if town is neutral
function BuffHaven()
if GetObjectOwner == PLAYER_NONE then
if GetDate(DAY_OF_WEEK) == 1 then
AddObjectCreatures(SecondHaven, 1, 11); --peasant
AddObjectCreatures(SecondHaven, 3, 6); --archer
AddObjectCreatures(SecondHaven, 5, 5); --footman
AddObjectCreatures(SecondHaven, 7, 2); --griffon
AddObjectCreatures(SecondHaven, 9, 2); --priest
AddObjectCreatures(SecondHaven, 11, 1); --priest
end;
end;
end;
Trigger(NEW_DAY_TRIGGER, "BuffHaven");
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
Yeah! You guys rule. ![smile :)](/forums/images/smilies/smile9.gif)
I used the town name I assigned in properties ("SecondHaven") instead of the name assigned in the town itself ("Vigil".) I also altered the code a little since it is in the map properties script instead of the town script since there will probably be more stuff for me to do on the first day of every week.
Here is the working script:
![smile :)](/forums/images/smilies/smile9.gif)
I used the town name I assigned in properties ("SecondHaven") instead of the name assigned in the town itself ("Vigil".) I also altered the code a little since it is in the map properties script instead of the town script since there will probably be more stuff for me to do on the first day of every week.
Here is the working script:
GOW-- do this first day of every week.
function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
if GetObjectOwner("SecondHaven") == PLAYER_NONE then --neutral
AddObjectCreatures("SecondHaven", 1, 11); --peasant
AddObjectCreatures("SecondHaven", 3, 6); --archer
AddObjectCreatures("SecondHaven", 5, 5); --footman
AddObjectCreatures("SecondHaven", 7, 2); --griffon
AddObjectCreatures("SecondHaven", 9, 2); --priest
AddObjectCreatures("SecondHaven", 11, 1); --cavalier
end;
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
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."
- Psychobabble
- Spectre
- Posts: 706
- Joined: 06 Jan 2006
- Location: Melbourne, Australia
- Contact:
Two questions:
a) Is this all as complicated as it looks to a non-programmer like myself? Or is it possible for someone like me to pick the editor up and do basic scripts like making a text box or giving the player some resources?
b) If you want to do anything even moderately fancy with the editor, do you have to include a separate .pak file or can it all be done from inside the editor?
a) Is this all as complicated as it looks to a non-programmer like myself? Or is it possible for someone like me to pick the editor up and do basic scripts like making a text box or giving the player some resources?
b) If you want to do anything even moderately fancy with the editor, do you have to include a separate .pak file or can it all be done from inside the editor?
I would say it is not the easiest. The scripting language is powerful and flexible, but if a script does not work, there is little help for fixing it.Psychobabble wrote: a) Is this all as complicated as it looks to a non-programmer like myself? Or is it possible for someone like me to pick the editor up and do basic scripts like making a text box or giving the player some resources?
Edit: in other words: the scripting language is OK, but there is no control of what you write into the script file and how to debug if something does not work.
I do not know how do define "moderately fancy". H5 editor is easily capable of things that were a far dream in H3/H4 editors but fails at some "elementary" stuff. Anyway, the map h5m files are archives and can have any kind of files in them, including ballast junk that is not necessary for the map. Thus as long as we are not into modding entire game (all maps) an additional .pak file sounds unneccessary.b) If you want to do anything even moderately fancy with the editor, do you have to include a separate .pak file or can it all be done from inside the editor?
Last edited by Pitsu on 27 Sep 2006, 09:49, edited 1 time in total.
More complicated scripts needs only basics of programming (few hours of learning) to understand them and creatre your own. Simple scripts, like message box are written somewhere in this topic, so they need only copy/paste.Psychobabble wrote:a) Is this all as complicated as it looks to a non-programmer like myself? Or is it possible for someone like me to pick the editor up and do basic scripts like making a text box or giving the player some resources?
Everything which is not mod, can be done in the editor. You don't need any .pak filePsychobabble wrote:b) If you want to do anything even moderately fancy with the editor, do you have to include a separate .pak file or can it all be done from inside the editor?
![smile :)](/forums/images/smilies/smile9.gif)
.
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
It has been a number of years since I have been involved in programming. I have been asking a lot of questions and Pitsu and alavris have been very helpful in getting my scripts to work and telling me how to do stuff.Psychobabble wrote:Two questions:
a) Is this all as complicated as it looks to a non-programmer like myself? Or is it possible for someone like me to pick the editor up and do basic scripts like making a text box or giving the player some resources?
b) If you want to do anything even moderately fancy with the editor, do you have to include a separate .pak file or can it all be done from inside the editor?
You will find examples of a lot of things already posted. By examining and modifying those scripts you can probably do the majority of what you would want to do
I say take the plunge and learn with the rest of us.
![smile :)](/forums/images/smilies/smile9.gif)
Edit: Oh, you will find the terraforming abilities of the editor to be simply amazing.
![big smile :-D](/forums/images/smilies/big%20smile.gif)
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."
- Psychobabble
- Spectre
- Posts: 706
- Joined: 06 Jan 2006
- Location: Melbourne, Australia
- Contact:
Has anyone succeeded in getting their own PWL image to work for their map? I seem to have the procedure right (according to the tutorial), but whenever I go to provide the SrcName (i.e., the .tga file) for the texture, it just simply refuses to put the text of the filename in or load the file. I always just get a pure grey PWL background when I start the map ingame...
I have the same situation. Maybe it's editor's bug or they just have not told everything in that official manual.Evenshade wrote:Has anyone succeeded in getting their own PWL image to work for their map? I seem to have the procedure right (according to the tutorial), but whenever I go to provide the SrcName (i.e., the .tga file) for the texture, it just simply refuses to put the text of the filename in or load the file. I always just get a pure grey PWL background when I start the map ingame...
.
Looks like the editor does not want to convert the tga and create proper references. By manually creating a dds file and proper reference files and adding them into h5m archive it can be done.Evenshade wrote:Has anyone succeeded in getting their own PWL image to work for their map? I seem to have the procedure right (according to the tutorial), but whenever I go to provide the SrcName (i.e., the .tga file) for the texture, it just simply refuses to put the text of the filename in or load the file. I always just get a pure grey PWL background when I start the map ingame...
1. Create tga and dds files of the image and place them into unpacked map directory where you have all other map files.
2. Create text file named for example PWL.(Texture).xdb with the following text (the parameters can later be edited in editor if i am not mistaken): Note the references to image files ("filename.tga or dds"). EDIT: in fact this is the file you can create in editor already. The editor simply refuses to put the image file references into it and leaves the "href=" blank.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Texture>
<SrcName href="/filename.tga"/>
<DestName href="/filename.dds"/>
<Type>REGULAR</Type>
<ConversionType>CONVERT_TRANSPARENT</ConversionType>
<AddrType>CLAMP</AddrType>
<Format>TF_DXT1</Format>
<Width>1024</Width>
<Height>1024</Height>
<MappingSize>0</MappingSize>
<NMips>1</NMips>
<Gain>0</Gain>
<AverageColor>0</AverageColor>
<InstantLoad>true</InstantLoad>
<IsDXT>false</IsDXT>
<FlipY>false</FlipY>
<StandardExport>true</StandardExport>
<UseS3TC>false</UseS3TC>
</Texture>
If it does not work like that, then i have forgotten to mention something.
![dontknow ;|](/forums/images/smilies/dontknow.gif)
Who is online
Users browsing this forum: No registered users and 0 guests