kissmenow21
New Member
- Reaction score
- 0
Hi, I've started learning about jass.. Two days ago I had almost zero knowledge but then after learning about Polled wait, I kinda regained confidence. But there are two problems...
I have read multiple number of other posts on those problems but they did not fully answer my questions very well.. or I suck very hard at searching
1. The code is extremely messy but if you look at the inside of the loop, you can see this line of code (this will be noticeable in my full code)
This (when I converted "Unit - Pick all unit blah blah") needed two new side functions to work. The two functions are "tong_condition" and "tong_action". But the problem is that I can't pass the variable "man" to the function.
I tried putting
scope tong initializer Init on the first line and on the last line and putting in globals and it gave me 100s of error messages that says
syntax error
statement out of function x 100s
If there is a way to pick units that'd be great.
If there is a way to pass a variable easier, that'd be great. Thank you !
2. if you have time, can you give me an example of a timer that will work just like Polled wait that I put there? I just want a wait that is more precise. Thank you !
I have read multiple number of other posts on those problems but they did not fully answer my questions very well.. or I suck very hard at searching
1. The code is extremely messy but if you look at the inside of the loop, you can see this line of code (this will be noticeable in my full code)
JASS:
call ForGroupBJ( GetUnitsInRangeOfLocMatching(250.00, Location((manX-ptX)/divConst*exit+ptX,(manY-ptY)/divConst*exit+ptY), Condition(function Trig_tong_condition)), function Trig_tong_action )
This (when I converted "Unit - Pick all unit blah blah") needed two new side functions to work. The two functions are "tong_condition" and "tong_action". But the problem is that I can't pass the variable "man" to the function.
I tried putting
scope tong initializer Init on the first line and on the last line and putting in globals and it gave me 100s of error messages that says
syntax error
statement out of function x 100s
If there is a way to pick units that'd be great.
If there is a way to pass a variable easier, that'd be great. Thank you !
2. if you have time, can you give me an example of a timer that will work just like Polled wait that I put there? I just want a wait that is more precise. Thank you !
My first Jass code (full) below. If it's not significant, you don't have to proof read and help me fix/organize/destroy variable it XD. I just want to see it work and make it more elegant later!
JASS:
function Trig_tong_condition takes nothing returns boolean
return ( GetOwningPlayer(GetEnumUnit()) != GetOwningPlayer(man) )
endfunction
function Trig_tong_action takes nothing returns nothing
call UnitDamageTargetBJ( man, GetEnumUnit(), 1004.00, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
endfunction
function Trig_flame_blader_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 039;A00P039; ) ) then
return false
endif
return true
endfunction
function Trig_flame_blader_Actions takes nothing returns nothing
local effect eff
//local unit man
local location pt
local location realpt
local unit dummy
local real killtime
local location manloc
local real ptX
local real ptY
local real manX
local real manY
local real divConst
local integer exit
call DisplayTextToForce(GetPlayersAll(),"start function")
call AddSpecialEffectTargetUnitBJ( "hand, right", GetSpellAbilityUnit(), "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" )
set eff = GetLastCreatedEffectBJ()
set man = GetSpellAbilityUnit()
set pt = GetSpellTargetLoc()
call PolledWait(.002)
set manloc = GetUnitLoc(man)
set killtime = DistanceBetweenPoints(manloc, pt)/522-.5
call SetUnitAnimation( man, "ATTACK" )
call PauseUnitBJ( true, man )
call DisplayTextToForce(GetPlayersAll(),"ah what tha heck")
call SetUnitPositionLocFacingBJ( man, pt, AngleBetweenPoints(manloc, pt) )
set realpt = GetUnitLoc(man)
set manX = GetLocationX(manloc)
set manY = GetLocationY(manloc)
set ptX = GetLocationX(realpt)
set ptY = GetLocationY(realpt)
set exit = 10
set divConst = exit
call DisplayTextToForce(GetPlayersAll(),"b4 loop")
loop
exitwhen exit<0
//call CreateNUnitsAtLocFacingLocBJ( 1, 'h00J', GetOwningPlayer(GetSpellAbilityUnit()), Location((manX-ptX)/divConst*exit+ptX,(manY-ptY)/divConst*exit+ptY), pt )
//set dummy = GetLastCreatedUnit()
//call SetUnitVertexColorBJ(dummy,0,0,0,100)
//call UnitDamagePointLoc( man, 0, 250.00, Location((manX-ptX)/divConst*exit+ptX,(manY-ptY)/divConst*exit+ptY), 100.00, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
/* @@@@@@@@@@@@@ LOOK HERE !!!!!!!! The code mentioned in my problem 1 @@@@@@@@@@@@@@@@ */
call ForGroupBJ( GetUnitsInRangeOfLocMatching(250.00, Location((manX-ptX)/divConst*exit+ptX,(manY-ptY)/divConst*exit+ptY), Condition(function Trig_tong_condition)), function Trig_tong_action )
/* @@@@@@@@@@@@@ LOOK HERE !!!!!!!! The code mentioned in my problem 1 @@@@@@@@@@@@@@@@ */
//call KillUnit(dummy)
//set dummy = null
call DisplayTextToForce(GetPlayersAll(),I2S(exit))
set exit=exit-1
endloop
call DisplayTextToForce(GetPlayersAll(),"after loop")
call SetUnitAnimation( man, "Attack" )
call SetUnitTimeScalePercent( man, 10.00 )
call SetUnitVertexColorBJ(man,0,0,0,70)
//call SetUnitTimeScalePercent( man, 500.00 )
call PolledWait(.1)
call SetUnitVertexColorBJ(man,100,100,100,40)
call SetUnitTimeScalePercent( man, 200.00 )
call PolledWait(.4)
call PauseUnitBJ( false, man )
call SetUnitVertexColorBJ(man,100,100,100,0)
call SetUnitTimeScalePercent( man, 100.00 )
call DestroyEffectBJ( eff )
set man = null
set eff = null
set pt = null
call PolledWait(killtime)
call KillUnit(dummy)
set dummy = null
endfunction
//===========================================================================
function InitTrig_tong takes nothing returns nothing
set gg_trg_tong = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_tong, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_tong, Condition( function Trig_flame_blader_Conditions ) )
call TriggerAddAction( gg_trg_tong, function Trig_flame_blader_Actions )
endfunction