|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted June 19, 2017 10:03 PM |
|
|
SetObjectPosition(AllHeroes[1], HeroPos[1][Race[1]][1], HeroPos[1][Race[1]][2], 0)
The last parameter is the floor designator. 0 indicates the top floor. If you want to specify a position on the underground use 1.
The pre-defined H5 script commands that are available for your use are defined in the HOMM5_A2_Script_Functions.pdf, which is located in: Program Files/UbisoftHeroes of Might and Magic V - Tribes of the East/Editor Documentation .
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted June 20, 2017 09:14 AM |
|
Edited by Elvin at 21:49, 23 Jun 2017.
|
Exactly what I wanted! Thank you
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted June 30, 2017 09:08 AM |
|
Edited by Elvin at 09:46, 30 Jun 2017.
|
Another question:
How could I make the ChangeHeroStat script trigger on visiting an adventure map location? I would like to set a condition check like the following:
if ObjectExists (“Aberrar”) then
ChangeHeroStat (“Aberrar”, STAT_DEFENCE,1);
end;
How should this look if I wanted the script to trigger when the hero visits a specific location like a sphinx?
Alternatively, would it be possible to change all 4 attributes with one quest?
Any help appreciated!
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted June 30, 2017 06:38 PM |
bonus applied by Galaad on 28 Aug 2017. |
|
I wrote a script for a map with exactly this feature (see below). The map is called EE's Middle Earth_PRT.h5m. Check it out if you wish to examine the original script with proper indenting (the HC editor is rather bare-bones).
To make it work you have to give the adventure map objects a name/ID in the map editor. There is an illustrated example for this in Program Files/UbisoftHeroes of Might and Magic V - Tribes of the East/Editor Documentation.
Surely, you can have as many instructions as you like between the if-then ... end/else.
Here is the script:
Quote:
path = GetMapDataPath() ;
bEnhancedChallengeTaken = 0 ;
heroChallenged = nil ;
SetObjectEnabled( "EnhancedChallengeSeer", false );
SetObjectEnabled( "EnhancedChallengeSeer2", false );
SetObjectEnabled( "EnhancedChallengeSeer3", false );
Trigger( OBJECT_TOUCH_TRIGGER, "EnhancedChallengeSeer", "funcEnhancedChallenge" );
Trigger( OBJECT_TOUCH_TRIGGER, "EnhancedChallengeSeer2", "funcEnhancedChallenge" );
Trigger( OBJECT_TOUCH_TRIGGER, "EnhancedChallengeSeer3", "funcEnhancedChallenge" );
function funcEnhancedChallenge( heroName )
if bEnhancedChallengeTaken > 0 or GetDate() > 7 then
SetObjectEnabled( "EnhancedChallengeSeer", not nil );
SetObjectEnabled( "EnhancedChallengeSeer2", not nil );
SetObjectEnabled( "EnhancedChallengeSeer3", not nil );
else
heroChallenged = heroName ;
MessageBox( path.."EnhancedChallengeDesc.txt" );
QuestionBox( path.."EnhancedChallengeShortMsg.txt", "funcChallengeAccepted", "funcChallengeRefused" );
end ;
end;
function funcChallengeAccepted()
GiveArtefact( heroChallenged, ARTIFACT_DWARVEN_MITHRAL_CUIRASS );
GiveArtefact( heroChallenged, ARTIFACT_DWARVEN_MITHRAL_HELMET );
-- RemoveObject( "IsengardGate" );
bEnhancedChallengeTaken = 1 ;
GiveBorderguardKey( PLAYER_4, RED_KEY );
GiveBorderguardKey( GetObjectOwner(heroChallenged), RED_KEY );
end ;
function funcChallengeRefused()
end ;
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted June 30, 2017 08:18 PM |
|
|
Great. Do you have a link of the map? I searched a bit but didn't manage to find it.
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 01, 2017 06:01 PM |
|
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted July 01, 2017 10:03 PM |
|
Edited by Elvin at 22:16, 01 Jul 2017.
|
So in the above, EnhancedChallengeSeer1/2/3 are the objects and EnhancedChallenge the name of the quest. If the quest is not taken, the objects activate.
If I wanted to enable one object(aca1) with a trigger touch quest(ChangeHeroStat1) for any hero that visits it, would the following be correct? Or rather, what am I getting wrong?
Quote:
path = GetMapDataPath() ;
bChangeHeroStat1Taken = 0 ;
SetObjectEnabled( "aca1", false );
Trigger( OBJECT_TOUCH_TRIGGER, "aca1", "funcChangeHeroStat1" );
function funcChangeHeroStat1( heroName )
if bChangeHeroStat1Taken > 0 then
SetObjectEnabled( "aca1", not nil );
end;
function funcChangeHeroStat1()
ChangeHeroStat("heroName", STAT_ATTACK, 6)
ChangeHeroStat("heroName", STAT_DEFENSE, 8)
ChangeHeroStat("heroName", STAT_SPELLPOWER, 6)
ChangeHeroStat("heroName", STAT_KNOWLEDGE, 6)
end ;
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 01, 2017 11:32 PM |
|
|
First, you need to read the documentation of SetObjectEnabled(), this clarifies what the second parameter does to enable the trigger function.
ALWAYS read the documentation. Pay close attention to the parameters, do not add apostrophe (") if that is not required. CH has good documentation for scripting H5: http://celestialheavens.com/homm5/manuals/CH_H5_scripting2.01.zip
Second, if you have two functions, give each a unique name.
You can't use the parameter heroName simply so in the second function. Parameters are scoped, that is parameters supplied to a function are only valid in the function body (until the end).
Look at the handling of the parameter heroname and bEnhancedChallengeTaken in the provided script. It's handled minimally, so everything is necessary. You cannot leave this out, if you expect your script to work. Don't try to be more clever than the pros.
|
|
dredknight
Honorable
Supreme Hero
disrupting the moding industry
|
posted July 01, 2017 11:51 PM |
|
|
I got a question as well.
Is there a way to force a creature behavior for NPC units? I don't mean like combat scripts (because they are not possible in multiplayer) but just a general behavior.
For example - if I make a NCF mage with 10-15 spells can I tell him when he is in combat to focus on spell casting instead of shooting. Is there a way to tell the creature at what order to cast the spells?
Same goes for the melee/ranged unit focus fire or defensive maneuvers.
____________
Join our official discord channel | NCF Utility Beta
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 02, 2017 11:43 AM |
|
|
@Elvin
If you just want a simple trigger, without dialog checks and flatly working repeatedly for any hero visiting, you can simply write:
Quote:
SetObjectEnabled( "aca1", false );
Trigger( OBJECT_TOUCH_TRIGGER, "aca1", "ChangeHeroStat1" );
function ChangeHeroStat1( heroName )
ChangeHeroStat( heroName, STAT_ATTACK, 6);
ChangeHeroStat( heroName, STAT_DEFENSE, 8);
ChangeHeroStat( heroName, STAT_SPELLPOWER, 6);
ChangeHeroStat( heroName, STAT_KNOWLEDGE, 6);
end ;
But for most practical purposes, you don't want heroes to gain such benefits repeatedly.
Quote:
SetObjectEnabled( "aca1", false );
Trigger( OBJECT_TOUCH_TRIGGER, "aca1", "ChangeHeroStat1" );
function ChangeHeroStat1( heroName )
ChangeHeroStat( heroName, STAT_ATTACK, 6);
ChangeHeroStat( heroName, STAT_DEFENSE, 8);
ChangeHeroStat( heroName, STAT_SPELLPOWER, 6);
ChangeHeroStat( heroName, STAT_KNOWLEDGE, 6);
SetObjectEnabled( "aca1", true );
end ;
This gives the stat boost only to the first hero visiting.
@dredknight
Technically, that would be a combat script that sets the desired behaviour, or alternatively a property that could be set. I have not seen anything that indicates that this had been implemented.
|
|
dredknight
Honorable
Supreme Hero
disrupting the moding industry
|
posted July 02, 2017 12:08 PM |
|
|
Quantomas said:
@dredknight
Technically, that would be a combat script that sets the desired behaviour, or alternatively a property that could be set. I have not seen anything that indicates that this had been implemented.
I see. Then what module makes the NPC creatures act in battle?
Is this a harcodded thing and can it be changed?
____________
Join our official discord channel | NCF Utility Beta
|
|
Hizsoo
Tavern Dweller
|
posted July 02, 2017 05:18 PM |
|
Edited by Hizsoo at 17:20, 02 Jul 2017.
|
Is there a way to force most action in combat to be shown with close camera? For the purpose of recording a special footage.
|
|
dredknight
Honorable
Supreme Hero
disrupting the moding industry
|
posted July 02, 2017 07:29 PM |
|
|
Quantomas,
Forget about my last question I believe it is the same dead end.
I believe your knowledge can help answering this question that regards heroes V xml parser. I want to decouple the defaultstats.xdb file into a a few smaller ones which will allow easier integration between NCF and MMH55 mod.
____________
Join our official discord channel | NCF Utility Beta
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 03, 2017 06:26 PM |
|
|
Surely the combat AI involves much more than targeting and positioning to be worthwhile. You can't create a worthy heroes combat experience with scripts and properties alone. It would be flat and easily exploitable.
You can break the .xdb files into parts. As far as I know all .xdb files in that folder are read in at start up in the order of the file time stamp. Newer ones override older ones.
But you know my stance on NCF. It will only be feasible if the modders can create new creatures and animations with a proper tool like Blender. Something like that can happen for our own game, and if it is simple enough it might be backported to H5.
|
|
dredknight
Honorable
Supreme Hero
disrupting the moding industry
|
posted July 03, 2017 11:25 PM |
|
|
Quantomas said:
You can break the .xdb files into parts. As far as I know all .xdb files in that folder are read in at start up in the order of the file time stamp. Newer ones override older ones.
Timestamp thing is clear but the "read all files in the folder" is new.
This means if I create a file called "random_stats.xdb" and put it in defaulstats.xdb folder it will be read as well?
Even if it works I do not understand how the separation will happen because all stats are under one chain here is an example.
The whole data in default stats resides between
<RPGStats ObjectRecordID="1"> and </RPGStats>
How it is supposed to take <TransformTable> and all inside it and put it in a separate file when it is locked under the following chain in default stats:
<RPGStats ObjectRecordID="1">
<combat>
<HeroSkills>
<Necromancer>
<Necromancy>
<TransformTable>
</TransformTable>
</Necromancy>
</Necromancer>
</HeroSkills>
</combat>
</RPGStats>
I made the same chain in the new file but it does not work.
Quantomas said:
But you know my stance on NCF. It will only be feasible if the modders can create new creatures and animations with a proper tool like Blender. Something like that can happen for our own game, and if it is simple enough it might be backported to H5.
3D modders are very rare creatures here.
On the Russian sites the things are a bit better they are pushing originality as far as they can but I believe they are also restricted by existing animations.
Besides the well known member Psatka, a 3D editor with the same level of skill is LordKhorne. He made the Sanctuary mod and the Chaos theory mod.
____________
Join our official discord channel | NCF Utility Beta
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 04, 2017 05:06 PM |
|
|
dredknight said: Timestamp thing is clear but the "read all files in the folder" is new.
This means if I create a file called "random_stats.xdb" and put it in defaulstats.xdb folder it will be read as well?
It's technically standard XML. If I remember correctly, reading the XML is delegated to a standard XML module. So it should support all common XML features, and I would be surprised if XML didn't include a mechanism to refer to other files. I have no time to experiment with it though. That's all I can offer on this feature. There is plenty of documentation around for XML.
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted July 05, 2017 01:09 AM |
|
|
Thanks again.
And now for something completely different! How could I tweak this efreet mod to replace the unupgraded djinn? Original mod replaces the pit spawn.
I do not care about the abilities and texts, just the model, particles and animations.
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
dredknight
Honorable
Supreme Hero
disrupting the moding industry
|
posted July 05, 2017 10:31 AM |
|
|
|
Quantomas
Responsible
Famous Hero
AI Wizard
|
posted July 05, 2017 07:14 PM |
|
|
Just to make it clear, XML has plenty of techniques to split definitions into parts.
|
|
Elvin
Admirable
Omnipresent Hero
Endless Revival
|
posted July 06, 2017 07:06 PM |
|
|
Fantastic
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb
|
|
|