• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Quick question! +rep to all who helps!

Status
Not open for further replies.

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
I am using this code right here:

JASS:
Custom script: call SetDayNightModels("","")

Now, I have a event where I select a unit. I want to pick all doodads in ~100 range of this unit and do the opposite of Custom script: call SetDayNightModels("","") to the picked doodads. How do I do it? (Needs to be in custom script!)

+rep to all who helps as always.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Yeah, all or none. WC3 doesnt support per-instance lighting (meaning different lighting for units/terrain/etc, only one global lighting field)
 
Here's an idea, just call SetDayNightModels("",""), then, get the initial day/night models (their paths), create a unit and give it one of the models, and place that unit to create different lightings wherever you want.
That's what I did in one of my map WiPs to get destructibles to display at night when the day/night models are null D: (For an inventory system, I used destructables rather than images)
 
If you go inside any war3map.j file (You can extract the file from a map using an MPQ Editor), you should go to the function config (or the function main) at the end of the script.
There, you will find a call to function SetDayNightModels
The first path will be the path of the day model and the second is the one for the night model.
Copy that path, remove the extra slash ("\") and copy the Day model so you can set the model of a dummy unit in the object editor to it.

Now, you can call SetDayNightModels("", "") on map initialization and create that dummy unit wherever and whenever you want to create lighting for an area.

Easy enough? :p
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
That is not my problem. I am currently creating a Amnesia Survival type of game inside Warcraft 3. I have already figured out most of it like light source and movement. The thing which I am stuck on is that when you light a candle up with your lighter, I can't change it from it's night model (which doesn't have the fire) to it's day moday (which has the fire).

What I could do is create 2 units. 1 shown unit that has the night version of the candle and 1 hidden unit at the same position that has the day version of the candle. When you light the candle up, I hide the night model and show the day model. The only problem now is that I don't know how to set a unit's model to the night/day model of another model.

So, if I understood you correctly each model has a day and a night model path. How do I find them for imported objects?
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
I see I need to open the map using that program. Now, isn't there any easier way of getting it?

Isn't there any similarity like this?;

Original: Candle.mdx
Day model: War3/main/glues/day/Candle.mdx
Night model: War3/main/glues/night/Candle.mdx
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Alright I got it! I now know how I am going to do it!

So this is what I want, I am going to import a additional Candle.mdx file. I want to first set ALL models to the night version using
JASS:
Custom script: call SetDayNightModels("","")

Then I want to do the opposite for one of the imported Candle.mdx files. How do I do that with code?
 
Level 2
Joined
Feb 24, 2012
Messages
8
SetDayNightModels is a function that sets the lighting models for day & night. The lighting model is a model that defines "where" the sun is and what kind of light it emits. For example, you could have a day model that has a sun with a bright yellow color, which would make all objects (units, doodads, terrain) in the game look yellowish. You could have a night model that has a sun with a dark blue color, which would make all objects look dark. This is - by the way - how the game simulates "night time" in melee games.

If you set the day/night models to "", you set the models to a path that doesn't exist, which makes warcraft 3 use a default "black", turning the entire map into complete darkness.

The light models are global, meaning that they affect the *entire* map, similarly to how our sun affects the entire planet (or at least half of it). You can however place individual lights on the map (such as the "Torch Glowing" doodad IIRC) which is a "local" light and only lightens nearby models.

I'm not entirely sure what your real goal is, but I'm assuming you want a unit to carry a candle which lightens the surrounding terrain. Here's the "best" way to do this:

1) Download a model that emits light (I can't find one on this site but I know there are a few light models in the Ultimate Terraining map)
2) Create a passive ability in the object editor and set the "Art - Caster" field to the light model (I'm not sure if it's "Art - Caster", it may be one of the other art fields).
3) Add the ability to the unit (or add it to an item which your unit can carry).
4) Your unit should now emit light

If you just want static lights, you can simply create a doodad and set its model to the light model.
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Nope. Thats not what I want.

In the game you are going to be able to light candles up. When I light it up, it still uses the dark model so you can't see the flame abvoe it. This is what I want to fix.

So basically my goal is that when I light a candle up, I create a light source there and change the candle from Night version to Day version. What I alternatively could do is to manually create the flame abvoe it, however this doesn't look as good and there is no flame model which goes as small as I would need.

So, is there any way that I could make an exception for a certain imported model when it comes to DayNightModels or is someone willing to rezise a normal flame model?

Thx.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
theres no such thing as a day/night model for SPECIFIC models... i dont think you understand
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Okay.

I guess the only way to fix this is to get someone to make me a very small fire model. If you have any suggestions on such a fire or such a person feel free to inform me. You have all been rewarded with +rep for your efforts. Thx.
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
i have done this in the past and i created a lighting model which i think might help you out. all i really did is take the torch doodad which has a light node and edit it. i increased the lighting intensity and it now acts as an artificial sun however that is not the correct way of doing it. wc3 places many light nodes at a very small distance apart so you would need to generate a lot of light units otherwise your map lighting will have very dark shadows. if you dont mind that you can just use one big doodad to light your map. I can upload my doodad if you really want to but it would be easier to for you if you edit it in model editor and make it yourself...
 
Status
Not open for further replies.
Top