[H5 EDITOR] Troubleshooting topic

Maps and the art of mapmaking.
cgsilver
Leprechaun
Leprechaun
Posts: 10
Joined: 10 Aug 2007
Location: Hungary/Budapest
Contact:

Unread postby cgsilver » 24 Aug 2007, 14:29

Hope to get heard...
anyway... There's my next trouble. I mean not a trouble as script works, but if it could be more simple I'm in to an other kind of solution!!

- Quest is to eleminate two players from the game (singleplayer) but there was now eleminatefunction, nor eleminate triggering so I wrote the following script:
Trigger(OBJECT_CAPTURE_TRIGGER,"Inferno","HellDesert")
Trigger(OBJECT_CAPTURE_TRIGGER,"Necro","HellDesert")
Trigger(PLAYER_REMOVE_HERO_TRIGGER,2,"HellDesert")
Trigger(PLAYER_REMOVE_HERO_TRIGGER,3,"HellDesert")

function HellDesert()
if IsHeroAlive("Aberrar") == nil then
if IsHeroAlive("Oddrema") == nil then
if GetObjectOwner("Inferno") == 1 then
if GetObjectOwner("Necro") == 1 then
SetObjectiveState("Enemies",OBJECTIVE_COMPLETED)
RemoveObject("CGolem")

end;
end;
end;
end;
end;

OR didn't work when Triggering:
Trigger(OBJECT_CAPTURE_TRIGGER,"Inferno" OR "Necro","HellDesert")
AND didn't work in IF condition:
if IsHeroAlive("Oddrema") == nil AND IsHeroAlive("Aberrar") then...
And remember "To all things comes an end but in every end there's a new beginning."
MUG == Miss U Gorgons

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

Unread postby Marzhin » 24 Aug 2007, 15:03

OK I'm not sure to understand what you're trying to do but while I was working on LotA I discovered a function which, I think, is not documented in the editor's manual.

It is

Code: Select all

GetPlayerState(PLAYER);
It returns a number. Can't remember exactly what the numbers mean, except the 3 which is returned when PLAYER is defeated.

So you could have a trigger like

Code: Select all

Trigger (OBJECT_CAPTURE_TRIGGER, "Inferno", "HellDesert"); 
(--yes you can't use OR operators in Triggers, you must set the trigger for every town individually)

and another for when the enemy loses a hero (any hero) :

Code: Select all

Trigger( PLAYER_REMOVE_HERO_TRIGGER , PLAYER_2, "check_enemy" );
And as I'm not a programmer I prefer setting different functions for things, easier for me :

Code: Select all

function Helldesert(prevowner, newowner)
if newowner==PLAYER_1 then
  check_enemy();
  end;
end;

function check_enemy()
  if GetPlayerState(PLAYER_2)==3 then
    SetObjectiveState("Enemies",OBJECTIVE_COMPLETED)
    RemoveObject("CGolem") 
    ...
  end;
end;
Just my two cents, hope it'll help you.

cgsilver
Leprechaun
Leprechaun
Posts: 10
Joined: 10 Aug 2007
Location: Hungary/Budapest
Contact:

Unread postby cgsilver » 24 Aug 2007, 16:34

Marzhin wrote:...
Just my two cents, hope it'll help you.
Thanks for the Extra Coin ;-)
And remember "To all things comes an end but in every end there's a new beginning."
MUG == Miss U Gorgons

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Need help with combat scripts

Unread postby Franzy » 07 Sep 2007, 12:36

Can't make the function SetHeroCombatScript work!
I have the script, I have the xdb-file, they both Unicode. When I make call like SetHeroCombatScript(hero,path.."mycombat.xdb") the game responds that the file does not exist.

How does one set a combat script?!

Neckie
Peasant
Peasant
Posts: 67
Joined: 05 Oct 2006
Location: Quebec, Canada

Unread postby Neckie » 07 Sep 2007, 14:50

you need to add #xpointer(/Script) at the end of your xdb file name which will give :

SetHeroCombatScript(hero,path.."mycombat.xdb#xpointer(/Script)")

You've got to add that part for some other xdb files ... like effects, dialog scenes, ambient light and a few others i cant think of right now.

mweil86
Leprechaun
Leprechaun
Posts: 13
Joined: 11 Sep 2007

Razing Objects

Unread postby mweil86 » 11 Sep 2007, 04:12

I am having trouble with the raze object command. I ran the script and the object disappeared before I triggered it and no "razed" object appeared. When I went back into the map editor, the object was gone but remained on the object list. I am trying to change a Mystical Garden into the 2x2 size snag so they are the same size. I also masked the active tile on the Mystical Garden. What am I missing?

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

Re: Razing Objects

Unread postby Grumpy Old Wizard » 18 Sep 2007, 11:38

mweil86 wrote:I am having trouble with the raze object command. I ran the script and the object disappeared before I triggered it and no "razed" object appeared. When I went back into the map editor, the object was gone but remained on the object list. I am trying to change a Mystical Garden into the 2x2 size snag so they are the same size. I also masked the active tile on the Mystical Garden. What am I missing?
I haven't played around with the raze object command, but I think you have to specify the model that replaces the razed object. I also didn't know that raze could be used for anything but a 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
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 18 Sep 2007, 11:43

I have been playing around with trying to get SetObjectPosition to work for something other than a hero. I can move a heroe just fine with SetObjectPosition, but can't get anything else to move.

I also have tried to get RemoveObject to work with no success. Here is an example of a function I wanted to trigger when the player enters a region. The dwarven stones named "Test Block" did not go away, but the message did display so I know the function was triggered. What did I do wrong?
function NewExile(heroename)

MessageBox(path.."Newly Exiled.txt");

RemoveObject ("Test Block");

Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnNewlyExiled", nil);
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnNewlyExiled", "NewExile");
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 » 18 Sep 2007, 12:15

Grumpy Old Wizard wrote: I also have tried to get RemoveObject to work with no success. Here is an example of a function I wanted to trigger when the player enters a region. The dwarven stones named "Test Block" did not go away, but the message did display so I know the function was triggered. What did I do wrong?
The patches may have messed it up but in early game versions it had to be done:

1. place named blocks somewhere on map, where their absence/presence goes unnoticed
2. Block the area where the blocks should be
3. Day 1 SetObjectPosition and move the objects to blocked region
4. Script that opens passage will SetObjectPosition to another location againand the area under them is turned passable.
Avatar image credit: N Lüdimois

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 » 18 Sep 2007, 21:30

Thanks Pitsu, that did the trick. :)

I noticed that not all items have the IsRemovable field (which I changed to true) in the object properties, so I'm guessing that those items that don't can't be moved. The blocks worked, but when I tried a monolith (which does not have the field) it wouldn't move.

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

Passing values to wands and scrolls?

Unread postby Grumpy Old Wizard » 19 Sep 2007, 12:19

If you hover your cursor over a wand or scroll in the map editor you see
Allows casting of magic spell < value=spell_name > from this wand(or scroll)
The wand also has 2 more variables associated with it for charges (current and maximum.)

Has anyone found a way to work with any of these variables or to specify the spell that is on the wand/scroll (aside from placing it on the map and hitting the spacebar.)

I would like to be able to give specific wands or scrolls for a quest reward, but can't figure out how to do it.

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

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Re: Passing values to wands and scrolls?

Unread postby Franzy » 30 Sep 2007, 18:51

Anybody has a slightest idea how to organize a function that will trigger every time a battle starts and/or ends? As far as I know, there is now such trigger.
I believe it can be arranged with touch object trigger, but that will require a lot of efforts, like assigning the trigger to EVERY creature stack and hero! That's cumbersome...

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 2007, 20:15

To my knowledge combat scripts can only be placed on AI heroes and creature stacks.

If anyone knows how to place them on a player controlled heroe please enlighten us because I would like to do some things with combat scripts on a player hereo.

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

Re: Passing values to wands and scrolls?

Unread postby Pitsu » 01 Oct 2007, 16:16

Franzy wrote: I believe it can be arranged with touch object trigger, but that will require a lot of efforts, like assigning the trigger to EVERY creature stack and hero! That's cumbersome...
It is annoying to name all neutrals and other battle sites. Assigning triggers can be done easily (for objects named as monster1, monster2 ...monster60):

Code: Select all

for i= 1, 60 do
Trigger(OBJECT_TOUCH_TRIGGER, "monster"..i, "combat");
end;
Edit: I have not tested it for long, but at least it did work in earlier patches.
And no suggestion about how to assign a combat script to players hero at the moment.
Avatar image credit: N Lüdimois

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 02 Oct 2007, 08:19

Grumpy Old Wizard wrote:To my knowledge combat scripts can only be placed on AI heroes and creature stacks.

If anyone knows how to place them on a player controlled heroe please enlighten us because I would like to do some things with combat scripts on a player hereo.

GOW
Combat scripts work ok with ANY heroes. Use SetHeroCombatScript function. Problem is if two hero engage in a battle only attacker hero's script will work.

Neckie
Peasant
Peasant
Posts: 67
Joined: 05 Oct 2006
Location: Quebec, Canada

Unread postby Neckie » 02 Oct 2007, 12:36

Franzy wrote:Anybody has a slightest idea how to organize a function that will trigger every time a battle starts and/or ends? As far as I know, there is now such trigger.
I believe it can be arranged with touch object trigger, but that will require a lot of efforts, like assigning the trigger to EVERY creature stack and hero! That's cumbersome...
What exactly do you want to do? If you want a function to execute after each combat you could use the following technique : Use the SetGameVar function since you can modify the values of variables in combat. You could have a thread that act when a certain variable have a value of 1 (after a combat) and then execute what it has to do and then change it back to 0.

What pitsu said does work if you want to exectute a function every time a battle is about to start.

If you could just give more details we might be able to help you.

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

Unread postby rdeford » 19 Oct 2007, 15:17

alavris wrote:Does anybody know if it is possible to open official (Ubisoft-made) maps in the editor? If yes, then how do you do this?
Use a separate program in another window. Flip between windows while you work.

OOPS-- Wrong answer. Sorry. I misread your question to be how to open the Ubisoft game manuals while using the editor.

Right answer: You can open the campaign maps in the editor but you have to unbundle them first. Neckie over on Elrath unbundled all the maps for the HOF campaigns and posted them for editing or playing them one at a time. But, I cannot seem to find Elrath.com right now so I cannot give you the link. I downloaded the maps onto my computer when I had access to Elrath, and I do open them regularly. But, I don't know know off the top of my head how to unbundle them myself.
Last edited by rdeford on 22 Oct 2007, 22:34, edited 1 time in total.
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 » 22 Oct 2007, 15:55

Alright, so I am trying to modify an existing HoMM V map. What I want to do is simple - increase the number of creatures guarding the choke points that lead into each of the 6 players' lands. I have done this without difficulties, but when I try to play the dwarves or barbarians the old HoF problem occurs; namely, you can't choose any dwarven or barbarian heroes from the starting menu, which is really annoying. :disagree:

Can this be fixed easily?
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 » 22 Oct 2007, 22:15

Metathron wrote: problem occurs; namely, you can't choose any dwarven or barbarian heroes from the starting menu, which is really annoying. :disagree:

Can this be fixed easily?
======response======
I just did a quick test map to check this out. It looks like all you have to do is to open the map in the HOF editor. Click on the View/Map Properties. Click on the Player Properties. Use the dropdown list to select the player that controls the castle you wish to use (e.g., Inferno or Dwarf). Click the Main Town check box to put a check mark there (a Inferno or Dwarf town will be automatically shown). And now, here is the magic step that will resolve the problem-- click the Generate Hero In Town check box to put a check mark there. Repeat for each town you desire to select heroes in.

If this doesn't work let me know the name of the map and I'll figure something out for you on the map itself.
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
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 24 Oct 2007, 15:23

Oh, and I should add that the each player you do this with should be playable by Human, or Human and Computer.
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


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 4 guests