[H5 EDITOR] Troubleshooting topic
allied teams
hey there, im making allied map and i want it that way so you cant swap team color flag like, you got red + blue against orange + green, but you can swap red + green if you want, and i dont want that coz the map placed things suffer and its akward.
what should i do? i tryed many tricks already but no result
what should i do? i tryed many tricks already but no result
Making maps is Art and true beuty lies in them..
@ Mnc
I just created a test multi-player map from scratch that works as you wish. Here is what I did:
I have had a problem with the editor not saving the teams settings correctly. When this problem happens, I open the map with the editor a second time and set up the teams correctly. It seems to save the settings correctly the second time. So, if your map does not work as you desire, open it up again and redo your settings if necessary.
I just created a test multi-player map from scratch that works as you wish. Here is what I did:
- 1. Placed 4 towns on the map.
2. Selected a town, pressed the Space Bar, and set the player-owner to player_1.
3. Repeated for each of the other towns to give each town a unique player-owner (player_2, player_3, or player_4).
4. Viewed map properties, selected the Teams tab, set 2 teams, then set player_1 and player_2 on team-1, and then player_3 and player_4 on team-2.
5. Viewed map properties, selected the Players tab, and set player_1 to have a main town, be human playable only, and set the Race to match the town.
6. Repeated for player_2, player_3, and player_4.
I have had a problem with the editor not saving the teams settings correctly. When this problem happens, I open the map with the editor a second time and set up the teams correctly. It seems to save the settings correctly the second time. So, if your map does not work as you desire, open it up again and redo your settings if necessary.
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
That what i thought i done already, i better try look if something is out of order here, but since you got your test map working thats one good news for me, maybe I success toordeford wrote:
- 1. Placed 4 towns on the map.
2. Selected a town, pressed the Space Bar, and set the player-owner to player_1.
3. Repeated for each of the other towns to give each town a unique player-owner (player_2, player_3, or player_4).
4. Viewed map properties, selected the Teams tab, set 2 teams, then set player_1 and player_2 on team-1, and then player_3 and player_4 on team-2.
5. Viewed map properties, selected the Players tab, and set player_1 to have a main town, be human playable only, and set the Race to match the town.
6. Repeated for player_2, player_3, and player_4.
<working>
edit: hurrey i got it working, i changed at map properties tree each players flag color speficly and took off from each players setting "CanBeDisabled" its working now as i wanted, thanks rdeford must had been something very little i didnt notice, i also had on few player settings "NO_TYPE_TOWN" but i switched it to random_town.
Making maps is Art and true beuty lies in them..
Pitsu wrote:King Imp, one of the maps that you downloaded must contain "large message boxes" mod. To get the messageboxes back to tiny ones remove the map from your H5 directory.
Yup, that fixed it. Thanks Pitsu.
I'm still annoyed though that the editor has the ability to mess up other maps simply from being in the directory. That and it is so annoying when it decides to change maps by itself from no teams to teams and vice versa.
I'm making a series of demo maps that contain various interesting scripting examples. The first one is called "Watchers". Monsters on this map constantly turn to face the hero. Note that the angle is accurate, not with a step of 90 or 45 degrees. This is to show that it's possible to survive without any mathematical functions like sin, cos, exp or, like in this case, without arctan.
The map is here: http://dreamforge.by.ru/files/WatchersDemo.rar (10 kb)
The map is here: http://dreamforge.by.ru/files/WatchersDemo.rar (10 kb)
@ Franzy,
I am totally impressed! This is mighty fine scripting. I wish the comments were in English, but the code is a so logically organized that I think I could use it without being able to read the comments. Thanks for the inspiring example.
I am totally impressed! This is mighty fine scripting. I wish the comments were in English, but the code is a so logically organized that I think I could use it without being able to read the comments. Thanks for the inspiring example.
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
I couldn't get it to work by setting the objective parameters. But, using the script, I was able to get the desired effect by adding this function:Pitsu wrote:Objectives that are not MANUAL type can have several types of rewards. Is it possible to have several of them simultaneously? For example experience and resource? I could not get it working in testing, but the editor guide hints otherwise and i do not see why not.
Code: Select all
-- objective type = AWARD_EXPERIENCE, Experience parameter = 1000
-- function grants an additional reward of crystal resource when objective is completed
function objGiftTest()
if GetObjectiveState("multRewardTest", PLAYER_1) == OBJECTIVE_COMPLETED then
local qty = GetPlayerResource(PLAYER_1, CRYSTAL);
SetPlayerResource(PLAYER_1, CRYSTAL, qty + 30);
end;
end;
Trigger(OBJECTIVE_STATE_CHANGE_TRIGGER, "multRewardTest", "objGiftTest");
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
Well those comments just describe the idea of how to compute angle without having any arc-function If you are interested, here is what I did (get prepared for a load of maths):
Let's say we have a radius-vector from the monster to the hero. It has two components: dx and dy. We know that tan(alpha) = dy/dx (alpha is the angle we need). Unfortunately, HOMM5 script language does not know any math functions except for square root. That's why one has to use series decompositions.
I used a series decomposition of arctan:
arctan(x) = x - x^3/3 + x^5/5 - x^7/7 ...
The trouble is this series converges only if -1<x<1, and it converges really slow when x is close to 1 or -1.
I came to the following solution: I simply turn the radius-vector for such an angle beta that it would fall into the sector (-pi/6,pi/6) by multiplying it on a rotation matrix T=[cos(beta),-sin(beta); sin(beta),cos(beta)]. Of course I remeber the angle beta (it's called "addangle" in the script) to add it later. Why I used sector (-pi/6,pi/6) though (-pi/4, pi/4) would seem a more logical choice? Because of the slow convergence I mentioned earlier. This series converges quite fast in this sector, you only need 4-5 members of the series to achieve a precision of 5-6 digits.
After I compute angle (in radians) and add angle beta, I simply translate it into degrees (cause homm5 function require angles in degrees, not radians). Then I add another 90 degrees, cause 0 degrees for Nival means facing south, while all humanity believes that 0 means facing east
That's all. Other parts of the script are quite conventional - cycling thru monsters and turning them every n time segments...
Let's say we have a radius-vector from the monster to the hero. It has two components: dx and dy. We know that tan(alpha) = dy/dx (alpha is the angle we need). Unfortunately, HOMM5 script language does not know any math functions except for square root. That's why one has to use series decompositions.
I used a series decomposition of arctan:
arctan(x) = x - x^3/3 + x^5/5 - x^7/7 ...
The trouble is this series converges only if -1<x<1, and it converges really slow when x is close to 1 or -1.
I came to the following solution: I simply turn the radius-vector for such an angle beta that it would fall into the sector (-pi/6,pi/6) by multiplying it on a rotation matrix T=[cos(beta),-sin(beta); sin(beta),cos(beta)]. Of course I remeber the angle beta (it's called "addangle" in the script) to add it later. Why I used sector (-pi/6,pi/6) though (-pi/4, pi/4) would seem a more logical choice? Because of the slow convergence I mentioned earlier. This series converges quite fast in this sector, you only need 4-5 members of the series to achieve a precision of 5-6 digits.
After I compute angle (in radians) and add angle beta, I simply translate it into degrees (cause homm5 function require angles in degrees, not radians). Then I add another 90 degrees, cause 0 degrees for Nival means facing south, while all humanity believes that 0 means facing east
That's all. Other parts of the script are quite conventional - cycling thru monsters and turning them every n time segments...
-
- Leprechaun
- Posts: 5
- Joined: 18 Oct 2006
trigger
a question for scripting gurus:
i added few scripts to a map which , individually, are working ok, and they consist in triggering some functions everyday.
i know syntax is ok, but somehow i cannot make them all work together :
trigger(NEW_DAY_TRIGGER, 'action1');
trigger(NEW_DAY_TRIGGER, 'action2');
trigger(NEW_DAY_TRIGGER, 'action3');
i read somewhere this is requiring a trick in order to check for every singel action on a new day as intended, not only the first to trigger, the rest of them being ignored like they never existed.
i would very much apprecate any help, its the last step i need to accomplish my work.
ty
i added few scripts to a map which , individually, are working ok, and they consist in triggering some functions everyday.
i know syntax is ok, but somehow i cannot make them all work together :
trigger(NEW_DAY_TRIGGER, 'action1');
trigger(NEW_DAY_TRIGGER, 'action2');
trigger(NEW_DAY_TRIGGER, 'action3');
i read somewhere this is requiring a trick in order to check for every singel action on a new day as intended, not only the first to trigger, the rest of them being ignored like they never existed.
i would very much apprecate any help, its the last step i need to accomplish my work.
ty
Re: trigger
Indeed you cannot have more than one trigger associated to an event. Whenever a new day starts or a hero is removed, an specified object is touched or any other event occurs two scripts may not run simultaneously. But you can do an extra function that specifies the functions that need to run. In your case:the_teacher wrote: trigger(NEW_DAY_TRIGGER, 'action1');
trigger(NEW_DAY_TRIGGER, 'action2');
trigger(NEW_DAY_TRIGGER, 'action3');
Code: Select all
Function dailyevents()
action1; -- runs function action1
action2; -- once action1 script is checked, function action2 is triggered
action3;
end;
trigger(NEW_DAY_TRIGGER, 'dailyevents'); -- every day runs function dailyevents.
--action1, action2 and action3 should specify at which date they
--execute and they should NOT have any kind of
--trigger(NEW_DAY_TRIGGER, nil or whatever); command in them.
Avatar image credit: N Lüdimois
-
- Leprechaun
- Posts: 5
- Joined: 18 Oct 2006
so basically it will be only one trigger for multiactions and , as i understood, the action2 won't require any special conditions coming from action1 in order to be executed, it just waits in line : action1/end; action2/end;.., action x/end;.. within same function triggered on a new day.
ty very much, i will try it today
edit: i forgot to mention that once an action was checked and and conditions fullfilled to take place it should turn to nil and never triggers again.
i used to use
functionx = nil;
when i tried with separate functions, hope i find a way to disable independently once they happen if i include them all in same function
ty very much, i will try it today
edit: i forgot to mention that once an action was checked and and conditions fullfilled to take place it should turn to nil and never triggers again.
i used to use
functionx = nil;
when i tried with separate functions, hope i find a way to disable independently once they happen if i include them all in same function
@ the_teacher
Pitsu is exactly correct in his approach.
Here is an actual code sample from the script for the map I'm currently working on:
Here is the code for one of the functions called by the dawn() function:
Pitsu is exactly correct in his approach.
Here is an actual code sample from the script for the map I'm currently working on:
Code: Select all
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(); -- shutdown 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 commandos size mines 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 interest
end;
Trigger(NEW_DAY_TRIGGER, "dawn");
Code: Select all
function bankIntrestCk()
local day = GetDate(DAY_OF_WEEK)
local int = bankAccount * 0.1
interestTemp = interestTemp + int
if day == 1 and bankAccount > 0 then
local mo = GetDate(MONTH);
local wk = GetDate(WEEK) - 1;
bankAccount = bankAccount + interestTemp;
interestTotal = interestTotal + interestTemp;
MessageBox( { path.."intrestPaid.txt"; month = mo, week = wk,
intWeek = interestTemp, balance = bankAccount, intTotal = interestTotal });
interestTemp = 0
end;
if day == 1 and interestTotal >= 1000000 then
SetObjectiveState("profit", OBJECTIVE_COMPLETED, PLAYER_1);
end;
end;
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
I've got usual problem with the map : scripting...
So, I'm trying to go simple script : "the message appears when hero enters a region" but i'm getting "ERROR:Empty text file (or something like that)" on the console when entering the region. I might be writing wrong script or path to the file , i just don't know.
Could someone tell me how should this script look like for my map, using all paths and stuff. I tried to do it like it was done in TheVirginOfPonce but i must miss something. Please have a look at the map, scripts and give me some clues what's wrong there. (the map is really in beginning state, but there wont be any real point in doing other parts if i cant make the script)
map: http://rapidshare.com/files/93437705/Exiles1.h5m.html
script:
path = "Maps/SingleMissions/Exiles1/"
function Impaled()
MessageBox(path.."Scene1.txt");
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", nil );
end;
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", "Impaled" );
I'd really apreciate if someone can make this thing work....
EDIT : map made in ToE v3.0 (well, basic ToE without updates...)
So, I'm trying to go simple script : "the message appears when hero enters a region" but i'm getting "ERROR:Empty text file (or something like that)" on the console when entering the region. I might be writing wrong script or path to the file , i just don't know.
Could someone tell me how should this script look like for my map, using all paths and stuff. I tried to do it like it was done in TheVirginOfPonce but i must miss something. Please have a look at the map, scripts and give me some clues what's wrong there. (the map is really in beginning state, but there wont be any real point in doing other parts if i cant make the script)
map: http://rapidshare.com/files/93437705/Exiles1.h5m.html
script:
path = "Maps/SingleMissions/Exiles1/"
function Impaled()
MessageBox(path.."Scene1.txt");
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", nil );
end;
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", "Impaled" );
I'd really apreciate if someone can make this thing work....
EDIT : map made in ToE v3.0 (well, basic ToE without updates...)
Astenan wrote:I've got usual problem with the map : scripting...
Dang! This code looks like it should work just fine. I had so much trouble believing that it wouldn't work that I downloaded your map and tried it myself. Sure enough, I got the empty text error. I will make it work and post a reply. Just give me a little time. By the way, The Virgin of Ponce was my very first map, and I now have a better way to get the path that works automatically even when you save the map under a different name:
Code: Select all
path = GetMapDataPath(); -- makes saving under a new name easier
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
OK, I got it to work. Basically, I had to create a new resource file.rdeford wrote: Try this way yourself while I fiddle around with your script to figure out why it won't work.
Here is what I did: I opened your Scene1 file for editing and copied the entire text. Then I added a new resource file, gave it the name Scene1a, pasted the text into it, and saved it.
I tested it with your map and it worked fine. Here is the code:
Code: Select all
path = "Maps/SingleMissions/Exiles1/";
function Impaled()
MessageBox(path.."Scene1a.txt");
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", nil );
end;
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "Everstan", "Impaled" );
The question is, why didn't your original work? I don't know. I suspect that the game system somehow couldn't follow the path that the editor was able to follow when I opened the file for editing. This same malfunction happened to me once when I saved the map in a directory other than the H5 Maps directory to make a backup copy, then went back to continue work on the original.
These days, I make a separate folder for my backup copies of a map. And, I get out of the editor and use the Windows right-click and drag method to copy the map file in the H5 Maps directory into my backup directory. I use Windows to change the backup file name to give it a revision number, but leave the original in the H5 map directory alone. For example: resourceWar 01, resourceWar 02, resourceWar 03, and so forth.
If ever I need to use a backup copy (e.g., resourceWar 03), I simply delete the original resourceWar from the H5 Maps directory and copy the backup copy into the H5 Maps directory. Then I use Windows to delete the " 03" from the file name, leaving the .h5m extension alone.
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
Yup, it works that way. You are a real lifesaver sir. Thank you.
Knowing that editor makes special text files is a really useful info. Seems Nival is really trying to make things be more difficult. One thing is certain - I made file "Scene1.txt" in windows notepad, while the working one, just as you said, had to be made in editor.
Knowing that editor makes special text files is a really useful info. Seems Nival is really trying to make things be more difficult. One thing is certain - I made file "Scene1.txt" in windows notepad, while the working one, just as you said, had to be made in editor.
You are welcome. Glad to help.Astenan wrote:Yup, it works that way. You are a real lifesaver sir. Thank you.
Knowing that editor makes special text files is a really useful info. Seems Nival is really trying to make things be more difficult. One thing is certain - I made file "Scene1.txt" in windows notepad, while the working one, just as you said, had to be made in editor.
It is fairly easy to add resource files. My latest map has 134 and counting. After doing about a dozen, it gets routine.
They really aren't trying to make things more difficult; there is a method behind their madness. Having all the text in external files instead of inside the script, makes it much easier to do translation.
I use MS Word to do spell checking on the text files for my map. I open both Word and the M5 editor at the same time. Then I open the resource text file in a H5 edit window, copy the text, paste it into the open Word doc, and do the spell check with Word's spell checker. Then, select all the text in the Word, copy it, then delete the text in the M5 edit window, paste the text into it, then close the M5 edit window and save. It takes me about an hour to spell check the files in a complex map.
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
[quote="rdeford"][quote="Astenan"]Yup, it works that way. You are a real lifesaver sir. Thank you.
Knowing that editor makes special text files is a really useful info. Seems Nival is really trying to make things be more difficult. One thing is certain - I made file "Scene1.txt" in windows notepad, while the working one, just as you said, had to be made in editor.[/quote]
You are welcome. Glad to help.
It is fairly easy to add resource files. My latest map has 134 and counting. After doing about a dozen, it gets routine.
They really aren't trying to make things more difficult; there is a method behind their madness. Having all the text in external files instead of inside the script, makes it much easier to do translation.
I use MS Word to do spell checking on the text files for my map. I open both Word and the M5 editor at the same time. Then I open the resource text file in a H5 edit window, copy the text, paste it into the open Word doc, and do the spell check with Word's spell checker. Then, select all the text in the Word, copy it, then delete the text in the M5 edit window, paste the text into it, then close the M5 edit window and save. It takes me about an hour to spell check the files in a complex map.[/quote]
----------------------
rdeford, Mage Of Soquim
I am attempting to write a script into the Player Castle script tab to provide resources on a given day of the week to Player_1 and the script written reads as follows:
function Time_event()
if(GetDate(DAY_OF_WEEK)==5)then;
GivePlayerResource(PLAYER_1,GOLD,1000);
GivePlayerResource(PLAYER_1,SULFER,10);
end;
When playing the game, the script does not provide the resource to Player_1. Any suggestions of what I am doing wrong.
randsomdl
Knowing that editor makes special text files is a really useful info. Seems Nival is really trying to make things be more difficult. One thing is certain - I made file "Scene1.txt" in windows notepad, while the working one, just as you said, had to be made in editor.[/quote]
You are welcome. Glad to help.
It is fairly easy to add resource files. My latest map has 134 and counting. After doing about a dozen, it gets routine.
They really aren't trying to make things more difficult; there is a method behind their madness. Having all the text in external files instead of inside the script, makes it much easier to do translation.
I use MS Word to do spell checking on the text files for my map. I open both Word and the M5 editor at the same time. Then I open the resource text file in a H5 edit window, copy the text, paste it into the open Word doc, and do the spell check with Word's spell checker. Then, select all the text in the Word, copy it, then delete the text in the M5 edit window, paste the text into it, then close the M5 edit window and save. It takes me about an hour to spell check the files in a complex map.[/quote]
----------------------
rdeford, Mage Of Soquim
I am attempting to write a script into the Player Castle script tab to provide resources on a given day of the week to Player_1 and the script written reads as follows:
function Time_event()
if(GetDate(DAY_OF_WEEK)==5)then;
GivePlayerResource(PLAYER_1,GOLD,1000);
GivePlayerResource(PLAYER_1,SULFER,10);
end;
When playing the game, the script does not provide the resource to Player_1. Any suggestions of what I am doing wrong.
randsomdl
ransomdl
Warlock
Warlock
Who is online
Users browsing this forum: Majestic-12 [Bot] and 0 guests