[H5 EDITOR] Troubleshooting topic
Thanks you for your answers rdeford but i'm sorry, i did not understand.
I understood that I must use "RemoveObject (barrierTrees")".
But I have no idea how to write the script in the sense that if the dragons are dead, trees are removed.
Can you explain in detail so that I understand the logic of writing scripts ?
And nobody can explain how to set up random creatures to be linked to the same faction of the player?
Thank you very much.
I understood that I must use "RemoveObject (barrierTrees")".
But I have no idea how to write the script in the sense that if the dragons are dead, trees are removed.
Can you explain in detail so that I understand the logic of writing scripts ?
And nobody can explain how to set up random creatures to be linked to the same faction of the player?
Thank you very much.
Well, I've investigated to no avail, so I'll repost here.
I have a few custom .ogg files, and desperately need them to play during certain battles in place of the normal old battle music. It doesn't matter how this is accomplished - scripting, a custom arena, whatever it takes. As long as the original music is overrided in these pivotal fights. But I'm out of ideas.
Please help me out with getting this to work - it'd be a real shame if I can't have these custom tracks play during certain fights. They really define the atmosphere in a way the old music can't.
I have a few custom .ogg files, and desperately need them to play during certain battles in place of the normal old battle music. It doesn't matter how this is accomplished - scripting, a custom arena, whatever it takes. As long as the original music is overrided in these pivotal fights. But I'm out of ideas.
Please help me out with getting this to work - it'd be a real shame if I can't have these custom tracks play during certain fights. They really define the atmosphere in a way the old music can't.
Basically, you must write some code that uses conditional expressions to control the timing of the the removal. However, telling you how to do this coding is too big a topic for forum messages. So, if you are really serious about doing it, begin by downloading a copy ofUrostoki wrote:Thanks you for your answers rdeford but i'm sorry, i did not understand.
I understood that I must use "RemoveObject (barrierTrees")".
But I have no idea how to write the script in the sense that if the dragons are dead, trees are removed.
Can you explain in detail so that I understand the logic of writing scripts ?
And nobody can explain how to set up random creatures to be linked to the same faction of the player?
Thank you very much.
The Basics of Heroes V Scripting ver. 2.0 for H5, HOF, & ToTE
from: https://www.celestialheavens.com/567
Then, spend a weekend reading this document. You will find that this guide contains the information on how to do what you desire. However, H5 scripting is a form of computer programming. If you are new to programming, it will be a little difficult to grasp the concepts. Just stick with it. I believe that you can do it, especially if you look at plenty of examples as I describe in the next paragraph.
Next, look at the scripting in maps written by others. Good authors to look at are, Grumpy Old Wizard, Franzy, me, and several others. One approach is to play a few scripted maps until you find one that does some conditional event control that is similar to what you wish to do, then go look into the script and see how it was done.
For example, the example I gave you my previous message came from my own working map, The Virgin of Ponce I. Look at the script for this map after you have read the Guide, and you will see how I controlled the timing of the tree removal with a few IF statements.
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
@ rdeford
Well you're right, I am a beginner in programming. And scripting in H5 is Chinese for me (I already have difficulty with English, so the Chinese ....).
I'll try to understand by looking at maps, but I fear that I am quickly discouraged. My goal was to convert the map Powerspot of H4, and it has a lot of script, including the creatures associated with the faction of the player.
Finally, I express the wish that if there is an upcoming Heroes, as it is seen to get a map editor like the H4. Because it makes no sense that the players must have 2 years of programming study to successfully develop complex maps.
In any case, Franzy and rdeford, I want to thank you and "Bonne continuation" in French.
Well you're right, I am a beginner in programming. And scripting in H5 is Chinese for me (I already have difficulty with English, so the Chinese ....).
I'll try to understand by looking at maps, but I fear that I am quickly discouraged. My goal was to convert the map Powerspot of H4, and it has a lot of script, including the creatures associated with the faction of the player.
Finally, I express the wish that if there is an upcoming Heroes, as it is seen to get a map editor like the H4. Because it makes no sense that the players must have 2 years of programming study to successfully develop complex maps.
In any case, Franzy and rdeford, I want to thank you and "Bonne continuation" in French.
You are not the only only one to express this wish. Let us hope that The Gods Of Commerce are listening to the multitudes and there will be a H6 and that its editor will be all you desire. H5 was a commercial success, but I believe that it would have been at least five times that success if the editor had allowed all the good players out there to easily create the good fan-made maps that have made the previous HOMM versions endure for all these years. Ubisoft just didn't understand the role that the editor played in the franchise's success.Urostoki wrote: .... Finally, I express the wish that if there is an upcoming Heroes, as it is seen to get a map editor like the H4. Because it makes no sense that the players must have 2 years of programming study to successfully develop complex maps.
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
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
Language
What language does the script editor follow? While prowling around, I thought I stumbled on that answer, but can not find it again.
I've tried some code, but haven't gotten all the syntax correct in my tries.
I've tried some code, but haven't gotten all the syntax correct in my tries.
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
Is there a way to list the names of all the towns of a map in the cheat console?alavris wrote:I can try. Firstly open object properties tree (of the town which will be captured). To do this, mark by the cursor the town on the map. When it's red, press CTRL+SPACE. Now, add name of the town in this tree. It's important to do it here, because done in town properties window will not work. Now in map properties window paste the example code:Bandobras Took wrote:Hmmm . . . can someone provide an example of a function that works when capturing a town so I can compare?Pitsu wrote: Should work. I would double check that the "TestScript" function itself is correct. And the syntax everywhere...
It's all simple, but the trap is when we have to name the town. Remember to do it in right place.Code: Select all
function fun1() MessageBox("Maps/Multiplayer/Alavris 1/wiad1.txt"); end; Trigger(OBJECT_CAPTURE_TRIGGER, "TestTown", "fun1");
.
Re: Language
The language is LUA.bkknight2602 wrote:What language does the script editor follow? While prowling around, I thought I stumbled on that answer, but can not find it again.
I've tried some code, but haven't gotten all the syntax correct in my tries.
Go to: https://www.celestialheavens.com/567
Download this guide to learn the syntax:
The Basics of Heroes V Scripting ver. 2.01 for H5, HOF, & ToTE
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
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
On a test map there is a necro town to capture. The name of the town was town1 in two places the name and the NameFileRef. After capture there was an error in the console:
last token read: 'transform' at line 1 in string "DoScript scripts"
Any suggestions?
Function transform(townname)
TransformTown(townname, TOWN_HEAVEN);
end;
Function town1capture()
transform("town1");
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "town1", "town1capture");
last token read: 'transform' at line 1 in string "DoScript scripts"
Any suggestions?
Function transform(townname)
TransformTown(townname, TOWN_HEAVEN);
end;
Function town1capture()
transform("town1");
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "town1", "town1capture");
@ kbknight2602
I haven't worked with the H5 editor and scripting for a couple of years, but, as I recall, the name of any object you are going to refer to in your scripts has to be a "script name." Open the object panel to see a list of object properties in the editor and select the town. Among the properties displayed for the town, I believe that there is a field for Name and the name (town1) goes there. If you've already done this, then I am not sure what to do now. There are topics in the CH forum for the H5 editor and the transform function has been discussed a lot.
I haven't worked with the H5 editor and scripting for a couple of years, but, as I recall, the name of any object you are going to refer to in your scripts has to be a "script name." Open the object panel to see a list of object properties in the editor and select the town. Among the properties displayed for the town, I believe that there is a field for Name and the name (town1) goes there. If you've already done this, then I am not sure what to do now. There are topics in the CH forum for the H5 editor and the transform function has been discussed a lot.
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
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
OK -- I just took a look at the Scripting Guide and some of my notes from the old days. The problem with your code, I THINK, is that the TransformTown() function takes a numeric value the town type argument. Here is example code from the Scripting Guide:
-- townname and towntype are both variables. The value of the first is defined when the function is called up. The value of the second was set to 5 right before.
As far as I know, the list below gives the valid numeric values for the town type.
@TransformTown("Town",0) - invalid town type #0
@TransformTown("Town",1) - invalid town type #1
@TransformTown("Town",2) - invalid town type #2
@TransformTown("Town",3) ->Haven
@TransformTown("Town",4) ->Sylvan
@TransformTown("Town",5) ->Academy
@TransformTown("Town",6) ->Dungeon
@TransformTown("Town",7) ->Necropolis
@TransformTown("Town",8) ->Inferno
@TransformTown("Town",9) ->Fortress
The weird format for this list is because I originally copied it from a game file. As you can see, the value of 5 used in the example results in transforming the town into an Academy.
I have not fired up the editor and tested any of this, but I think it will help you.
Code: Select all
function transform(townname)
local towntype = 5;
TransformTown(townname, towntype);
end;
As far as I know, the list below gives the valid numeric values for the town type.
@TransformTown("Town",0) - invalid town type #0
@TransformTown("Town",1) - invalid town type #1
@TransformTown("Town",2) - invalid town type #2
@TransformTown("Town",3) ->Haven
@TransformTown("Town",4) ->Sylvan
@TransformTown("Town",5) ->Academy
@TransformTown("Town",6) ->Dungeon
@TransformTown("Town",7) ->Necropolis
@TransformTown("Town",8) ->Inferno
@TransformTown("Town",9) ->Fortress
The weird format for this list is because I originally copied it from a game file. As you can see, the value of 5 used in the example results in transforming the town into an Academy.
I have not fired up the editor and tested any of this, but I think it will help you.
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
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
Tried that, but got an error message in the console:
Script error "=" expected
last token read line 1 in string "DoScript script"
Line 1 being:
Function transform(townname)
Also inserted town1capture in the capture script box.
I'm, going to try Function transform() and put townname=="town1") in the town1capture function. May not work but anything is worth a try at this point.
Script error "=" expected
last token read line 1 in string "DoScript script"
Line 1 being:
Function transform(townname)
Also inserted town1capture in the capture script box.
I'm, going to try Function transform() and put townname=="town1") in the town1capture function. May not work but anything is worth a try at this point.
-
- Pixie
- Posts: 100
- Joined: 23 May 2010
- Location: Texas
The coe should look like this:
P.S. NameFileRef field is an obsolete one, no need to fill it ever.
Code: Select all
function town1capture(townname)
TransformTown(townname, TOWN_HEAVEN);
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "town1", "town1capture");
bkknight2602 wrote:On a test map there is a necro town to capture. The name of the town was town1 in two places the name and the NameFileRef. After capture there was an error in the console:
last token read: 'transform' at line 1 in string "DoScript scripts"
Any suggestions?
Function transform(townname)
TransformTown(townname, TOWN_HEAVEN);
end;
Function town1capture()
transform("town1");
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "town1", "town1capture");
I am new to the forum, and new to forums in general. I have recently took to scripting and finding it fun and challenging. I am hoping to get some help with a function by which a random encounter is generated. I am having trouble because i cannot seem to find a way to add a variable inside a "for i = 1,(random) do" statement. Something about not being able to index a number?
The idea is, i can get from 2 - 5 different creatures of random type, with random numbers for each group. I gave up on trying to have this sort of encounter triggered in multiple regions. I don't know how to assign a trigger in such a way. However, I have succeeded in getting this idea done through very, very long, repeating functions (some 360 lines).
Trying to be short has made this a long post. Here is a little piece that will show better what i mean:
function thingone()
witchwood();
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing1","thingone")
function thingtwo()
witchwood();
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing2","thingtwo")
this goes on to cover a total of 15 'things'
These trigger this (among other things):
function witchwood()
if GetCurrentPlayer() == PLAYER_1 then
heroesInRegion = GetObjectsInRegion("WitchWood", OBJECT_HERO);
hh = heroesInRegion[0];
local b = random(12) + 1;
if b <= 2 then
local ran = random(2) + 1;
local g1 = random(10) + 10;
local g2 = random(10) + 10;
local g3 = random(10) + 10;
ShowFlyingSign("bla",hh, 1, 3);
sleep(8);
StartCombat(hh,nil,3,43,(ran*g1),44,(ran*g2),145,(ran*g3),nil,"");
else if b == 3 then
and so on. Where creatures are 43, 44, etc. i would rather a variable. Also, where there are 3 set groups, i would rather a variable (2 -5).
I have many other questions, but this is the one that got me to sign up on these forums. Thanks for your time in advance.
The idea is, i can get from 2 - 5 different creatures of random type, with random numbers for each group. I gave up on trying to have this sort of encounter triggered in multiple regions. I don't know how to assign a trigger in such a way. However, I have succeeded in getting this idea done through very, very long, repeating functions (some 360 lines).
Trying to be short has made this a long post. Here is a little piece that will show better what i mean:
function thingone()
witchwood();
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing1","thingone")
function thingtwo()
witchwood();
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing2","thingtwo")
this goes on to cover a total of 15 'things'
These trigger this (among other things):
function witchwood()
if GetCurrentPlayer() == PLAYER_1 then
heroesInRegion = GetObjectsInRegion("WitchWood", OBJECT_HERO);
hh = heroesInRegion[0];
local b = random(12) + 1;
if b <= 2 then
local ran = random(2) + 1;
local g1 = random(10) + 10;
local g2 = random(10) + 10;
local g3 = random(10) + 10;
ShowFlyingSign("bla",hh, 1, 3);
sleep(8);
StartCombat(hh,nil,3,43,(ran*g1),44,(ran*g2),145,(ran*g3),nil,"");
else if b == 3 then
and so on. Where creatures are 43, 44, etc. i would rather a variable. Also, where there are 3 set groups, i would rather a variable (2 -5).
I have many other questions, but this is the one that got me to sign up on these forums. Thanks for your time in advance.
Err, why don't you first randomize number of stacks, thand start a cycle to create appropriate number of troops for each stack?
Also, no need to use GetObjectsInRegion. You can pass heroname as a parameter for OBJECT_TOUCH_TRIGGER hadler. Like this:
function thingone(hh,obj)
--hh holds hero name touching the object, obj - object name.
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing1","thingone")
Also, no need to use GetObjectsInRegion. You can pass heroname as a parameter for OBJECT_TOUCH_TRIGGER hadler. Like this:
function thingone(hh,obj)
--hh holds hero name touching the object, obj - object name.
end;
Trigger(OBJECT_TOUCH_TRIGGER,"thing1","thingone")
I am not completely sure i understand. The touch trigger i use is for 15 different named objects within the region. treasure, bones, witch huts, etc.
An encounter happens randomly when any of those items is touched, or the region is entered, or whenever a new day dawns with a hero is inside the region.
If an encounter is created, then I need to come up with all the random elements that define it specificly. They are not named stacks present on the map at all. So, i came up with several functions that handle different aspects of the encounter. One for the main order of events, five seperate long winded functions for the five possible groups, another that starts the combat. I would show what im doing but I dont know how i could, with such a massive series of functions.
I could cut down on the script by hundreds of lines if i knew more, i think.
An encounter happens randomly when any of those items is touched, or the region is entered, or whenever a new day dawns with a hero is inside the region.
If an encounter is created, then I need to come up with all the random elements that define it specificly. They are not named stacks present on the map at all. So, i came up with several functions that handle different aspects of the encounter. One for the main order of events, five seperate long winded functions for the five possible groups, another that starts the combat. I would show what im doing but I dont know how i could, with such a massive series of functions.
I could cut down on the script by hundreds of lines if i knew more, i think.
I have another question. How can I obtain a list of special effects and sound effects? The two special effects and one sound effect that I have I got from reading this board. If it is in one of the .pak files, what do I need to have in order to open those files?
Hoping I can get some help on my previous question. I know there are some awesome script writers out there who would find my problem childs play. The things I've seen posted here are so complex, I get lost in them.
Hoping I can get some help on my previous question. I know there are some awesome script writers out there who would find my problem childs play. The things I've seen posted here are so complex, I get lost in them.
Who is online
Users browsing this forum: No registered users and 3 guests