• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Light blocking

Status
Not open for further replies.
Level 2
Joined
Aug 27, 2012
Messages
18
Hi, I have some light problems in my map. I can't find good solution, I tried a lot of things.

My map is built from blocks. Miner can destroy them. I want to give him small sight radius. He should see only blocks near him.


famvq9.png


Player see all doodads on map. Even if he has tiny sight radius.


Solution no. 1: Night models

2zoisn5.png


I attached a light to his chest. But it shines through walls! :O

34ye2jd.png


My walls don't block light :/
They're destructibles. They have fat line of sight (it prevents from selecting further blocks). I also set high Occlusion height.

Is any other solution? Player shouldn't see what is behind block!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Make your block block the line of sight? It's the only solution I can think off.

Actually, it doesn't shine through walls, It shines through the small gap between the two block corners.
 
Level 2
Joined
Aug 27, 2012
Messages
18
I have over 6k blocks. I think attaching each block an invisible tree will cause lag...
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It wont :) it will just take about 1 more seg for the map to load, and since the tree is invisible/dummy, there's no graphic involved.
 
Level 2
Joined
Aug 27, 2012
Messages
18
Okay, but how to do this? I created invisible tree object. How to attach it - just create it at the same point as block? And what about destroying? How to destroy proper tree?
 
Level 10
Joined
May 8, 2009
Messages
259
Okay, but how to do this? I created invisible tree object. How to attach it - just create it at the same point as block? And what about destroying? How to destroy proper tree?

To destroy the proper tree you'll have use a Hashtable. Are you familiar with that?
Here is the trigger you need in case your not: Trees&Blocks
 
Last edited:
Level 2
Joined
Aug 27, 2012
Messages
18
Nope, I'm not. And I heard, there are some problems with hashtables in Jass NewGen.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Newgen doesn't have the GUI options for save/load item keys, you have to use the JASS script.

JASS:
call SaveInteger(Hashtable, ParentInt, ChildInt, value)
call LoadInteger(Hashtable, ParentInt, ChildInt)

call SaveUnitHandle(Hashtable, ParentInt, ChildInt, unit)
call LoadUnitHandle(Hashtable, ParentInt, ChildInt)

call SaveReal(Hashtable, ParentInt, ChildInt, value)
call LoadReal(Hashtable, ParentInt, ChildInt)

call SaveBoolean(Hashtable, ParentInt, ChildInt, value)
call LoadBoolean(Hashtable, ParentInt, ChildInt)

//and so on...
 
Level 2
Joined
Aug 27, 2012
Messages
18
My bad there was a "c" missing in the
custom script: call RemoveLocation (udg_Point)

there it is fixed TreesNBlocks

Still doesn't work. When I click 'Test' it runs main menu of W3. When I try to test it in game, I select it but it shows no players.


EDIT: Ok, it works, you didn't fix anything :p. I will check it and ask a question if something will be not clear.


There's still the same problem. Look:
156fg61.png

But I think it's darker :p

I use these lights http://www.hiveworkshop.com/forums/1139380-post2.html
 
Last edited:
Status
Not open for further replies.
Top