Events and Free Levels (H5)

Maps and the art of mapmaking.
GohozoqPohobo
Leprechaun
Leprechaun
Posts: 26
Joined: 30 Sep 2007

Events and Free Levels (H5)

Unread postby GohozoqPohobo » 30 Sep 2007, 16:50

In heroes 3 there was an object called an event that you could place on the map.
Assume that I and my companions wished to play a map in which everyone's first hero was higher than average level. Instead of littering the map with treasure chests, I could place a one-time event that would simply grant X experience.
I presume that this can be done in heroes 5 with scripts, but I haven't any idea as to how. Could anyone point me to a place where I might learn how to accomplish said task?

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

Unread postby Pitsu » 01 Oct 2007, 16:28

place an area and name it to "AreaName" for example:
For +5000 exp should go:

Code: Select all

function boost(heroname)
ChangeHeroStat(heroname, STAT_EXPERIENCE, 5000);
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "AreaName", nil );
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "AreaName","boost", nil );
To learn more, seek out the editor documents in Homm5 catalogue and my own little material is available under downloads section
Avatar image credit: N Lüdimois

GohozoqPohobo
Leprechaun
Leprechaun
Posts: 26
Joined: 30 Sep 2007

Unread postby GohozoqPohobo » 03 Nov 2007, 20:23

I have a little coding experience, but I'm still struggling.
What do you mean "place an area?"
My first try is going to be on warlords.
Presume I wish each hero to start at 7th level.

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 » 03 Nov 2007, 23:12

GohozoqPohobo wrote:I have a little coding experience, but I'm still struggling.
What do you mean "place an area?"
My first try is going to be on warlords.
Presume I wish each hero to start at 7th level.
Pitsu means place a region in from of the towns that the player could start from. You also have to place obstacles such that the player would have to pass through the region. In his example, the region is named "AreaName." nil makes the area only execute the instructions one time and then never again.
function boost(heroname)
ChangeHeroStat(heroname, STAT_EXPERIENCE, 5000);
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "AreaName", nil );
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "AreaName","boost", nil );
You should have a look at Pitsu's scripting guide. Plus, you need to go through the map editor manual (all of the parts.) The practical guide shows you how to set up an area. I also recommend that you look at some maps that use scripting.


An alternative way to do this without regions would be something like:
for i = 1, 8, 1 do --do for player (this assumes eight players)
ChangeHeroStat (GetPlayerHeroes(i)[0], STAT_EXPERIENCE, 8000);
end;
Edit: The map editor maunals for the various versions are on your computer. Click on the windows start button --> All Programs --> Ubisoft --> Whatever version of heroes you are working with --> Map Editor Manual. You will see that there are a number of entries there.

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

GohozoqPohobo
Leprechaun
Leprechaun
Posts: 26
Joined: 30 Sep 2007

Unread postby GohozoqPohobo » 04 Nov 2007, 16:06

Awesome, that worked perfectly.
I'm trying, now, to have events specific to which faction each player chooses.
For instance, if he's a necromancer, he receives bonus X, which knights receive bonus Y.
What function returns faction type?

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 » 04 Nov 2007, 20:21

GohozoqPohobo wrote:Awesome, that worked perfectly.
I'm trying, now, to have events specific to which faction each player chooses.
For instance, if he's a necromancer, he receives bonus X, which knights receive bonus Y.
What function returns faction type?
You are going to need to use this:
GetHeroSkillMastery — returns hero’s skill mastery level
Syntax
GetHeroSkillMastery(heroName, skillID);
Description
This function returns defined hero’s skill mastery level (0 – not learned, 1 - basic, 2 - advanced,
3 - expert, 4 - extra expert).
This function works for both learned or given by artifact hero’s skills.
The skills you will want to check for are basic racial skills, like artificer for the wizard.

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

GohozoqPohobo
Leprechaun
Leprechaun
Posts: 26
Joined: 30 Sep 2007

Unread postby GohozoqPohobo » 05 Nov 2007, 02:37

Thanks a good deal.
I'm having a hard time reading some of the manuals. It's like they were written in some other language and then translated... poorly.


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 2 guests