[H5 EDITOR] Troubleshooting topic

Maps and the art of mapmaking.

Moderator: Moderators

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

Postby Marzhin » Nov 15 2006, 13:30

EDN wrote:Ok, this post is for a friend; he bought Heroes 5 but can't find the editor. May someone help?


The editor wasn't included before patch 1.3. Your friend should download the latest patch (1.4) to have access to the editor. The patches can be found on Ubi's site or there are links here on Celestial heavens.

User avatar
EDN
Scout
Scout
Posts: 156
Joined: 10 Sep 2006

Postby EDN » Nov 15 2006, 14:01

I will tell him... and thanks :)

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Postby myythryyn » Nov 15 2006, 17:30

thxs for the script meows.

i looked over it and found my error. its ok to have multiple statements in an if then statement, so that wasnt the problem, the problem was that i had objective_complete, when it should have been objective_completed :)

but im still having problems with my console

use this in your input.cfg file
// general
bind jd_button_0 'ESC'
bind jd_button_0 'ENTER'
bind jd_button_0 'NUM_ENTER'
bind jd_button_0 'E'
bind esc_pressed 'ESC'
bind enter_pressed 'ENTER'
bind enter_pressed 'NUM_ENTER'
bind show_console '`'

that is the exact place i have the bind command and i still cannot pull up the console to do troubleshooting. im totally confused why.
anyone have any ideas?

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

Postby Pitsu » Nov 15 2006, 17:47

myythryyn wrote:
that is the exact place i have the bind command and i still cannot pull up the console to do troubleshooting. im totally confused why.
anyone have any ideas?


I think there needs to be the schwinge des dodes thingie too (see the cheating guide in edito documentation folder). Moreover, there are several input.cfg files. You don't need to modify the one in game directory but the one in My Documents/MyGames/profile... As it is not told anywhere I kept editing the wrong file myself for a long time... ;|
Avatar image credit: N Lüdimois

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Postby myythryyn » Nov 16 2006, 1:20

thxs pitsu :) i completely forgot there was an input.cfg file in mydocuments.


Marzhin wrote:I'm wondering how the SetAIPlayerAttractor works exactly... I have a line that says :

Code: Select all

SetAIPlayerAttractor("arkania",PLAYER_2,2);


With "arkania" being the script name of a town...

But the AI player doesn't seem to care, he's just chasing after my heroes... Anyone else tried to toy with this ?


i myself didnt succeed at getting this command to work well, i would almost say its bugged unless someone can say they have gotten the AI attractor to work. in the map i made i ended up having to use the move hero command and other scripts to force the AI to attack a city, though it did create a region stop trigger outside the city that some players noticed a pause in movment when entering, so im not sure such a script would be suitable for your map. i could provide the script i used if you want....

meows
Peasant
Peasant
Posts: 75
Joined: 11 Oct 2006

Postby meows » Nov 16 2006, 8:59

.
myythryyn wrote:thxs pitsu :) i completely forgot there was an input.cfg file in mydocuments.


Marzhin wrote:I'm wondering how the SetAIPlayerAttractor works exactly... I have a line that says :

Code: Select all

SetAIPlayerAttractor("arkania",PLAYER_2,2);


With "arkania" being the script name of a town...

But the AI player doesn't seem to care, he's just chasing after my heroes... Anyone else tried to toy with this ?


i myself didnt succeed at getting this command to work well, i would almost say its bugged unless someone can say they have gotten the AI attractor to work. in the map i made i ended up having to use the move hero command and other scripts to force the AI to attack a city, though it did create a region stop trigger outside the city that some players noticed a pause in movment when entering, so im not sure such a script would be suitable for your map. i could provide the script i used if you want....


Any scripts that are posted help everyone so please post it myythryyn
.
. :D
Ok may i trade? here is a attractor code that works,

Code: Select all

function AIPlayerAttractor()
   if GetDate( DAY ) == 12 and (IsInfernoTownDefeated == 0) then
   print("Thread SetAIHeroAttractor has been started...");
   while 1 do
      sleep(10);
            if IsHeroAlive(heroname) == true then
            Priority = 2;
            SetAIPlayerAttractor("holin", heroname, Priority);
         print("Now is a third day enemy os heading to player1.");
         MessageBox("Maps/SingleMissions/Grail/enemy.txt");
         break;
      end;
   end;
end;
end;

--next

Now we have the AI's attention lets help him go get player 1 !

Code: Select all

-- fighting starts

function AIPressingTownHolin(heroname)
   if GetDate(DAY) == 15 and (IsInfernoTownDefeated == 0) then
   print("Thread AIPressingTownHolin has been started...")
   repeat
      sleep(20);
   until GetObjectOwner("holin") == PLAYER_2;
   print("Town Holin has been captured by Player2");
   local x,y = GetObjectPosition("holin");
   while 1 do
      sleep(20);
      if IsHeroAlive(heroname) == true then
         HeroMovePointsToHolin = CalcHeroMoveCost(heroname,x,y);
         AgraelMovePointsToHolin = CalcHeroMoveCost("Agrael",x,y);
         x1,y1,Floor = GetObjectPosition("Agrael");
         if IsObjectVisible(PLAYER_2, "Agrael") == nil or Floor ~= 0 then
            Priority = 2;
            SetAIHeroAttractor("holin", heroname, Priority);
         else
            if HeroMovePointsToHolin <= AgraelMovePointsToHolin then
               Priority = 2;
               SetAIHeroAttractor("holin", heroname, Priority);
            else
               Priority = -1;
               SetAIHeroAttractor("holin", heroname, Priority);
            end;
         end;
      else
         print("Hero ",heroname," is dead.");
         break;
      end;
   end;
end;
end;
 

OK the chase code works very well if the AI and PLAYER_1 town is within 1/4 of the map. if the AI is further away i notice LONG turns and he seems to mess around gathering troops for a week before heading out to find PLAYER_1.
**************************************************
Now my Problem is thus. I have Isabel in a Prison, PLAYER_1 must go free her and bring her to region "isabelhome" Now I have tried her ingame name Isabell and the name in the Prison Isabel yet although the code is error free it does not triger the win when she is taken to the regon. what is missing?.

Code: Select all

function IsabelH()
--  while 1 do
     if  IsObjectExists ("Isabel") then
    if  IsObjectInRegion ("Isabel", "isabelhome") then
    MessageBox("Maps/SingleMissions/a test3/win.txt");
    win(void);
       
    else sleep(1)
   end;     
   end;
end;
startThread(IsabelH);


Many thanks !

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

Postby Pitsu » Nov 16 2006, 9:22

meows wrote:.
**************************************************
Now my Problem is thus. I have Isabel in a Prison, PLAYER_1 must go free her and bring her to region "isabelhome" Now I have tried her ingame name Isabell and the name in the Prison Isabel yet although the code is error free it does not triger the win when she is taken to the regon. what is missing?.

startThread(IsabelH);[/code]

Many thanks !


Maybe the AIattractor commands indeed need to be in threads in order to run properly. Doesn't sound very practical solution from Nival, but who knows.

But why do you use a thread for region entering? Wouldnt it be simpler and less memory demanding to use region enter and non stop trigger? Additionally, not sure if it makes any difference but I always used win(); not win(void);
Avatar image credit: N Lüdimois

User avatar
Sixy
Leprechaun
Leprechaun
Posts: 37
Joined: 26 May 2006
Location: Budapest, Hungary

Postby Sixy » Nov 16 2006, 10:14

Hi again!

My question would be that: is there a way to make the taverns only show those gossips, what I wrote in the editor? And altough I changed the price of the gossips, it still asks for 100 gold for them. Is it a bug or a not fully functional option of the editor, or just I'm the clumsy one...?

meows
Peasant
Peasant
Posts: 75
Joined: 11 Oct 2006

Postby meows » Nov 16 2006, 12:40

Pitsu wrote:**************************************************
Now my Problem is thus. I have Isabel in a Prison, PLAYER_1 must go free her and bring her to region "isabelhome" Now I have tried her ingame name Isabell and the name in the Prison Isabel yet although the code is error free it does not triger the win when she is taken to the regon. what is missing?.

startThread(IsabelH);[/code]

Many thanks !

Maybe the AIattractor commands indeed need to be in threads in order to run properly. Doesn't sound very practical solution from Nival, but who knows.

But why do you use a thread for region entering? Wouldnt it be simpler and less memory demanding to use region enter and non stop trigger? Additionally, not sure if it makes any difference but I always used win(); not win(void);

humm gosh i wasn't thinking at all. no thread is needed for a region.
I tried win() and win(void) the win(void) is what they have in the manual
and now I am brain dead.. LOL. so i took Isabel out of the Prison and placed her so now need to figure out a region (code) she can go to and win the game.
As for the AIPlayerAttractor threads, that is all on a different map my Grail.h5m map and it would not run without starting the function. I put it up because
Marzhin wrote:
I'm wondering how the SetAIPlayerAttractor works exactly... I have a line that says :

Code:
SetAIPlayerAttractor("arkania",PLAYER_2,2);

I did some expermentation with the AIPlayerAttractor and it seems to work like this. HE Cheats!
What I mean by cheats is if PLAYER_1 town is low on mobs and Priority = 2 he will make haste to come and put you out of your misery. However of you have built up your town the same Priority = 2 will make him wait a week or three and build up troops. This tells me he has spys in PLAYER_1 towns, but if you make Priority = 3
he will come at you with what ever he has as a army.

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

Postby Marzhin » Nov 16 2006, 14:24

meows wrote:
Marzhin wrote:
I'm wondering how the SetAIPlayerAttractor works exactly... I have a line that says :

Code:
SetAIPlayerAttractor("arkania",PLAYER_2,2);

I did some expermentation with the AIPlayerAttractor and it seems to work like this. HE Cheats!
What I mean by cheats is if PLAYER_1 town is low on mobs and Priority = 2 he will make haste to come and put you out of your misery. However of you have built up your town the same Priority = 2 will make him wait a week or three and build up troops. This tells me he has spys in PLAYER_1 towns, but if you make Priority = 3
he will come at you with what ever he has as a army.


So I should make a priority of 3 ? Strange, according to the manual (scripting functions) we can only put priorities of -1, 0, 1 and 2... :|

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Postby myythryyn » Nov 17 2006, 6:14

there is a setting for 3 for AI attractor? can anyone confirm that?
it would be nice if there was a third setting, a kamikazee, suicidal, attack no matter what setting. the AI is such a coward sometimes and refuses to attack things unless it knows for sure that it completely outnumbers you.

as for the script i made, i think yours sounds like a much better solution and i might try it for the map i made. the script i made involved using the move hero command directing the AI to move right in front of the city i wanted the AI to attack. Only then would it attack the city if it was right outside it. which would confirm your idea that the closer the AI is to the target you want it to attack, the more likely it will directly move to attack it.

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Postby myythryyn » Nov 18 2006, 5:14

has anyone used successfully, or know how to use the
startcombat script?

the documentation for this command is just horrible and confusing, and no example is given.

i tried this
startcombat ("heroname", "enemyAIheroname", 5 , 5, 5);
then left the rest out since by default the last parameters are supposed to be nil anyways.
what i had hoped was that enemyAIhero would have five creatures, with a creatureID of 5, and five in a group. or something like that.

well anyways, it didnt work as i expected.
can anyone provide a working example of the script for this command?

User avatar
makrise
Leprechaun
Leprechaun
Posts: 11
Joined: 22 Oct 2006
Location: Germany

Postby makrise » Nov 18 2006, 7:22

Using this code, the game will start a combat with the hero that touched some conscripts(named "conscript") against 100 Conscripts and 1 Archangel:

Code: Select all

function fight_conscripts(heroname)
   StartCombat(heroname,nil,2,2,100,14,1,nil,"winlose_conscriptfight")
end;
function winlose_conscriptfight(heroname,winlose)
   if winlose==nil then
      print("You lose!")
   else
      print("You win!")
      RemoveObject("conscript")      
   end;
end;
SetObjectEnabled("conscript",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"conscript","fight_conscripts")


And here's (my) explanation for the StartCombat function.(Don't know if I've forgotten something)

Code: Select all

StartCombat(
heroname - Name of your hero, here it's the parameter of the triggered function
nil - Maybe an enemy hero, never used it
2 - Number of Groups that will attack the hero(for each group there can be two additional parameters, first is Creature ID, second is Stack size of this Creature)
2 - Creature ID of Creature 1
100 - Amount of Creature 1
14 - Creature ID of Creature 2
1 -Amount of Creature 2
nil - this could call a combat script I think, never used it.
"winlose_conscriptfight" - This function is called when the combat ends.
)


So you first have to specify the number of enemy stacks and then you need to add 2 parameters for each stack, setting the Creature ID and stack size.
Drachenwald.Net
"Well, things just got simpler. And a lot more complicated."
My Current Project: Rappelz Character Database, a free character database for players of the mmog "Rappelz"

User avatar
Sixy
Leprechaun
Leprechaun
Posts: 37
Joined: 26 May 2006
Location: Budapest, Hungary

Postby Sixy » Nov 18 2006, 10:07

Hi again!

I've got a problem with the with hut script. I want to set the witch hut to give the skill 'Light magic'. So I used this script:

Code: Select all

function WitchHut(heroname)
    GiveHeroSkill(11, heroname);
    MarkObjectAsVisited('witch', heroname);
    Trigger(OBJECT_TOUCH_TRIGGER, 'witch', 'WitchHut');
end;
Trigger(OBJECT_TOUCH_TRIGGER, 'witch', 'WitchHut');


But it sais that 'function WitchHut not defined'. What's the problem with it?

Najibarr
Leprechaun
Leprechaun
Posts: 21
Joined: 22 Oct 2006

Postby Najibarr » Nov 18 2006, 14:56

Well first of all this script would give you a random skill (with witch hut) then it would start the trigger and execute the function. I guess you don't want this so you should add, outside the function : SetObjectEnabled('witch', nil);

Then, the MarkObjectAsVisited command only put the hut as "visited" but it will already be since you received a skill from it. In reality that command is just useless if not to change "not visited" in the object description to "visited" when the object normal behavior is deactivate.

Then, the Trigger inside the function is supposed to cancel the normal trigger to make sure the hero doesn't receive the light magic skill again and again so it should be : Trigger(OBJECT_TOUCH_TRIGGER, 'witch', nil);

So the result in code would be :

Code: Select all

SetObjectEnabled('witch', nil);
function WitchHut(heroname)
    GiveHeroSkill(11, heroname);
    MarkObjectAsVisited('witch', heroname);
    Trigger(OBJECT_TOUCH_TRIGGER, 'witch',nil);
end;
Trigger(OBJECT_TOUCH_TRIGGER, 'witch', 'WitchHut');


This script will give the light magic skill to the hero if it can this mean if there is space for it. It will upgrade its light magic skill if the hero already knows it.

And the "function not defined " is a normal error.

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Postby myythryyn » Nov 18 2006, 16:10

Thxs Makrise, that script works perfectly.

i was able to use the startcombat script in the map i was making :)

User avatar
Sixy
Leprechaun
Leprechaun
Posts: 37
Joined: 26 May 2006
Location: Budapest, Hungary

Postby Sixy » Nov 19 2006, 16:39

Najibarr wrote:Well first of all this script would give you a random skill (with witch hut) then it would start the trigger and execute the function. I guess you don't want this so you should add, outside the function : SetObjectEnabled('witch', nil);

Then, the MarkObjectAsVisited command only put the hut as "visited" but it will already be since you received a skill from it. In reality that command is just useless if not to change "not visited" in the object description to "visited" when the object normal behavior is deactivate.

Then, the Trigger inside the function is supposed to cancel the normal trigger to make sure the hero doesn't receive the light magic skill again and again so it should be : Trigger(OBJECT_TOUCH_TRIGGER, 'witch', nil);

So the result in code would be :

Code: Select all

SetObjectEnabled('witch', nil);
function WitchHut(heroname)
    GiveHeroSkill(11, heroname);
    MarkObjectAsVisited('witch', heroname);
    Trigger(OBJECT_TOUCH_TRIGGER, 'witch',nil);
end;
Trigger(OBJECT_TOUCH_TRIGGER, 'witch', 'WitchHut');


This script will give the light magic skill to the hero if it can this mean if there is space for it. It will upgrade its light magic skill if the hero already knows it.

And the "function not defined " is a normal error.

That didn't work for me. : ( I've tried it in both your way, and changing the line

Code: Select all

    GiveHeroSkill(11, heroname);

to

Code: Select all

    GiveHeroSkill(heroname, 11);

as the script functions guide says. None of the versions worked. : ( Is there anybody who once made a working Witch Hut Script?

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

Postby Pitsu » Nov 19 2006, 17:25

Sixy wrote:That didn't work for me. : (


did work for me. With this version :

Code: Select all

    GiveHeroSkill(heroname, 11);


Of course you do not get any notification of getting a skill. Since the original script that gives a random skill is disabled, so is disabled the notification window. In order to notify player what skill has been given you need to add a MessageBox yourself.
Other than that you may check that the witch hut structure has correct name "witch".
Avatar image credit: N Lüdimois

User avatar
Sixy
Leprechaun
Leprechaun
Posts: 37
Joined: 26 May 2006
Location: Budapest, Hungary

Postby Sixy » Nov 19 2006, 17:43

Hm... Now it works. I've noticed that the problem was if I use TAB in the script, it won't work. Simply. Strange. Thanks. : )

User avatar
Sixy
Leprechaun
Leprechaun
Posts: 37
Joined: 26 May 2006
Location: Budapest, Hungary

Postby Sixy » Nov 19 2006, 19:08

I've got a new problem (sorry...):

I wanted to make a script which opens a message box when capturing a gremlin dwelling. I used this script:

Code: Select all

function GetWorkshop()
    MessageBox("Maps/SingleMissions/The Runaway Princess - Part I/workshop_cap.txt");
end;
Trigger(OBJECT_CAPTURE_TRIGGER, 'workshop', 'GetWorkshop');

I've tried this way and without the last line, but selecting the capture trigger function on the workshop's properties.

Sorry for my annoying problems. I would just like to create a well-done map. : )


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: Google [Bot] and 5 guests