10

» WarCraft 3 / Функция возвращает 0?

Все получилось!!! Спасибо огромнейшее.
Короче принцип по факту такой же как и во всех ООП, я понял, обьявляешь переменные/константы, пишешь код функций, пишешь код спела, в конце вызываешь эти функции.
Надо понять теперь че такое private и вообще всю остальную структуру и синтаксис, пошел изучать, спасибо еще раз
10

» WarCraft 3 / Функция возвращает 0?

Господи точно, она же и называется по этому КОНСТАНТА, дико извиняюсь.
Я почему то решил что константа объявляется в этом триггере в момент его исполнения каждый раз заново.
Сейчас попробую)
Только начал осваивать джасс
10

» WarCraft 3 / Функция возвращает 0?

Так, окей, а если у меня уже есть переменная и в ней уже записан юнит, который записался туда после выбора из таверны.
То как я его могу обратиться к нему внутри вот такого кода например.
Должен ли я что то обьявить в глобалах ниже, или все переменные уже доступны?
Хочу MinHeightStart сделать зависимой от интеллекта и ( 200.00 + ( I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_ArcaneMageHero, true)) * 10.00 ) ) как будто не видит переменную udg_ArcaneMageHero.
Код
scope Telekinesis initializer GetStarted
globals
private constant integer SpellID = 'A00Z' Returns the rawcode of the spell. To get a spell's rawcode, press Ctrl+D in the Object Editor.
private constant real SpellAoEStart = 200.0 Returns the initial area in which the enemied units are affected by this spell.
private constant real SpellAoEIncreasement = 50.0 Returns the increasement per level of the previous area.
private constant real MinHeightStart = 100.00 Returns the initial minimal reachable height.
private constant real MinHeightIncreasement = 100.0 Returns the increasement of the minimal reachable height per level.
private constant real MaxHeightStart = 200.00 Returns the initial maximal reachable height.
private constant real MaxHeightIncreasement = 200.0 Returns the increasement of the maximal reachable height per level.
private constant real Speed = 1.45 Returns the time in seconds in which the affected units are in the air.
private constant real SpeedVariationPerc = 0.20 Returns the percentage of the variation between each unit's lifting speed. Default is 0.20 which means 20% variation.
private constant string LiftSFX = "Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl" Returns the path of the special effect displayed periodically at the chest of the lifted targets.
private constant real LiftSFXTimer = 0.30 Returns the interval in seconds in which the previous effect is displayed.
private constant string StartSFX = "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl" Returns the path of the special effect displayed at the targets upon casting this spell.
private constant string ImpactSFX = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" Returns the path of the special effect displayed upon impact on earth.
private constant real HDmgInPercStart = 0.08 Returns the percentage of the height dealt in damage. Default is 0.08 for 8% height dealt in damage to the lifted unit upon impact.
private constant real HDmgInPercIncreasement = 0.02 Returns increasement per level of the previous value. Default is 0.02 for 2% increasement per level.
private constant real ImpactDmgStart = 20.0 Returns the direct damage dealt to the target upon impact.
private constant real ImpactDmgIncreasement = 20.0 Returns increasement per level of the previous value.
private constant attacktype AttackType = ATTACK_TYPE_NORMAL Returns the attack type in which the damage is dealt. There's actually no need to adjust this value.
private constant damagetype DamageType = DAMAGE_TYPE_NORMAL Returns the damage type in which the damage is dealt. There's actually no need to adjust this value.
private constant weapontype WeaponType = WEAPON_TYPE_ROCK_HEAVY_BASH Returns the weapon type with which the damage is dealt. There's actually no need to adjust this value, replace it with 'null' to remove the corresponding sound.
private constant boolean Pause = true Returns whether the flying unit should be paused.
endglobals
********************************END OF THE SETTINGS**************************
Do not modify anything below this line unless you know what you are doing
*****************************************************************************
globals Declaring the global variables.
private group Fgroup = CreateGroup()
private group FlyG = CreateGroup()
private boolexpr filter = null
private integer i = 0
private unit tempU
private player tempP
endglobals

! General functions used
private function GetFilter takes nothing returns boolean Filters the targetable units.
return GetWidgetLife(GetFilterUnit()) > 0 and IsUnitEnemy(GetFilterUnit(),tempP) and IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

private function TeleCondition takes nothing returns boolean Checks the SpellID in order to trigger this spell, and no other, upon casting.
return GetSpellAbilityId() == SpellID
endfunction
! The spell itself
private struct Spell Declaring the struct variables.
unit c
unit t
real int
real maxH
real LsfxT
real speed
integer l

static Spell array indx
static integer counter = 0
static timer time = CreateTimer()

static method TeleLift takes nothing returns nothing Lifting the targets and handleing all the impact stuff.
local real x
local real y
local Spell d
set i = 0
loop
exitwhen i >= Spell.counter
set d = Spell.indx[i]
if d.int < 180 then
set d.int = d.int + d.speed
set d.LsfxT = d.LsfxT + 0.01
call SetUnitFlyHeight(d.t,(Sin(d.int*bj_DEGTORAD)*d.maxH)+GetUnitDefaultFlyHeight(d.t),0)
if d.LsfxT >= LiftSFXTimer then
call DestroyEffect(AddSpecialEffectTarget(LiftSFX,d.t,"chest"))
set d.LsfxT = 0
endif
else
set tempP = GetOwningPlayer(d.c)
set x = GetUnitX(d.t)
set y = GetUnitY(d.t)
call GroupRemoveUnit (FlyG,d.t)
call DestroyEffect(AddSpecialEffect(ImpactSFX,x,y))
call UnitDamageTarget(d.c,d.t,(d.maxH*(HDmgInPercStart+(d.l-1)*HDmgInPercIncreasement))+(ImpactDmgStart+(d.l-1)*ImpactDmgIncreasement),true,true,AttackType,DamageType,WeaponType)
if Pause == true then
call PauseUnit(d.t,false)
endif
call SetUnitFlyHeight(d.t,GetUnitDefaultFlyHeight(d.t),0)
set d.c = null
set d.t = null
call d.destroy()
set Spell.counter = Spell.counter - 1
set Spell.indx[i] = d.indx[Spell.counter]
set i = i - 1
if Spell.counter == 0 then
call PauseTimer(Spell.time)
endif
endif
set i = i + 1
endloop
set i = 0
endmethod

static method GetValues takes unit c, unit t, integer l returns nothing Applies the spell values into the struct system.
local Spell d = Spell.allocate()
set d.c = c
set d.t = t
set d.l = l
set d.int = 0
set d.LsfxT = 0
set d.maxH = GetRandomReal(MinHeightStart+(l-1)*MinHeightIncreasement,MaxHeightStart+(l-1)*MaxHeightIncreasement)
set d.speed = 1.8/GetRandomReal(Speed*(1+SpeedVariationPerc),Speed*(1-SpeedVariationPerc))
if Spell.counter == 0 then
call TimerStart(Spell.time,0.01,true, function Spell.TeleLift)
endif
set Spell.indx[Spell.counter] = d
set Spell.counter = Spell.counter + 1
endmethod
endstruct

! Casting the spell
private function TeleInput takes nothing returns nothing Gets and initializes the storage of all the spell values.
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(caster,SpellID)
local location loc = GetSpellTargetLoc()
set tempP = GetOwningPlayer(caster)
call GroupEnumUnitsInRange(Fgroup,GetLocationX(loc),GetLocationY(loc),SpellAoEStart+SpellAoEIncreasement*(level-1),filter)
loop
set tempU = FirstOfGroup(Fgroup)
exitwhen tempU == null
if IsUnitInGroup (tempU,FlyG) == false then
call Spell.GetValues(caster,tempU,GetUnitAbilityLevel(caster,SpellID))
call GroupAddUnit (FlyG,tempU)
call UnitAddAbility(tempU,'Amrf')
call UnitRemoveAbility(tempU,'Amrf')
call DestroyEffect(AddSpecialEffect(StartSFX,GetUnitX(tempU),GetUnitY(tempU)))
if Pause == true then
call PauseUnit(tempU,true)
endif
endif
call GroupRemoveUnit(Fgroup,tempU)
endloop
call RemoveLocation(loc)
set loc = null
set caster = null
endfunction
! Preloading and setting
private function GetStarted takes nothing returns nothing Preloads effects, adds actions and conditions to the spell's trigger.
local trigger TeleTrig = CreateTrigger()
set filter = Condition(function GetFilter)
loop
call TriggerRegisterPlayerUnitEvent(TeleTrig, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
set i = 0
call TriggerAddCondition(TeleTrig, Condition(function TeleCondition))
call TriggerAddAction(TeleTrig, function TeleInput)
call Preload(LiftSFX)
call Preload(StartSFX)
call Preload(ImpactSFX)
call PreloadStart()
endfunction
endscope
10

» WarCraft 3 / Как получить стат юнита в Jass и есть ли коллекция всех функций?

""
native GetHeroStr takes unit whichHero, boolean includeBonuses returns integer
native GetHeroAgi takes unit whichHero, boolean includeBonuses returns integer
native GetHeroInt takes unit whichHero, boolean includeBonuses returns integer
я даже больше скажу, ты мог просто конвертировать функцию гуишную и самому посмотреть
function GetHeroStatBJ takes integer whichStat, unit whichHero, boolean includeBonuses returns integer
if (whichStat == bj_HEROSTAT_STR) then
return GetHeroStr(whichHero, includeBonuses)
elseif (whichStat == bj_HEROSTAT_AGI) then
return GetHeroAgi(whichHero, includeBonuses)
elseif (whichStat == bj_HEROSTAT_INT) then
return GetHeroInt(whichHero, includeBonuses)
else
Unrecognized hero stat - return 0
return 0
endif
endfunction
""

private constant real MaxHeightStart = 200.0 + GetHeroInt( whichUnit, true ) * 3.00
господи точно, ну я и тупой, можно же было конвертнуть)
Спасибо огромное
10

» WarCraft 3 / Проблемы с begins casting an ability и finishes casting an abily


триггерно все делать, если ставить такой вопрос. Мы уже не сможешь механику вара изменить, если приказом "стоп" перебивается заклинание, значит, start effect of ability не сработал. Именно, в этот момент происходит забор маны
Все картоделы не могут ответить, но кто сталкивался, может ответить. Это надо тестить.

если у вас даймик, то нужно убрать у него анимации , тогда у даймика не будет задержек и заклинания сработают сразу, без задержек
графика - Анимация: Точка броска и Графика - Анимация: Обратный ход броска
Art - Animation - Cast Point (Real)
Art - Animation - Cast Backswing (Real)
ссылка

А в заклинании убрать CastTime (задержка)
Cупер ссыль! Это золото, спасибо огромное
10

» WarCraft 3 / Проблемы с begins casting an ability и finishes casting an abily

P.S Кажется start effect of ability работает идеально
Есть еще какие то подводные с этими условиями?
10

» WarCraft 3 / DPS meter на DamageEngine

гуишная хэш-таблица это отродье дьявола, прости)
на джассе без проблем объясню
А вот у него получилось и работает без ошибок
Ладно, спасибо, попробую адаптировать под себя чужую систему
10

» WarCraft 3 / DPS meter на DamageEngine

берёшь родительский ключ юнита, в первую ячейку создаёшь и сохраняешь таймер если его нет, во вторую кол-во урона, в таймер сохраняешь хэндл ид юнита и запускаешь на функцию которая будет удалять значение и уничтожать, очищать сам таймер и хэндл ид, при повторном вызове, если значение не уничтожилось, просто плюсуешь к нему и заново запускаешь этот таймер
А можешь пожалуйста еще раз повторить чуть подробнее как будто обьясняешь отсталому?
Вот на скрине, какое действия для хэштаблицы выбирать дальше?
10

» WarCraft 3 / DPS meter на DamageEngine

Я кажется че то придумал, буду добавлять значение в хэштаблицу и убирать значение с индексом 0 при каждом добавлении если индексов больше 10.
Надо только понять сдвинется ли индекс остальных значений на -1, если первое пропадет.
10

» WarCraft 3 / Как изменять значение атаки появляющихся саранчидов?

Да и выбрать каждого москита и поменять ему атаку все равно нельзя походу.
Ладно, спасибо большое, подумаю еще. Карту скачал, действительно работает, походу дело в проверке по типу юнита
10

» WarCraft 3 / Как изменять значение атаки появляющихся саранчидов?

Походу дело в проверке по типу юнита, есть подозрение что если ты меняешь характеристики базовому типу - он начинает считаться как юнит с другим равкодом, ща посмотрим
10

» WarCraft 3 / Как изменять значение атаки появляющихся саранчидов?

Точняк, можно же сделать через юнит входит в область)
Мое уважение сэр, креативно, спасибо)
10

» WarCraft 3 / Почему размер волны меняется только у первого юнита?

rsfghd, я тебе говорю, там все оч странно, рекомендую скачать карту и попробовать.
Первый элементаль большой который уже есть кастует большую волну, все элементали созданные триггером - маленькую.
Загруженные файлы
10

» WarCraft 3 / Почему атака элементаля увеличивается дважды?

Но у меня три уровня элементалей, делать три триггера?
А, я понял, призыв двух элементалей одной способностью считается как два призыва, интересно

Заработало, ты гений Тео, спасибо
10

» WarCraft 3 / Лучший способ отправить юнитов в атаку

PT153:
А зачем отдавать приказ каждую секунду? Отдал один раз, и они побежали. Если, конечно, они принадлежат игрокам 0 - 11.
Я просто думал все волны монстров спаунить в одной области, по этому для простоты сделал триггер каждые 10с отдавать приказ в области идти и атаковать, но оказалось далеко не лучший способ
10

» WarCraft 3 / Лучший способ отправить юнитов в атаку

KingMaximax:
avuremybe:
IssuePointOrder( unit whichUnit, string order, real x, real y )
А как же:
RemoveGuardPosition(unit whichUnit) 
Чтобы единицы назад не убегали.
Chosen2, а вообще лучше систему, могу пример на vJass:e скинуть.. Есть одна заготовка.
Да, скиньте пожалуйста, как раз начал изучать джасс.
Думал начать после того как разберусь во всех триггерах, но гуи оказался слишком кривым.