Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Scripting Help Pease!
Thread: Scripting Help Pease!
SoupMaestro
SoupMaestro

Tavern Dweller
posted September 13, 2024 06:02 PM
Edited by SoupMaestro at 18:06, 13 Sep 2024.

Scripting Help Pease!

Hello. I am very new to the scripter, and scripting in general. I am trying to make it so every day, it switches from day to night using the SetAmbientLight function, but I can't even get the function to work on its own.
I have read other threads, and it seems that you have to have some ambient lights defined in the map properties tree, so I added a night and a day ambient light in the overground part of the ambient lights in the properties tree, but it didn't help.

-Here is what I have as my function, but it just wont switch the light in game


SetAmbientLight(0,"/Lights/_(AmbientLight)/Town/Day_light_Haven01.xdb#xpointer(/AmbientLight)",false,1)


-
I don't know if I'm calling it wrong, or it is a problem with the map properties tree. If anyone knows how this function works, please help!
BTW, this is the HOMMV editor. I meant to send this to that forum but got kinda lost... sorry

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
EvilP
EvilP


Promising
Known Hero
posted September 14, 2024 03:38 AM
Edited by EvilP at 03:41, 14 Sep 2024.

It looks like you need require the Ambient Light file and define it first
We can find a example in data.pak/Maps/Scenario/A2C1M5/

map.xdb
<GroundAmbientLights>
<Item href="/Lights/_(AmbientLight)/0_Default_AmbientLight.xdb#xpointer(/AmbientLight)"/>
<Item href="Daylight.xdb#xpointer(/AmbientLight)"/>
</GroundAmbientLights>

Daylight.xdb
<?xml version="1.0" encoding="UTF-8"?>
<AmbientLight>
<InternalName>Daylight</InternalName>
<Name>Daylight</Name>
<NameFileRef href=""/>
...........

data.pak/Lights/_(AmbientLight)/0_Default_AmbientLight.xdb
<?xml version="1.0" encoding="UTF-8"?>
<AmbientLight ObjectRecordID="1000008">
<InternalName>Default</InternalName>
<Name/>
..............

MapScript.lua
SetAmbientLight(0, "Default", true, 1);

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SoupMaestro
SoupMaestro

Tavern Dweller
posted September 16, 2024 04:10 AM

Okay, Thanks for the reply, but if you can, I have a few clarification questions.

-Are the .xdb things part of the editor? (map.xdb being the map properties tree)
-If the answer to the first question is yes, where is Daylight.xdb? In the map properties tree, I couldn't get more specific than the ambient light.
-How would I find the example in "data.pak/Maps/Scenario/A2C1M5/"? is it in the game files somewhere where I can bring it to the editor?
-How do you "define the Ambient Light File"? Is this too in the map properties? -Also, does "defining" mean just give it a substitute name for the map script? ("Default" or "Daylight") or is there some step I am missing?


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
EvilP
EvilP


Promising
Known Hero
posted September 16, 2024 12:58 PM
Edited by EvilP at 13:00, 16 Sep 2024.

SoupMaestro said:
Okay, Thanks for the reply, but if you can, I have a few clarification questions.




http://www.heroesofmightandmagic.com/heroes5/modding_wiki/modding_for_dummies:introduction

Most of heroes 5 data files (.pak, h5m, h5u) are zip file.
You can simply open them using unzip software like 7-zip
And the .xdb file is actually an xml file, you can edit it with any text editor.
map.xdb is the main file of the h5m map.
So, sometimes you can (use 7-zip) extract the file from the .h5m file, edit it and then pack the files back.


Quote:
-Are the .xdb things part of the editor? (map.xdb being the map properties tree)

1. I don't know how set a ambient light list in map editor
(But you can create and customize a new ambient light in mapeditor)
So I choose do it manually
extract the map.xdb, open it with text editor, search GroundAmbientLights
format of this xml tag is in last reply
edit it, save it, pack the files back.

Quote:
-If the answer to the first question is yes, where is Daylight.xdb? In the map properties tree, I couldn't get more specific than the ambient light.

2. If you only need some light file already in game data (which is in data.pak/Lights/_(AmbientLight)/)
require/link it like
<Item href="/Lights/_(AmbientLight)/0_Default_AmbientLight.xdb#xpointer(/AmbientLight)"/>
if it's a customize light file will be
<Item href="Daylight.xdb#xpointer(/AmbientLight)"/>
(Daylight.xdb is in same folder as map.xdb)

Quote:
-How would I find the example in "data.pak/Maps/Scenario/A2C1M5/"? is it in the game files somewhere where I can bring it to the editor?

3.you need learn some mod theories, link above

Quote:
-How do you "define the Ambient Light File"? Is this too in the map properties? -Also, does "defining" mean just give it a substitute name for the map script? ("Default" or "Daylight") or is there some step I am missing?

4. If you require/link (/Lights/_(AmbientLight)/0_Default_AmbientLight.xdb), InternalName(which is "Default") is already defined by nival
If you use some other light file, you need open the file, check out is the InternalName xml tag filled, if not do it by yourself, you need this name in lua script.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0388 seconds