• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] How to set up my a custom math in JASS?

Status
Not open for further replies.
Level 2
Joined
Jun 12, 2016
Messages
11
(Before I jump into this issue, let me talk to some my Personality Issue to you who read this thread.

Unfortunately, I'm Non-English person and my English grammar looks like may be terrible. So please excuse my ridiculously sentence.)


Offset Isuee.png


Hi.

As you can see I genuinely using 'Slopes' and 'Smoothies' without any kind of 'Cliffs' when I shape my terrains and this method has, in my mind, a more than better way when I make some realistic terrains.

But a main problem is when The Ground Units stand on the picture like that, He CAN see a uphill and downhill at the same time.

I wanna make that The Ground Units have a same visions(sights, or offsets etc.) when they facing the real Cliffs.

So, have been thinking about many ways for solve this problem I chose to input an Advanced Offset Library in a map with my custom math like the other libraries and AOL is kinda like this:

Cliff.png
Pythagorath.png


- If ∠CAB has more than 60°, The Ground Units which are standing on the point of A cannot see any types of Units on the point of C.



For now I'm trying many way to make this system but it keeps to showing some error message.

Which part has need to change?


JASS:
struct math
public real x1
public real y1
public real x2
public real y2

public static method create takes nothing returns math
local math this = math.allocate()
set this.x1 = 0.
set this.y1 = 0.
set this.x2 = 0.
set this.y2 = 0.
return this
endmethod

public method angle takes nothing returns math
return bj_RADTODEG*Atan2(this.y2-this.y1, this.x2-this.x1)
endmethod
endstruct

*I'm sorry to you guys from this long-pointless massive thread. =[ and thank you to read this.
 
Last edited:
Level 2
Joined
Jun 12, 2016
Messages
11
What error messages are you getting?

I once coded a system that does what you are trying to do. I used visibility modifier regions.
Thanks to reply Maker.

I wanna show you what kind of errors do I have but it's midnight in my area and I shutted down my pc. I will post on this thread tomorrow as fast as I can. ;)

Errors.png



Time to update. I got this error. And still don't know which part has need to change it.
 
Last edited:
Level 2
Joined
Jun 12, 2016
Messages
11
Change the returns math to returns real, like so:
JASS:
public method angle takes nothing returns real
    return bj_RADTODEG*Atan2(this.y2-this.y1, this.x2-this.x1)
endmethod

I'll try to look at the rest of the thread later, but that fix should get you started/able to play around with things.

Well, This is start for me, It doesn't matter this is actually not help for me.

Anyway Thanks to fix my issue.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
I think the problem you're going to find is that units can't have non-circular vision. If a unit has vision range X then you can see X distance in every direction, and its impossible to reduce X only in certain directions.

The only way I see around this is creating a line of invisible vision-blocking doodads (I think there's a sight blocker in the palette with parking blockers) on the ridge of your terrain. If units are past it they would have full vision of the top but if they aren't past then they can only see to the level of the blockers. Not elegant, not dynamic, and it won't gradually show more of the top as units get closer.

You could also try locally creating vision blocking doodad (they'd have to be destructibles actually to be dynamically created) lines for each player based on where they can see every 0.50 seconds or something. And update it to show vision as necessary.

You could also make all units have vision range of 1 and then trigger all player vision through invisible flying dummy units and something like BonusMod to set sight ranges.

In short this is not an easy problem to solve as far as I know.
 
Level 2
Joined
Sep 8, 2016
Messages
16
I think the problem you're going to find is that units can't have non-circular vision. If a unit has vision range X then you can see X distance in every direction, and its impossible to reduce X only in certain directions.

The only way I see around this is creating a line of invisible vision-blocking doodads (I think there's a sight blocker in the palette with parking blockers) on the ridge of your terrain. If units are past it they would have full vision of the top but if they aren't past then they can only see to the level of the blockers. Not elegant, not dynamic, and it won't gradually show more of the top as units get closer.

You could also try locally creating vision blocking doodad (they'd have to be destructibles actually to be dynamically created) lines for each player based on where they can see every 0.50 seconds or something. And update it to show vision as necessary.

You could also make all units have vision range of 1 and then trigger all player vision through invisible flying dummy units and something like BonusMod to set sight ranges.

In short this is not an easy problem to solve as far as I know.
Thanks for detail informations.
So the methods for solve this problem is:
1. Just put invisible vision-blocking doodads on the edges of each terrain.
2. I can't understand clearly this method. "Make some sight-blocking doodads and remove this every .5 seconds where it depends on the players' screen."? is that right?
3. Change all the units' vision radius of 1, use the trigger for bind them to invisible flying dummies.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
In the other thread Dr Super Good said units shouldn't be able to see over steep inclines by default, so not sure what's going on. But anyway:
  1. Correct. These doodads are placed in OE and have no triggers.
  2. This method you would have the same doodads but instead of them being always there you hide/show them on a per-player basis using GetLocalPlayer(). If any of Player(A)'s units can 'see' over the hill (some function of your choice--could be your angle function on unit and center of hill or maybe even check against a set of points (2-3 for each 'hill area', etc.) then hide the blocking doodads for GetLocalPlayer() == Player(A).
  3. Yep. I would do the same as 2 but instead of hiding doodads just create some more vision dummies to adequately cover the whole top. With this method you are basically triggering your own vision system so you could determine how it would work.
 
Level 2
Joined
Sep 8, 2016
Messages
16
In the other thread Dr Super Good said units shouldn't be able to see over steep inclines by default, so not sure what's going on. But anyway:
  1. Correct. These doodads are placed in OE and have no triggers.
  2. This method you would have the same doodads but instead of them being always there you hide/show them on a per-player basis using GetLocalPlayer(). If any of Player(A)'s units can 'see' over the hill (some function of your choice--could be your angle function on unit and center of hill or maybe even check against a set of points (2-3 for each 'hill area', etc.) then hide the blocking doodads for GetLocalPlayer() == Player(A).
  3. Yep. I would do the same as 2 but instead of hiding doodads just create some more vision dummies to adequately cover the whole top. With this method you are basically triggering your own vision system so you could determine how it would work.

OMG I finally solved this! Thanks a lot all of you people!
WC3ScrnShot_120116_175826_02.jpg
WC3ScrnShot_120116_175716_01.jpg
 
Status
Not open for further replies.
Top