Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-02-26 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: math help  (Read 54 times)

Offline Bunnub

  • Level 2 Apprentice
  • **
  • Posts: 41
math help
« on: February 18, 2010, 02:59:15 AM »
With the es_xmath command, can I use absolute numbers so I dont have to go through all the confusing math... I want a equation to... theres going to be a ring on my head and if you get close enough youll get one too, and I want there to be a line between the closest point of your ring and the closest point of mine. I can do it if were both in posative x,y coordinates of the map. otherwise the same code doesnt work. so if I could just turn the wcs_x2 or wcs_y2 into posatives somehow? that would be awesome!

Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 2967
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: math help
« Reply #1 on: February 18, 2010, 08:48:04 PM »
JUST WONDERING: Why would you use absolute values? What for?
We can probably help you make it work without :P
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline Bunnub

  • Level 2 Apprentice
  • **
  • Posts: 41
Re: math help
« Reply #2 on: February 19, 2010, 02:51:48 AM »
ok here goes. im making a race that has a halo on top of his head. the race heals everyone around him for 1 every .1 seconds. so the halo will stay pretty consistent on top of his head. and I wanted to make it so that if someone gets around me (and they start getting healed) then they get a halo on there head also which I have no problem with that, at least yet. so the problem is; I cant really make it so that there is a line connecting them from the middle of each halo. but I wanted a equation that figures out if the person getting healed is in front of me, behind me, to the left of me, or to the right, and then accordingly subtracts or adds (es_xmath) to were each line starts on my halo, and ends on their halo so that it will be from the closest point possible on each halo.( I know this seems like a lot but I have nothing better to do and I want this race to be amazing. = P) I want the halos to be connected like...
Code: [Select]
_        _
/  \_____/  \
\_ /     \_ /
not like
Code: [Select]
_        _
/ _\_____/_ \
\_ /     \_ /
theres a visual effect (kinda) because im not good at explaining apprently

here, I uploaded a image of it as my avatar just for you to see. the top half is correct, the bottom half is wrong. The person healing everyone else (me) is the on in the middle with writing on it.
« Last Edit: February 19, 2010, 03:05:32 AM by Bunnub »

Offline CA.Berettonawak

  • Le renomm� m�connu...
  • Watchdogs
  • Level 7 Expert
  • *****
  • Posts: 2967
  • Big Berettonawak is watching you...
    • Coding-Alliance.Com : A bunch of coders? Why not a bunch of players? :P
Re: math help
« Reply #3 on: February 22, 2010, 01:11:37 PM »
Sorry i really do not understand what you're trying to do, so i'll just let you use:
es_xmath <var> abs
:P
Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.

Quote from: myself
i love tuna juice :D

Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD

Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed


Offline Yiyas

  • Level 7 Expert
  • *****
  • Posts: 279
  • The name's Bugger. De-Bugger.
Re: math help
« Reply #4 on: February 22, 2010, 04:57:23 PM »
i use(d) this for longjump to annihilate velocity errors. it'll help if you see how to use it :)

Code: [Select]
      es_mathparse distance "rint(((x^2+y^2)^0.5)*wcs_longjump)"
      es_xset limitlongjump 500
      ifx parse("distance > limitlongjump") do
        {
        es_xcopy distance limitlongjump
        }
      ifx true(distance) do
        {
        ifx true(y) do
          {
          es_xmathparse cos "abs(distance*cos((atan(x/y))))*sign(y)"
          }
        ifx true(x) do
          {
          es_xmathparse sin "abs(distance*sin((atan(x/y))))*sign(x)"
          }
        }

Distance will go to whatever your radius is. x will be your x difference, y will be your y difference. sin will be your new x, cos will be your new y. Oh and remember to do your es_xset 0s.

Offline Bunnub

  • Level 2 Apprentice
  • **
  • Posts: 41
Re: math help
« Reply #5 on: February 22, 2010, 06:54:09 PM »
Ya, that helps, I think I'll have to test it