Tom_Kazansky
--- wraith it ! ---
- Reaction score
- 157
sorry that I can't write a more descriptive title
I have something that bugged me, more like "not sure", here are they:
thank you for reading and for the (later) answers
I have something that bugged me, more like "not sure", here are they:
- I want a "custom regeneration" system, that do the regeneration of units manually, so I add units to a group and use a 0.1s static timer to do the regeneration, but I got lag if there are too many units (about 40 units, I think)
I think my method is not efficient so I think using AIDS and T32 would be better. Yea, T32 add a period timer to AIDS struct, and AIDS struct hold the unit's data. I only need 0.1s period for this.
So will I be able to have more units before the lag ?
(I know the lag would depend on what I do with each period, but assume that I do the same things with my method and with T32 )
(I know this can be self-tested but currently, my remake map is in terraining so I can't test it myself)
- I make a filter system (for group enuming):
JASS:scope CustomFilter globals private real X private real Y private real RANGE private unit GB_U = null private group GB_G = null private integer GB_ID = 0 private integer array GB_Filter endglobals private function IsUnitTypeElite takes unit u returns boolean return IsUnitType(u, UNIT_TYPE_ANCIENT) and IsUnitType(u, UNIT_TYPE_GIANT ) endfunction private function IsUnitTypeChampion takes unit u returns boolean return IsUnitType(u, UNIT_TYPE_SAPPER) and IsUnitType(u, UNIT_TYPE_TAUREN) endfunction private function IsUnitInvisibleEx takes unit u, player p returns boolean //thank to Flare local real ux = GetUnitX(u) local real uy = GetUnitY(u) local boolean invisible = false if IsUnitFogged(u,p) or IsUnitMasked(u,p) then call SetUnitX(u, tj_VisibleCheckerX ) call SetUnitY(u, tj_VisibleCheckerY ) set invisible = IsUnitInvisible(u,p) call SetUnitX(u, ux) call SetUnitY(u, uy ) else set invisible = IsUnitInvisible(u,p) endif return invisible endfunction private function CustomBoolExprFilter takes nothing returns boolean local unit f = GetFilterUnit() local boolean array b local boolean ok = true local integer i if GetUnitAbilityLevel(f,NoNeedToCheck)>0 then //units that have "NoNeedToCheck" ability will never be enumed set f = null return false endif set b[0] = not IsUnitInGroup(f,GB_G) set b[1] = GetUnitAbilityLevel(f,GB_ID) == 0 set b[2] = not IsUnitInvulnerable(f) //check 'Avul' and data to detect the "SetUnitInvulnerable" set b[3] = (IsUnitIllusion(f) == false) set b[4] = not ( GetUnitState(f,UNIT_STATE_MAX_MANA) == 0 ) set b[5] = (IsUnitType(f,UNIT_TYPE_MELEE_ATTACKER)==true) set b[6] = (IsUnitType(f,UNIT_TYPE_GROUND)==true) set b[7] = (IsUnitType(f,UNIT_TYPE_DEAD)==false) set b[8] = IsUnitEnemy(f,GetOwningPlayer(GB_U)) set b[9] = not IsUnitTypeElite(f) set b[10] = not IsUnitTypeChampion(f) set b[11] = (IsUnitType(f,UNIT_TYPE_HERO)==false) set b[12] = (IsUnitType(f,UNIT_TYPE_MECHANICAL)==false) set b[13] = (IsUnitType(f,UNIT_TYPE_STRUCTURE)==false) set b[14] = (IsUnitType(f,UNIT_TYPE_MAGIC_IMMUNE)==false) set b[15] = (IsUnitType(f,UNIT_TYPE_ETHEREAL)==false) set b[16] = (GetUnitAbilityLevel(f,tj_IsWardCheck)==0) //an ability that all wards has set b[17] = (IsUnitFogged(f,GetOwningPlayer(GB_U))==false and IsUnitMasked(f,GetOwningPlayer(GB_U))==false) set b[18] = (IsUnitInvisibleEx(f,GetOwningPlayer(GB_U))==false) set i = 0 loop exitwhen i > 18 if not ( ( GB_Filter<i> == 0 ) or ( (GB_Filter<i> == 1) and b<i> ) or ( (GB_Filter<i> == 2) and not b<i> ) ) then set ok = false endif set i = i + 1 endloop set f = null return ok endfunction private function CustomBoolExprFilterTrue takes nothing returns boolean return true endfunction function CustomBoolExprGet takes unit ufilter,integer buffid, group gfilter, string filter returns boolexpr local integer i = 0 if filter == "" or filter == null then return Condition( function CustomBoolExprFilterTrue ) endif loop exitwhen i > 18 set GB_Filter<i> = S2I(SubString(filter,i,i+1)) set i = i + 1 endloop set GB_G = gfilter set GB_U = ufilter set GB_ID = buffid return Condition( function CustomBoolExprFilter ) endfunction endscope</i></i></i></i></i></i>
so, when I want to enum units that are: has 'B000' buff, not invulnerable , alive, enemy of unitA, non-structure, non-magic immue, non-ward
I will get boolexpr: [ljass]CustomBoolExprGet( A, 'B000', null, "0110000110000110100" )[/ljass]
I have once told that boolexpr ( conditional functions) must be optimized as much as possible, but it's inconvenient for me to create filter for each spell (or for each group enum) so I use this CustomFilter, it's convenient for me but is it good for the game ?
(I don't really need "good", I only need "not bad" or even "not too bad" )
[*] How to calculate the maximum height of an arc projectile ? the height that projectile will reach when it fired at X range and its arc=Y.
e.g: I have a projectile fired at 1000 range and arc = 0.15 => what is the maximum height ?
I think I have seen this function before but I can't remember when/where so I will just ask.
thank you for reading and for the (later) answers