wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-22-2008, 11:55 AM   #1
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default [Help] Weird Angles

Collapse JASS:
function Trig_TAE_Make_Attacks_Actions takes nothing returns nothing
    local unit u
    local real x1 = (GetUnitX(GetAttacker()))
    local real y1 = (GetUnitY(GetAttacker()))
    local real xa = (GetUnitX(GetTriggerUnit()))
    local real ya = (GetUnitY(GetTriggerUnit()))
    local real x2 = 0.
    local real y2 = 0.
    local real dist = 0.
    local real ang = Atan2((ya - y1), (xa - x1))
    if (GetUnitPointValue(GetAttacker())==1) or (GetUnitPointValue(GetAttacker())==3) then
        set dist = 15.
    elseif (GetUnitPointValue(GetAttacker())==2) then
        set dist = 150.
    endif
    set x2 = x1 + (x1 + dist * Cos(ang))
    set y2 = y1 + (y1 + dist * Cos(ang))
    set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'h003', x2, y2, 0.) // Requires configuration
    call UnitApplyTimedLife(u, 'BHwe', 1.) // Requires configuration
    call IssueTargetOrder(GetAttacker(), "attack", u)
    set u = null
    set ang = ang * bj_RADTODEG
    call BJDebugMsg("Angle of attack: " + R2S(ang))
endfunction

Please acknowledge I'm still trying to learn Jass.

Alrighty, what this does is it...

1. Detects whether units R, P or S attack
2. Makes a dummy unit for neutral passive at a certain distance and angle
3. Makes the attackING unit attack the dummy

Now, thing is, I get really weird and seemingly random numbers. It may be that I'm trying to improvise Atan2 because I saw it inside that BJ that detected angle between points, but it's really weird.

My problems include...

1. It gives off appearing random angles

It may probably because I was out of what little practice I had before, but help would be appreciated. Thanks.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 09-22-2008 at 11:55 AM.
Tide-Arc Ephemera is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-22-2008, 12:36 PM   #2
Vestras
User


Project Member: LoC
 
Join Date: Dec 2007
Posts: 756

Submissions (4)

Vestras will become famous soon enough (40)Vestras will become famous soon enough (40)

Default

Angle should be bj_RADTODEG * Atan2(...)
Vestras is offline   Reply With Quote
Old 09-22-2008, 12:38 PM   #3
Malf
I LIKE PIZZA! | >
 
Malf's Avatar
 
Join Date: Sep 2007
Posts: 625

Submissions (2)

Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)

Send a message via AIM to Malf
Default

"Trig_TAE_" lolololol xD

set y2 = y1 + (y1 + dist * Cos(ang))

should be

set y2 = y1 + (y1 + dist * Sin(ang))
__________________
Malf is offline   Reply With Quote
Old 09-22-2008, 12:42 PM   #4
Vestras
User


Project Member: LoC
 
Join Date: Dec 2007
Posts: 756

Submissions (4)

Vestras will become famous soon enough (40)Vestras will become famous soon enough (40)

Default

Damn...
Vestras is offline   Reply With Quote
Old 09-22-2008, 12:58 PM   #5
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

Quote:
Originally Posted by Vestras
Angle should be bj_RADTODEG * Atan2(...)
The description of Atan2 said it gave off radians...

Quote:
Originally Posted by Milf
"Trig_TAE_" lolololol xD

set y2 = y1 + (y1 + dist * Cos(ang))

should be

set y2 = y1 + (y1 + dist * Sin(ang))

I'll give it a go next time I get access to WE, and it's not intended as the Philippine word. It's intended as in Tide-Arc Ephemera, thank you very much.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Old 09-22-2008, 01:00 PM   #6
Malf
I LIKE PIZZA! | >
 
Malf's Avatar
 
Join Date: Sep 2007
Posts: 625

Submissions (2)

Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)

Send a message via AIM to Malf
Default

Milf omg, asa pa xD
__________________
Malf is offline   Reply With Quote
Old 09-22-2008, 01:15 PM   #7
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

Hindi ako maronong nag Tagalog.
Seriously.


Collapse JASS:
function Trig_TAE_Make_Attacks_Actions takes nothing returns nothing
    local unit u
    local real x1 = (GetUnitX(GetAttacker()))
    local real y1 = (GetUnitY(GetAttacker()))
    local real xa = (GetUnitX(GetTriggerUnit()))
    local real ya = (GetUnitY(GetTriggerUnit()))
    local real x2 = 0.
    local real y2 = 0.
    local real dist = 0.
    local real ang = Atan2((xa - x1), (ya - y1))
    if (GetUnitPointValue(GetAttacker())==1) or (GetUnitPointValue(GetAttacker())==3) then
        set dist = 15.
    elseif (GetUnitPointValue(GetAttacker())==2) then
        set dist = 150.
    endif
    set x2 = x1 + dist * Cos(ang)
    set y2 = y1 + dist * Sin(ang)
    set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'h003', x2, y2, 0.) // Requires configuration
    call UnitApplyTimedLife(u, 'BHwe', 1.) // Requires configuration
    call IssueTargetOrder(GetAttacker(), "attack", u)
    set u = null
    set ang = ang * bj_RADTODEG
    call BJDebugMsg("Angle of attack: " + R2S(ang))
endfunction

I tried both solutions, neither... how to say, worked. It still gives fucked angles.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Old 09-22-2008, 01:18 PM   #8
Vestras
User


Project Member: LoC
 
Join Date: Dec 2007
Posts: 756

Submissions (4)

Vestras will become famous soon enough (40)Vestras will become famous soon enough (40)

Default

Maybe try making it like
Atan2(xa - x1, ya - y1)
Vestras is offline   Reply With Quote
Old 09-22-2008, 01:23 PM   #9
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

lolololol stupid mistake.

Anyway. I remembered that with Atan2, y inputs come before x inputs. Silly Tide.

+Rep to whoever tried to help.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 01:04 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services