[H5 EDITOR] Troubleshooting topic

Maps and the art of mapmaking.
User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 30 Sep 2006, 23:44

Is there a way to make regions permanently active rather than one shot affairs?
For example I have this function for a region:
function GiveHintHaven(heroename)
if GetCurrentPlayer() == whoishuman then
MessageBox("Maps/SingleMissions/Seize The Throne/HavenHint1.txt");
LevelUpHero (heroename); --debug routine
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", nil );
end;

end;
And trigger it with this:
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", "GiveHintHaven");--second haven town location hint
Is there any way of making it so the message is displayed every time the player enters the region?

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."

User avatar
Bandobras Took
Genie
Genie
Posts: 1018
Joined: 06 Jan 2006

Unread postby Bandobras Took » 01 Oct 2006, 03:46

Remove the line in the function that sets the trigger to "nil."
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", nil );
I believe that makes it so the trigger never happens again.
Far too many people speak their minds without first verifying the quality of their source material.

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 01 Oct 2006, 07:51

Bandobras Took wrote:Remove the line in the function that sets the trigger to "nil."
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", nil );
I believe that makes it so the trigger never happens again.
Thank you! That did the trick. :)

I have another question about triggers. I am trying to do an OBJECT_TOUCH_TRIGGER but there is no example to go by so I'm not sure I'm doing anything right.

I placed an archer tower on the map and being highly creative I named it "HavenArcher." I would like a message to display the first time the human heroe touches the tower. Here is what I have tried.
The whoishuman variable is the identity of the human player.

function ArcherTouched()
if GetCurrentPlayer () == whoishuman then
MessageBox("Maps/SingleMissions/Seize The Throne/debugmess1.txt");
end;
Trigger(OBJECT_TOUCH_TRIGGER, "HavenArcher", nil)
end;
Trigger (OBJECT_TOUCH_TRIGGER, "ArcherTouched", "HavenArcher");
Edit: Nothing happens other than me being allowed to hire archers when I touch the tower.

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."

User avatar
Pitsu
Round Table Hero
Round Table Hero
Posts: 1830
Joined: 22 Nov 2005

Unread postby Pitsu » 01 Oct 2006, 08:25

Trigger (OBJECT_TOUCH_TRIGGER, "ArcherTouched", "HavenArcher");
Maybe:
Grumpy Old Wizard wrote:
Trigger (OBJECT_TOUCH_TRIGGER, "HavenArcher","ArcherTouched");

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 01 Oct 2006, 09:37

Pitsu wrote:
Trigger (OBJECT_TOUCH_TRIGGER, "HavenArcher","ArcherTouched");
Thanks Pitsu! Problem solved. :)

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."

MER
Peasant
Peasant
Posts: 63
Joined: 23 Jul 2006

Unread postby MER » 02 Oct 2006, 08:19

hi,
does anyone know if there's a way to know which hero/town the player has selected. I see there's no trigger to let you know when the player changes his/her selection. I guess it's because all functions seem to be for both human and AI, I just wondered if there's a workaround. Thx :) .

Othmaar
Leprechaun
Leprechaun
Posts: 22
Joined: 27 Sep 2006
Location: Oslo, Norway

Unread postby Othmaar » 02 Oct 2006, 08:28

Two ways:

Make an array of all the hero specialty skills and match them to town type, or make an array of all the hero IngameNames and match them to town type.

I made an example of the last option here:
http://www.celestialheavens.com/forums/ ... php?t=4035
O.

User avatar
Marzhin
Pit Lord
Pit Lord
Posts: 1207
Joined: 06 Jan 2006
Location: Montreuil, France
Contact:

Unread postby Marzhin » 02 Oct 2006, 10:12

Ok, I have an annoying problem with Seer's Hut. When I try it ingame, only half of the "quest description" text is displayed. It's just like the text block is vertically cut in two. A bit like that :

What should be displayed :
To save the land from the invading
hordes of Chaos, you must defeat
the sorcerer called Horacio before
he performs his dreadful ritual.
What is displayed :
To save the land fr
hordes of Chaos
the sorcerer calle
he performs hi
Someone else had the same problem ?

And by the way, I noticed when you change the "shared" appearance of an object (for instance changing the Seer's Hut aspect), and you try to play another map which features a similar change of visual for the object, it takes the most recent of the two, even if it is in another map's package. (Once again I'm not sure it is very clear...) It may be because of the editor's cache or something, I'm not sure.

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 02 Oct 2006, 10:32

MER wrote:hi,
does anyone know if there's a way to know which hero/town the player has selected. I see there's no trigger to let you know when the player changes his/her selection. I guess it's because all functions seem to be for both human and AI, I just wondered if there's a workaround. Thx :) .
In a single player game here is what you need for determining who the human player is (in case the player can select various positions) and what heroe he selected:
--determine human player
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
Explanation:
whoishuman
Here we create a variable we named whoishuman. In this variable we store the position the human player chose to play.

humanheroelist
humanheroelist is another variable we created. This variable is an array that stores the names of all the player's heroes. On day 1 if you have not placed any heroes and just generate the heroe in town the player will have only one heroe. That hero name will be recorded in humanheroelist[0].

Please note that it is necessary to use brackets to designate array elements. Lua usually begins arrays at element 1. However, GetPlayerHeroes starts at 0 instead of 1. That is where the expression humanheroelist[0] comes from.

Also note that whatever starts with 2 dashes is a comment and is not executed by the game. Please make sure that you include comments with your scripts. It will help you remember what the code you wrote does months later when you forgot exactly what you did as well as helping keep the code organized and understandable for others who wish to learn from what you have done.

The above code is what I am using in my 6 player single player map in which all positions are playable by the human playler. It works and is pretty simple.

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."

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 02 Oct 2006, 10:42

Marzhin wrote:Ok, I have an annoying problem with Seer's Hut. When I try it ingame, only half of the "quest description" text is displayed. It's just like the text block is vertically cut in two. A bit like that :

What should be displayed :
To save the land from the invading
hordes of Chaos, you must defeat
the sorcerer called Horacio before
he performs his dreadful ritual.
What is displayed :
To save the land fr
hordes of Chaos
the sorcerer calle
he performs hi
Someone else had the same problem ?
Yes. Here is what you need to do. Type the message exactly how you want it displayed in the box. And note that each line can't have all that many characters in it (generally maybe 5 words or so.) For example type:

To save the land (hit enter)
from the invading (hit enter)
hordes of Chaos, (hit enter)
you must defeat (hit enter)
the sorcerer called (hit enter)
Horacio before he (hit enter)
performs his dreadful ritual.

I have not actually counted the number of characters you can display in each line in that small quest hut message box, so you'll have to experiment to see what works for you. Just remember to break up your text in lines in the message box.

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."

User avatar
Marzhin
Pit Lord
Pit Lord
Posts: 1207
Joined: 06 Jan 2006
Location: Montreuil, France
Contact:

Unread postby Marzhin » 02 Oct 2006, 14:00

An obvious solution but I didn't even think of it :D Thanks Grumpy Old Wizard ;)

User avatar
Logan Warbringer
Leprechaun
Leprechaun
Posts: 39
Joined: 13 Feb 2006
Location: Castle Logan, HeroesLands
Contact:

Unread postby Logan Warbringer » 02 Oct 2006, 17:25

After years of successful work with all the previous game editors from HMM1 to HMM4 this is the first time I am completely shocked and embarrassed by mapmaking:) I've never thought that in order to set a victory condition for a map or create a simple quest for seer hut I'll have to learn something, looking like Pascal or C++:( For a person, totally unfamiliar with programming, this seems to be nearly impossible.

Why did they make it SO difficult? I just cannot find a proper and logic explanation to it. I always liked crafting and making solid, beautiful-looking maps, but I hate programming and will probably never learn this thing:) All the previous editors were just fine, and in H3WoG scripts were much, much simplier so even I could produce a simple trigger.

Good friends, is there a way to make at least one or two simple victory conditions (capture a town, kill certain enemy hero) without this dreadful programming? Help!

I tried to open the Map Properties Tree but somehow I see only the beginnings of words and categories (like Prim and OBJ in objectives' field)... I press + and nothing happens. I try to enlarge the properties screen till it takes the whole editor screen, but I still cannot read the phrases.
http://www.heroesportal.net -- More than 2000 maps for Heroes of Might and Magic I, II, III, IV. Forums and chat in heroic style! Various tourneys and everything a real hero needs!

MER
Peasant
Peasant
Posts: 63
Joined: 23 Jul 2006

Unread postby MER » 02 Oct 2006, 18:34

@Othmaar and Grumpy Old Wizard:
Thx for the fast replies but I think I didn't explain my problem clearly (sry for my bad english). I want to know when a player selects a certain hero or town. For instance if he has 2 heroes and he's playing with Hero#1 and then he selects Hero#2 (from the bottom of the UI for ex.) I want to start a script. But there seems to have no trigger for changing your selection, neither a function to tell which is the active hero (the same with towns).
And I wondered if there was a workaround for that since it would help me a lot in my map. Currently I have 99999 regions all over the place and when a hero enters one of them he/she must be the active one :) .


@Logan Warbringer: they made it so much user-unfriendly maybe because it was initially intended to be used only by Nival developers, not by customers (as they said in the manual). And developers can't complain, they work with what they're given :devil:.

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 02 Oct 2006, 20:57

Logan Warbringer wrote: Good friends, is there a way to make at least one or two simple victory conditions (capture a town, kill certain enemy hero) without this dreadful programming? Help!

I tried to open the Map Properties Tree but somehow I see only the beginnings of words and categories (like Prim and OBJ in objectives' field)... I press + and nothing happens. I try to enlarge the properties screen till it takes the whole editor screen, but I still cannot read the phrases.
I'm trying to figure out victory/loss conditions myself. Unfortunately I think a little programing will be necessary for either of those conditions. I haven't figured out seting objectives, which is the key to those conditions, I think.

For expanding the map properties tree, here's what you do.
Image

Move your cursor up to the bar and to the line between the words property and value for instance. Your cursor will change. Now you can click and drag to expand or contract the field.

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."

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 02 Oct 2006, 21:07

MER wrote: I want to know when a player selects a certain hero or town. For instance if he has 2 heroes and he's playing with Hero#1 and then he selects Hero#2 (from the bottom of the UI for ex.) I want to start a script. But there seems to have no trigger for changing your selection, neither a function to tell which is the active hero (the same with towns).
And I wondered if there was a workaround for that since it would help me a lot in my map. Currently I have 99999 regions all over the place and when a hero enters one of them he/she must be the active one :) .
I'm not sure what you are asking. In order for a heroe to enter a region, he has to be the one the player is controling, and therefore the active one, unless you mean something else by active.

Are you asking how to determine what heroe has entered a region? If so, you can set up a function like this for the region in question.
function GiveHintHaven(heroename)
if GetCurrentPlayer() == whoishuman then
MessageBox("Maps/SingleMissions/Seize The Throne/HavenHint1.txt");
LevelUpHero (heroename); --debug routine
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "TownHint1", nil );
end;

end;
The variable heroname will store the name of the heroe and then use that to display a message and then level up the heroe who just entered, for example, like this script does.
Edit: The variable whoishuman was defined as the human player in a different place in my script so I hope that doesn't confuse you.

Edit2: If you are asking about how to determine which heroe entered a region, here is another example from the editor practical guide:
function Meeting( heroname )
if heroname == "Christian" then
SetPlayerResource( PLAYER_1, GOLD, 10000 );
AddHeroCreatures( heroname, CREATURE_ARCHANGEL, 1 );
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "meeting", nil );
end;
end;
I don't think there is any way to determine if a heroe just clicks on a heroe in town.

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."

User avatar
Pitsu
Round Table Hero
Round Table Hero
Posts: 1830
Joined: 22 Nov 2005

Unread postby Pitsu » 03 Oct 2006, 07:49

MER wrote:@Othmaar and Grumpy Old Wizard:
And I wondered if there was a workaround for that since it would help me a lot in my map. Currently I have 99999 regions all over the place and when a hero enters one of them he/she must be the active one :) .
Ineed, cannot imagine a way to determine which hero or town player has selected. It might be possible to do a thread, which keeps track of a hero stat (e.g. movement points) and determines changes in that stat. Did try last night, but could not get it work properly before falling asleep though...

MER
Peasant
Peasant
Posts: 63
Joined: 23 Jul 2006

Unread postby MER » 03 Oct 2006, 16:10

Pitsu wrote:
MER wrote:@Othmaar and Grumpy Old Wizard:
And I wondered if there was a workaround for that since it would help me a lot in my map. Currently I have 99999 regions all over the place and when a hero enters one of them he/she must be the active one :) .
Ineed, cannot imagine a way to determine which hero or town player has selected. It might be possible to do a thread, which keeps track of a hero stat (e.g. movement points) and determines changes in that stat. Did try last night, but could not get it work properly before falling asleep though...

I didn't think of a separate thread, thx Pitsu. I'll try it when I get home :-D .

User avatar
alavris
Scout
Scout
Posts: 164
Joined: 06 Jan 2006
Location: Poland
Contact:

Unread postby alavris » 04 Oct 2006, 18:49

I thought it may be helpful for someone, so I will post here my reply to question PM'ed me by Fiur about making thumbnail images:
I've just tried to make these thumbnail images. So now I know it's easy :) I just copied these files from "Heritage" map to my alavris.h5m file:

mM4_pic.dds
mM4_2_pic.dds
mM4_3_pic.dds
mM4_4_pic.dds
mM4_pic.xdb
mM4_2_pic.xdb
mM4_3_pic.xdb
mM4_4_pic.xdb

I think that thumbnail images work only when there are 4 DDS files, but I haven't tried other situation... The next step is to replace this line in map-tag.xdb:

Code: Select all

<thumbnailImages/>
with this text:

Code: Select all

<thumbnailImages>
		<Item href="/mM4_pic.xdb#xpointer(/Texture)"/>
		<Item href="/mM4_2_pic.xdb#xpointer(/Texture)"/>
		<Item href="/mM4_3_pic.xdb#xpointer(/Texture)"/>
		<Item href="/mM4_4_pic.xdb#xpointer(/Texture)"/>
	</thumbnailImages>
That's all :)
.

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Unread postby myythryyn » 04 Oct 2006, 19:45

Logan Warbringer wrote:Good friends, is there a way to make at least one or two simple victory conditions (capture a town, kill certain enemy hero) without this dreadful programming? Help!
these are actually very easy to set up, its explained from page 25 - 31 in the editor theory documentation. follow the instructions, anything else you dont understand, im sure we can help.
for capture town, the objective is called capture object, kill certain hero, is defeat hero.
you also have to be careful about your settings, for some reason the "show completed" value is set to true by default, which means auto completetion. it should be false.

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Unread postby myythryyn » 05 Oct 2006, 01:51

hello, im hoping someone can help me make this script and would appreciate help with the proper syntax. this is the first script ive tried to make, so its very rough...
im having lvl 7 units disabled in this town, called testtown. if the player enters a certain region, then lvl 7 units for that town will be enabled, so the player can build then
so, i set up the region, and called it testregion.

function Enabledwelling (playerID)
GetCurrentPlayer == playerID
if playerID == "PLAYER_3" then
SetTownBuildingLimitLevel( testtown, 13, 1) ***see below**
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "testregion", nil);
end;
end;
(do i need another end?)

Trigger (REGION_ENTER_AND_STOP_TRIGGER, "testregion", "Enabledwelling" );


** from above script**
explanation - SetTownBuildingLimitLevel( testtown, 13, 1)
the exact syntax is supposed to be
SetTownBuildingLimit (townname,building ID, lvl limit)
building ID is 13 for lvl 7 dwellings. there is a longer script name for the dwelling, but i think its 13 it wants.
as for lvl limit, 0 is disabled, 1 is enabled.

well, i hope you get the idea, i hope i was slightly close to what the proper syntax is...if not, i hope my attempts at scripting were at least humourous :)


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 5 guests