- Joined
- Apr 25, 2018
- Messages
- 13
So I found a thread about making a unit get a dissipate effect with the Banish ability as the dummy spell, I downloaded a map (made by Maker) and for some reason, the vJASS trigger can't be enabled and I can't test it out nor save it while I try to get it enabled. It comes up with a compile syntax error:
"Unknown compile error (syntax error, line 62)"
"library Dissipate initializer InitTrig_Dissipation"
If I delete it, more errors come up, and then everything turns into a mess... (just wanted to try things if that changed anything but it's just the same)
Then, the trigger works fine in it's original test map, but if changes are made and I save that map, it just won't work anymore, as the same thing comes up again, and I just simply don't know what to do to import this vJASS trigger (nor any vJASS spell actually) on my custom maps.
Aaaand... no, I have zero knowledge about JASS or vJASS, but I really need this effect to make some non-hero units to disappear when they die with the ghostly effect, otherwise I don't like the result.
Btw, I use World Editor Extended (WEX).
Here you have the map for testing it out (again, this isn't my map, it's Maker's):
https://www.hiveworkshop.com/attachments/dissipate2-w3x.95096/
"Unknown compile error (syntax error, line 62)"
"library Dissipate initializer InitTrig_Dissipation"
Code:
// Dissipation system v1.06 by Maker //
// //
// When units die, they will slowly rise up in the air //
// and fade. //
library Dissipate initializer InitTrig_Dissipation
globals
// How often the dissipation height is updated
private constant real LOOP_TIME = 0.03
// How fast the units rise
private constant real HEIGHT_SPEED = 7.5
// How long the death animation plays before the unit begins to rise
private constant real DEATH_DELAY = 2.5
// How fast the units fade
private constant integer FADE_SPEED = 5
// How transparent the unit will be after dying
private constant integer INITIAL_FADE = 177
// How fast the units rotate
private constant real ROTATION_SPEED = 5.
// How high the units rise before vanishing completely
private constant real HEIGHT_MAX = 500.
// The visibility given by dissipating units
private constant real VISIBILITY_RADIUS = 512.
// RGB values for the dissipating units. Keep between 0 and 255
private constant integer RED = 255
private constant integer GREEN = 255
private constant integer BLUE = 255
// Raw code of the dummy
private constant integer DUMMYCODE = 'h001'
// Raw code of the dummy ability
private constant integer BUFFCODE = 'B005'
// Order code of the dummy ability
private constant string ORDERCODE = "banish"
// Does the dissipating unit provide visibility
private constant boolean GIEF_VISIBILITY = true
// Is the dissipating unit created for the owner of dying unit
private constant boolean GHOST_FOR_OWNER = false
// Do units rotate
private constant boolean ROTATE = false
// Don't tamper with the variables below //
private constant integer array unitTypes
private integer dissipates = 0
hashtable dissipateHash = InitHashtable()
private group dissipateGroup = CreateGroup()
private timer dissipateTimer = CreateTimer()
endglobals
// Add all unit types you want the system to work with here
private function initUnits takes nothing returns nothing
set unitTypes[1] = 'Hblm'
set unitTypes[2] = 'Hmkg'
endfunction
private function dissipateLoop takes nothing returns nothing
local unit u = GetEnumUnit()
local integer id = GetHandleId(u)
local integer fade
local real height
local real delay = LoadReal( dissipateHash , id , 2 ) - LOOP_TIME
if delay > 0. then
call SaveReal( dissipateHash , id , 2 , delay )
else
set height = GetUnitFlyHeight(u)
if LoadBoolean( dissipateHash , id , 5 ) != true then
call SaveBoolean( dissipateHash , id , 5 , true )
set bj_lastCreatedUnit = LoadUnitHandle( dissipateHash , id , 6 )
if bj_lastCreatedUnit == null then
set bj_lastCreatedUnit = CreateUnit( Player(15) , DUMMYCODE , GetUnitX(u) , GetUnitY(u) , 0. )
call SaveUnitHandle( dissipateHash , id , 6 , bj_lastCreatedUnit )
endif
call ShowUnit( bj_lastCreatedUnit , true )
call SetUnitX(bj_lastCreatedUnit , GetUnitX(u) )
call SetUnitY(bj_lastCreatedUnit , GetUnitY(u) )
call IssueTargetOrder( bj_lastCreatedUnit , ORDERCODE , u )
endif
if height < HEIGHT_MAX then
if ROTATE == true then
call SetUnitFacing( u , GetUnitFacing(u) + ROTATION_SPEED )
endif
call SetUnitFlyHeight( u , height + HEIGHT_SPEED , 0. )
else
if LoadBoolean( dissipateHash , id , 4 ) != true then
if GIEF_VISIBILITY == true then
call FogModifierStop( LoadFogModifierHandle( dissipateHash , id , 1 ) )
endif
call ShowUnit( LoadUnitHandle( dissipateHash , id , 6 ) , false )
call UnitRemoveAbility( u , BUFFCODE )
call SaveBoolean( dissipateHash , id , 4 , true )
endif
set fade = LoadInteger( dissipateHash , id , 3 ) - FADE_SPEED
if fade > 0 then
call SetUnitVertexColor( u , RED , GREEN , BLUE , fade )
call SaveInteger( dissipateHash , id , 3 , fade )
else
call GroupRemoveUnit( dissipateGroup , u )
call ShowUnit( u , false )
call SetUnitFlyHeight( u , 0. , 0. )
set dissipates = dissipates - 1
if dissipates == 0 then
call PauseTimer(dissipateTimer)
endif
endif
endif
endif
set u = null
endfunction
private function dissipateTimerExpire takes nothing returns nothing
call ForGroup( dissipateGroup , function dissipateLoop )
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer id = GetHandleId(u)
local integer id2
local player p = GetOwningPlayer(u)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
set bj_lastCreatedUnit = LoadUnitHandle( dissipateHash , id , 0 )
if bj_lastCreatedUnit == null then
if GHOST_FOR_OWNER == true then
set bj_lastCreatedUnit = CreateUnit( p , GetUnitTypeId(u) , x , y , GetUnitFacing(u) )
else
set bj_lastCreatedUnit = CreateUnit( Player(15) , GetUnitTypeId(u) , x , y , GetUnitFacing(u) )
call SetUnitColor( bj_lastCreatedUnit , GetPlayerColor(p) )
endif
set id2 = GetHandleId(bj_lastCreatedUnit)
call UnitAddAbility( bj_lastCreatedUnit , 'Arav' )
call SaveUnitHandle( dissipateHash , id , 0 , bj_lastCreatedUnit )
if GIEF_VISIBILITY == true then
set bj_lastCreatedFogModifier = CreateFogModifierRadius( p , FOG_OF_WAR_VISIBLE , GetUnitX(bj_lastCreatedUnit) , GetUnitY(bj_lastCreatedUnit) , VISIBILITY_RADIUS , true , true )
call SaveFogModifierHandle( dissipateHash , id2 , 1 , bj_lastCreatedFogModifier )
endif
else
set id2 = GetHandleId(bj_lastCreatedUnit)
call ShowUnit( bj_lastCreatedUnit , true )
if GIEF_VISIBILITY == true then
set bj_lastCreatedFogModifier = LoadFogModifierHandle( dissipateHash , id2 , 1 )
endif
endif
call ShowUnit( u , false )
call SetUnitX( bj_lastCreatedUnit , x )
call SetUnitY( bj_lastCreatedUnit , y )
call SetUnitVertexColor( bj_lastCreatedUnit , RED , GREEN , BLUE , 255 )
call UnitAddAbility( bj_lastCreatedUnit , 'Aloc' )
call UnitRemoveAbility( bj_lastCreatedUnit , 'Aloc' )
call SetUnitAnimation( bj_lastCreatedUnit , "death" )
call GroupAddUnit( dissipateGroup , bj_lastCreatedUnit )
call SaveInteger( dissipateHash , id2 , 3 , INITIAL_FADE )
call SaveReal( dissipateHash , id2 , 2 , DEATH_DELAY )
call SaveBoolean( dissipateHash , id2 , 4 , false )
call SaveBoolean( dissipateHash , id2 , 5 , false )
if GIEF_VISIBILITY == true then
call FogModifierStart(bj_lastCreatedFogModifier)
endif
set dissipates = dissipates + 1
if dissipates == 1 then
call TimerStart( dissipateTimer , LOOP_TIME , true , function dissipateTimerExpire )
endif
set u = null
set p = null
endfunction
private function Condition takes nothing returns boolean
local integer id = GetUnitTypeId(GetTriggerUnit())
local integer i = 1
loop
if id == unitTypes[i] then
return true
endif
set i = i + 1
exitwhen unitTypes[i] == null
endloop
return false
endfunction
function InitTrig_Dissipation takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction( t , function Actions )
call TriggerAddCondition( t , function Condition )
call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_DEATH )
call initUnits()
endfunction
endlibrary
If I delete it, more errors come up, and then everything turns into a mess... (just wanted to try things if that changed anything but it's just the same)
Then, the trigger works fine in it's original test map, but if changes are made and I save that map, it just won't work anymore, as the same thing comes up again, and I just simply don't know what to do to import this vJASS trigger (nor any vJASS spell actually) on my custom maps.
Aaaand... no, I have zero knowledge about JASS or vJASS, but I really need this effect to make some non-hero units to disappear when they die with the ghostly effect, otherwise I don't like the result.
Btw, I use World Editor Extended (WEX).
Here you have the map for testing it out (again, this isn't my map, it's Maker's):
https://www.hiveworkshop.com/attachments/dissipate2-w3x.95096/