• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Using Offsets

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Im only a freshman in high school so dont yell at me if i dont get any of these formulas :(

Im making a talent tree and i want to connect the different buttons of the talent tree via lightning. Everything works ATM except you cant render lightning under destructables.

So two questions

1) How to render lightning under destructables, again? lol

2) Right now, i create the lightning at the X,Y of the doodad 1to the X,Y to the doodad 2 but this hides the icon and is ugly. What would the formula be to make the lightning start at the outer edge than go to the outer edge of the other button? (The buttons are 64x64)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I don't understand.

You create the lightning from (IconA.x - 32, IconA.y + 32) to (IconB.x + 32, IconB.y +32) for example.

What exactly are you trying to do?

JASS:
function ReturnOffset takes destructable startDestructable, destructable endDestructable
    return (the position on the edge of the 64x64 closest to endDestructable)
endfunction

what you say is correct but is it possible to do it without an 8-pronged if statement? :\
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
This can't be so bad, can it?

JASS:
function ReturnOffset takes destructable startDestructable, destructable endDestructable
    set x1 = startDes.x //.x is psuedocode for x of destructible
    set y1 = startDes.y
    set x2 = endDes.x
    set y2 = endDes.y
    
    if x1 > x2 then
        set x1 = x1 - 32
        set x2 = x2 + 32
    else
    if x1 < x2 then
        set x1 = x1 + 32
        set x2 = x2 - 32
    endif
    //repeat for y
endfunction
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
This can't be so bad, can it?

JASS:
function ReturnOffset takes destructable startDestructable, destructable endDestructable
    set x1 = startDes.x //.x is psuedocode for x of destructible
    set y1 = startDes.y
    set x2 = endDes.x
    set y2 = endDes.y
    
    if x1 > x2 then
        set x1 = x1 - 32
        set x2 = x2 + 32
    else
    if x1 < x2 then
        set x1 = x1 + 32
        set x2 = x2 - 32
    endif
    //repeat for y
endfunction

I'll assume you didnt do this in JNGP because this will throw a ton of errors, but i guess it works (but what I was trying to avoid). thanks
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Could you post an image of your system?

this is basically solved, i managed to inline it to use 0 hashtable calls and even if I put it all in one line than its a ton of IntegerTertiaryOp's
 

Attachments

  • picture.png
    picture.png
    448.8 KB · Views: 62
Status
Not open for further replies.
Top