|
Thread: Scripting Help Pease! | |
|
SoupMaestro
Tavern Dweller
|
posted September 13, 2024 06:02 PM |
|
|
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
|
|
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);
____________
|
|
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?
|
|
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.
|
|
|
|