[H5 EDITOR] Troubleshooting topic

Maps and the art of mapmaking.
Cyanight
Leprechaun
Leprechaun
Posts: 28
Joined: 26 Dec 2006

Unread postby Cyanight » 29 Apr 2008, 16:45

How do you make an objective (trigger) to show up on day #1. I understand how to setup an objective but if they are set to be active already then they don't show the new objective box or the target glance location on day one.

- I tried having the active state being turned on when using a DAY trigger but it never works on day #1.
- The only way I have found is to create a region trigger that then activates the objective.

Does anyone know how I can activate the trigger on day one?

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 » 29 Apr 2008, 18:23

Cyanight wrote:How do you make an objective (trigger) to show up on day #1. I understand how to setup an objective but if they are set to be active already then they don't show the new objective box or the target glance location on day one.

- I tried having the active state being turned on when using a DAY trigger but it never works on day #1.
- The only way I have found is to create a region trigger that then activates the objective.

Does anyone know how I can activate the trigger on day one?
Here is another example from my Shadow Dreams map.

Set up the objectives you want to appear on day one outside of and before the beginning of the new day trigger. Here for example is how I set my the objectives I wanted to be active on Day 1 in Shadow Dreams.

To make an objective visible use SetObjectiveVisible.
------------------------------------------------
--Initial Objectives----------------------------
------------------------------------------------
SetObjectiveState ("Instant Travel Dream", OBJECTIVE_ACTIVE,whoishuman);
SetObjectiveVisible ("Instant Travel Dream", false, whoishuman);

SetObjectiveState ("Defeat the Red Slayer", OBJECTIVE_ACTIVE,whoishuman);
SetObjectiveVisible ("Defeat the Red Slayer", true, whoishuman);

if whoishuman == 1 then
SetObjectiveState ("Find Tower Grump", OBJECTIVE_ACTIVE,PLAYER_1);
SetObjectiveVisible ("Find Tower Grump", true, PLAYER_1);
SetObjectiveState ("Rescue Cyrus", OBJECTIVE_ACTIVE,PLAYER_1);
SetObjectiveVisible ("Rescue Cyrus", true, PLAYER_1);
end;

if whoishuman == 2 then
SetObjectiveState ("FaeryRingTrouble", OBJECTIVE_ACTIVE,PLAYER_2);
SetObjectiveVisible ("FaeryRingTrouble", true, PLAYER_2);
SetObjectiveState ("Rescue Alaron", OBJECTIVE_ACTIVE,PLAYER_2);
SetObjectiveVisible ("Rescue Alaron", true, PLAYER_2);
end;

if whoishuman == 4 then
SetObjectiveState ("Thieves Guild Trouble", OBJECTIVE_ACTIVE,PLAYER_4);
SetObjectiveVisible ("Thieves Guild Trouble", true, PLAYER_4);
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."

User avatar
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Day One Triggering

Unread postby rdeford » 30 Apr 2008, 14:31

I wish to add to what GOW has said: Any script code that you place outside of a function will be run on day one. In addition to activating objectives, you could for example, declare global variables, deactivate certain objects, display message boxes, etc. all of which will happen on day one prior to any actions the player can take.

User avatar
ransomdl
Leprechaun
Leprechaun
Posts: 34
Joined: 15 Oct 2006

Unread postby ransomdl » 30 Apr 2008, 15:06

rdeford,

The Scripting Guide references "startThread" comand to initiate a function as an alternative for a "Trigger" function. Can you write a Script function command anywhere in the Script and trigger the function with a "startThread" command?
ransomdl
Warlock

Cyanight
Leprechaun
Leprechaun
Posts: 28
Joined: 26 Dec 2006

Re: Day One Triggering

Unread postby Cyanight » 30 Apr 2008, 18:07

Thanks.. I never thought of that. I guess its my strict programming nature that I dont try things outside the box, hehe.

Last night I spent some more time designing and I cam across another problem. I cannot get the "points of light" to work on an object.. I tried to use the exact example in the "Mapmaking Theory" pdf but it would not show up. I was using the point of lights on a "Sage's hut" that was on the surface not undergoround. Anyone have an idea what Im doing wrong or why I could not see the light?

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 Apr 2008, 20:49

You will not see the new point of light in the editor unless you switch to the underground and then back to topside. If that doesn't work for you let me know and I'll go through the process step by step.

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

Cyanight
Leprechaun
Leprechaun
Posts: 28
Joined: 26 Dec 2006

Unread postby Cyanight » 01 May 2008, 12:30

Grumpy Old Wizard wrote:You will not see the new point of light in the editor unless you switch to the underground and then back to topside. If that doesn't work for you let me know and I'll go through the process step by step.

GOW
Not sure exactly what you mean.. I did try to view the light while playing the scenario not in the editor and still I cannot get the light to show up.

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 May 2008, 14:13

1) Click on the object you want to attatch a light source to in order to highlight the object.

2) Click on the Object Properties Tree button.

3) Right click on "pointlights."

4) Chose Add

5) Click on the plus sign next to "pointlights."

6) Click on the plus sign next to "[0]."

7) Click on the plus sign next to "Pos."

8) Across from "z" under the "Value" heading click and type 5 (that is the numbe I use, you can experiment with different values.)

9) Click on the plus sign in front of "Color." You can now either enter values in each of the x, y, and z fields to make a color or you can click across from "color" to select a color directly.

If you click across from color you also need to click on the "...." button and then you can select a color.

10) Now you need to click across from "Radius" and enter the radius you want the light to extend around the object. Lets's say 20. You'll have to experiment to see exactly what radius you want for the light in your map for that object.

Now you can close the object properties tree window. The object is still highlighted so click on an empty space in your map to unhighlight it.

It looks like for the TOTE editor they have made the light source instantly work, but if you don't see a change then click on view-->show underground-->view-->show terrain and you'll see the light now attatched to your hut.
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
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 02 May 2008, 19:49

ransomdl wrote:rdeford,

The Scripting Guide references "startThread" comand to initiate a function as an alternative for a "Trigger" function. Can you write a Script function command anywhere in the Script and trigger the function with a "startThread" command?
Use the startThread command only to start a thread. Use a trigger to start ordinary functions, but not threads.

EDIT: Oh, and you can write a function anywhere in the script and trigger it from anywhere in the script. Same thing for threads. In other words, the function and the trigger do not have to be sequential in order within the script. In fact, a trigger can even be placed inside a different function than the one it triggers.
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

User avatar
ransomdl
Leprechaun
Leprechaun
Posts: 34
Joined: 15 Oct 2006

Unread postby ransomdl » 05 May 2008, 14:16

rdeford,

Thank you for the reply. Sometimes I struggle when adding a script to an existing script that already has a Trigger(NEW_DAY_TRIGGER) and I can't figure how to trigger a new function that works the same day every week when the Trigger(NEW_DAY_TRIGGER) has already been used for a different function.

Your knowledge and wisdom is always helpful.
ransomdl
Warlock

User avatar
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 05 May 2008, 16:48

ransomdl wrote:rdeford,

Thank you for the reply. Sometimes I struggle when adding a script to an existing script that already has a Trigger(NEW_DAY_TRIGGER) and I can't figure how to trigger a new function that works the same day every week when the Trigger(NEW_DAY_TRIGGER) has already been used for a different function.

Your knowledge and wisdom is always helpful.
@ ransomdl-- I am looking forward to playing your first map.

Here is how to handle multiple function calls with the same trigger, for example the NEW_DAY_TRIGGER. This example comes from the script of my Mining Tycoon map:

Code: Select all

--=========================
-- dawn heartbeat of the mining company
--=========================

function dawn()
	replinishTraders();		-- replenish trader resource amounts
	shutDownMinesNW(); 		-- shutdown mines with no workers
	shutDownFeedersND();	-- shutdown feeders when no days of service remain
	attackFeedersNI(); 		-- attack a feeder if no insurance policy is in force
	shutDownMinesNF();		-- shutdowm mines when there arn't enough active feeders
	generateWorkers();		-- generate workers in Union Hall based on active feeders
	setInsuranceAmt();		-- ratchet premiums upwards
	checkInsurance();		-- inform player when policy expires
	sabotageMinesAI();		-- AI players sabotage mines periodically to make things fun
	attackMinesAI();		-- AI players send claim jumpers periodically to make things fun
	lowerMoral();			-- worker moral deteriorates daily
	holdFestival();			-- raise worker moral if festival has been purchased
	workerTurnover();		-- workers quit because of low moral
	bankIntrestCk();		-- see if player earns any intrest
	getP1BestHeroLevel();	-- save player's best hero level
	upgradeAIheroes();		-- level up the best AI hero for each AI player to approach P1 best hero level
end;
  Trigger(NEW_DAY_TRIGGER, "dawn");
Since the "dawn" function actually calls all the sub-functions inside of it every day, the trick is to place an IF statement into each of the sub-functions such that it is invoked only on certain days, or only under certain conditions. For example, here is what one of the above sub-functions looks like inside.

Code: Select all

function setInsuranceAmt()
	if mod(GetDate(DAY), 12) == 0  then	
		unionBribeAmt = unionBribeAmt + 50
		MessageBox(path.."insuranceRatesUp.txt")
	end;	
end;
As you can see, even though it is called every day by the NEW_DAY_TRIGGER, it will not do anything of importance except on every twelfth day.

Here is another of the dawn functions:

Code: Select all

-- shutdown mines with no workers
function shutDownMinesNW()	
	for i=1, 20 do
		if GetObjectOwner("mine"..i) == PLAYER_1 then
			mineStatus[i] = 0;
			mineStatus[i] = mineStatus[i] + GetObjectCreatures("mine"..i, CREATURE_EARTH_ELEMENTAL);
			mineStatus[i] = mineStatus[i] + GetObjectCreatures("mine"..i, CREATURE_AIR_ELEMENTAL);
			mineStatus[i] = mineStatus[i] + GetObjectCreatures("mine"..i, CREATURE_FIRE_ELEMENTAL);
			mineStatus[i] = mineStatus[i] + GetObjectCreatures("mine"..i, CREATURE_WATER_ELEMENTAL);
			if mineStatus[i] == 0 then -- no workers in mine
				SetObjectOwner("mine"..i, 0);
				MessageBox( { path.."mineShutdown.txt"; mNum = i } );
			end;
		end;
	end;
end; 
Again, even though it is called every day by the NEW_DAY_TRIGGER, it only does significant actions when certain conditions are met.

And so on. As you can see, you can make single function such as "dawn" into a large, multi-purpose workhorse that do all the daily housekeeping chores for your map when and where they are needed. There is no limit to the number of sub-functions that you can place inside a function.
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

User avatar
ransomdl
Leprechaun
Leprechaun
Posts: 34
Joined: 15 Oct 2006

Unread postby ransomdl » 09 May 2008, 14:20

rdeford,

Thanks for the information. Far more than I expected, but greatly appreciated as I have already applied the use of some of your comments to trigger functions anywhere on the map and not necessarily with the function. I am still working on when to utilize "startThread" for certain functions. Someday, I will put this all together and hopefully get you a map to test.
ransomdl
Warlock

User avatar
Metathron
Round Table Hero
Round Table Hero
Posts: 2704
Joined: 29 Jan 2006
Location: Somewhere deep in the Caribbean...
Contact:

Unread postby Metathron » 24 May 2008, 11:37

I would like a castle to give me 2 death knights each 7 days.

How do I go about doing this?
Jesus saves, Allah forgives, Cthulhu thinks you'd make a nice sandwich.

User avatar
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 24 May 2008, 14:49

Metathron wrote:I would like a castle to give me 2 death knights each 7 days.

How do I go about doing this?
Set up a function similar to the dawn() function described above. For example:

Code: Select all

function dawn()
   replinishCastle();      -- add Death Knights to castle
end;
  Trigger(NEW_DAY_TRIGGER, "dawn");
Then define the replinishCastle() function to add the two Death Knights to the castle every seven days. For example:

Code: Select all

function replinishCastle()
   if mod(GetDate(DAY), 7) == 0  then   
     AddObjectCreatures(objectName, creatureID, quantity);
   end;   
end;
Of course, you'll have to give the castle a script name and use it as the objectName, and provide the correct creatureID, and put a value of 2 for the quantity. The H5 Scripting Guide has the creature IDs and tells how to give an object a scripting name.
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

User avatar
Metathron
Round Table Hero
Round Table Hero
Posts: 2704
Joined: 29 Jan 2006
Location: Somewhere deep in the Caribbean...
Contact:

Unread postby Metathron » 24 May 2008, 15:17

*pauses*

Oh.

I knew the HoMM V editor was user-hostile, but I didn't know you had to be a rocket scientist to use it.

Thanks anyway.
Jesus saves, Allah forgives, Cthulhu thinks you'd make a nice sandwich.

User avatar
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 26 May 2008, 14:28

Metathron wrote: I knew the HoMM V editor was user-hostile, but I didn't know you had to be a rocket scientist to use it.
IMO, the H5 Editor is a tool created by the H5 development team for use by the programmers to create the maps that shipped with the game. I think that Ubisoft didn't include the development of a map editor in their contract with the developers. Then, as an after thought, due to fan pressure, they realized they had to have a map editor and took what was available. Consequently, given its intended users (i.e., programmers) the H5 Editor is not user-hostel.

Yes, in order to write scripts, you do have to learn how to write and use a programing language, albeit at a far lower level than a professional programmer would. Given that a non-professional skill level is all that is required, it really isn't that hard. I am merely a retired technical writer, and I managed to learn how to write H5 scripting with just a vague familiarity with Apple BASIC that I gained about 30 years ago.

Tell you what Metathron, I love HOMM, and it saddens me that so many of the fan map makers that made H3 and H4 live on in our hearts have abandoned H5 because of the difficulty in learning how to write scripts for it.

So, I hereby make this commitment to you: I will author an H5 Scripting Tutorial that will take you step-by-step through the process of writing an H5 script. I will explain the how and why of each step and explain the underlying programming concepts in plain language. By the end of this tutorial, you will have the knowledge and the skill required to create your own custom, scripted H5 maps. All I ask from you is for you to "beta test" the tutorial by going through it and doing all the exercises and make comments, suggestions, and criticisms prior to me releasing it to the HOMM community.

How about it Metathron, and/or any other interested map makers, any volunteers?
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

USBCable
Leprechaun
Leprechaun
Posts: 3
Joined: 11 Jun 2008

Undergournd Bridges

Unread postby USBCable » 11 Jun 2008, 21:15

So I have been trying to use the underground bridges and connecting them to the underground ground, but when i use it it shows up in the air, nowhere near where any player could walk on it. Does anyone know what im talking about

that is if anyone still looks at this post anymore

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 » 11 Jun 2008, 21:32

Make "humps" by bulk raising the ground at the bridge ends. It takes a bit of trial and error.
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."

USBCable
Leprechaun
Leprechaun
Posts: 3
Joined: 11 Jun 2008

Undergournd Bridges

Unread postby USBCable » 11 Jun 2008, 21:42

Well, somehow I dont think it is that simple

Because the ground level that you lower the grid to to make any kind of buildings is where the bridges are, they are high enough to be over anything in the dungeon and not touch it

USBCable
Leprechaun
Leprechaun
Posts: 3
Joined: 11 Jun 2008

Undergournd Bridges

Unread postby USBCable » 11 Jun 2008, 21:43

unless im using an outdated editor or something, but it has all the TOE creatures and stuff in it, so im kind of assuming its probably correct.


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 1 guest