- Joined
- Jul 10, 2007
- Messages
- 6,306
So.. I started working with these in wc3
I'm kind of noob with them, but they look like they'd be really useful for spells =o.
Here's a site that shows them http://www.falstad.com/vector3d/
Then again, I may be wrong...
Anywho, here are 2 fun ones I came up with (1 by accident and the other with a little research). Just comment/uncomment around line 30 to see the 2 dif types. Change X,Y to how many you want in each dimension. X,Y at 20,20 is 400 total, which some machines may not be able to handle. I suggest 10,10 as that shows a good portion without lag =P.
I normally do 30,30 for intense detail : ).
So, anyone have some interesting ideas that they can use with these?
Anyways, here are 2 fields in wc3 =P.
I'm kind of noob with them, but they look like they'd be really useful for spells =o.
Here's a site that shows them http://www.falstad.com/vector3d/
Then again, I may be wrong...
Anywho, here are 2 fun ones I came up with (1 by accident and the other with a little research). Just comment/uncomment around line 30 to see the 2 dif types. Change X,Y to how many you want in each dimension. X,Y at 20,20 is 400 total, which some machines may not be able to handle. I suggest 10,10 as that shows a good portion without lag =P.
I normally do 30,30 for intense detail : ).
So, anyone have some interesting ideas that they can use with these?
Anyways, here are 2 fields in wc3 =P.
JASS:
struct tests extends array
private static constant integer X = 20
private static constant integer Y = 20
private static constant integer Z = 1
private static real array x0
private static real array y0
private static real array z0
private static real array xp
private static real array yp
private static real array zp
private static real bx
private static real by
private static real bz
private static real bmx
private static real bmy
private static real bmz
private static integer c = 0
private static unit array u
private static real xo = 0
private static real zo = 0
private static trigger t = CreateTrigger()
private static trigger t2 = CreateTrigger()
private static method cr takes nothing returns nothing
local integer i = c
local unit h
local real r
//call PanCameraToTimed(xp[X/2],yp[Y/2],0)
loop
exitwhen i == 0
set i = i - 1
set h = u[i]
/*
///////////////////////////////
set r = SquareRoot(xp[i]*xp[i]+yp[i]*yp[i])/128
set xp[i] = xp[i] + yp[i]*r*.03125/32
set yp[i] = yp[i] + xp[i]*r*.03125/32
///////////////////////////////
*/
///*
//////////////////////////////////
set xp[i] = xp[i]+((-(yp[i]-x0[i]))*.03125)
set yp[i] = yp[i]+((xp[i]-y0[i])*.03125)
//////////////////////////////////
//*/
if (xp[i] >= bmx or xp[i] <= bx or yp[i] >= bmy or yp[i] <= by or zp[i] >= bmz or zp[i] <= bz) then
set xp[i] = x0[i]
set yp[i] = y0[i]
set zp[i] = z0[i]
endif
call SetUnitX(h, xp[i])
call SetUnitY(h, yp[i])
call SetUnitFlyHeight(h, zp[i], 10000)
endloop
set h = null
endmethod
private static method ev2 takes nothing returns boolean
local integer i = Y
local real y
local real x = xo
local real z = zo
local integer m = Y/2
loop
exitwhen i == 0
set y = (i-m)*96-32
set u[c] = CreateUnit(Player(0), 'hfoo', x, y, 0)
set xp[c] = x
set yp[c] = y
set zp[c] = z
set x0[c] = x
set y0[c] = y
set z0[c] = z
call SetUnitFlyHeight(u[c], z, 10000)
set c = c + 1
set i = i - 1
endloop
return false
endmethod
private static method ev takes nothing returns boolean
local integer i = X
local integer m = X/2
loop
exitwhen i == 0
set xo = (i-m)*96-32
call TriggerEvaluate(t2)
set i = i - 1
endloop
return false
endmethod
private static method onInit takes nothing returns nothing
local integer i = Z
call TriggerAddCondition(t, Condition(function thistype.ev))
call TriggerAddCondition(t2, Condition(function thistype.ev2))
set bx = -X*96-4096
set by = -Y*96-4096
set bz = 0
set bmx = X*96+4096
set bmy = Y*96+4096
set bmz = Z*96+512
loop
exitwhen i == 0
set zo = (i-1)*96+128
call TriggerEvaluate(t)
set i = i - 1
endloop
call TimerStart(CreateTimer(), .03125, true, function thistype.cr)
endmethod
endstruct