Komaqtion
You can change this now in User CP.
- Reaction score
- 469
Hi!
I'm trying to make a kind of fade/scale system/snippet, and I thought I'd use T32 for easy and efficient scaling/fading over time...
Though, I've never use T32 before, so this is what I have atm:
And this is how I test it:
So, now I wonder where to put the .startperiodic() line :S
I tried to put it behind all stuff in the "test-trigger", but that didn't work
I'm trying to make a kind of fade/scale system/snippet, and I thought I'd use T32 for easy and efficient scaling/fading over time...
Though, I've never use T32 before, so this is what I have atm:
JASS:
library ScaleandFade uses T32
globals
private integer TempStruct
endglobals
struct SaF
real ex
real ey
real ez
real xincrement
real yincrement
real zincrement
unit u
boolean bx = true
boolean by = true
boolean bz = true
private static method Filters takes nothing returns boolean
return IsUnit(SaF(TempStruct).u, DUMMY) != true
endmethod
private method periodic takes nothing returns boolean
local boolean b = false
local real x
local real y
local real z
call BJDebugMsg(" Tick! ")
if .u != null and (.xincrement != 0 or .yincrement != 0 or .zincrement != 0) and thistype.Filters() then
if .bx == true then
set x = x + .xincrement
endif
if .by == true then
set y = y + .yincrement
endif
if .bz == true then
set z = z + .zincrement
endif
call SetUnitScale(.u, x, y, z)
if x == .ex then
set .bx = false
endif
if y == .ey then
set .by = false
endif
if z == .ez then
set .bz = false
endif
else
if .u == null then
debug call BJDebugMsg(" The scaling unit is not valid! ")
set b = true
elseif .xincrement == 0 then
debug call BJDebugMsg(" You039;ll need to specify different start/end x-values to scale a unit! ")
set b = true
elseif .yincrement == 0 then
debug call BJDebugMsg(" You039;ll need to specify different start/end y-values to scale a unit! ")
set b = true
elseif .zincrement == 0 then
debug call BJDebugMsg(" You039;ll need to specify different start/end z-values to scale a unit! ")
set b = true
endif
endif
return b
endmethod
implement T32
static method create takes real startscale_x, real startscale_y, real startscale_z,real endscale_x, real endscale_y, real endscale_z, unit scaled returns thistype
local thistype this = thistype.allocate()
set .ex = endscale_x
set .ey = endscale_y
set .ez = endscale_z
set .xincrement = (endscale_x - startscale_x) * T32_PERIOD
set .yincrement = (endscale_y - startscale_y) * T32_PERIOD
set .zincrement = (endscale_z - startscale_z) * T32_PERIOD
set .u = scaled
set TempStruct = this
call BJDebugMsg(R2S(.xincrement))
call BJDebugMsg(R2S(.yincrement))
call BJDebugMsg(R2S(.zincrement))
call BJDebugMsg(GetUnitName(.u))
return this
endmethod
endstruct
/*private function Descaling takes nothing returns boolean
local boolean b
if d.scale > 1. then
set d.scale = d.scale - 0.05
call SetUnitScale(d.caster, d.scale, d.scale, d.scale)
set b = false
else
set b = true
endif
return b
endfunction
private function Scaling takes nothing returns boolean
local boolean b
if d.scale < SCALE then
set d.scale = d.scale + 0.05
call SetUnitScale(d.caster, d.scale, d.scale, d.scale)
set b = false
else
set b = true
endif
return b
endfunction*/
endlibrary
And this is how I test it:
Trigger:
- Test Scale
- Events
- Player - Player 1 (Red) types a chat message containing scale as An exact match
- Conditions
- Actions
- Custom script: local SaF s
- Set TempGroup = (Units owned by (Triggering player))
- Custom script: set s = SaF.create(1., 1., 1., 1.5, 1.5, 1.5, FirstOfGroup(udg_TempGroup))
- Custom script: call DestroyGroup(udg_TempGroup)
- Events
So, now I wonder where to put the .startperiodic() line :S
I tried to put it behind all stuff in the "test-trigger", but that didn't work