Gini, gw mau buat spell toss tiny yang chance, gw copas trigger jass toss tiny punya emiljr nah yang jadi masalah, cara buat jadi chance gmn ya ? Waktu yang unit - order attacking unit to "yang ini diisi apa" attacked unit
Printable View
Gini, gw mau buat spell toss tiny yang chance, gw copas trigger jass toss tiny punya emiljr nah yang jadi masalah, cara buat jadi chance gmn ya ? Waktu yang unit - order attacking unit to "yang ini diisi apa" attacked unit
hadoooohhh... gw bingung ngeliat kasusnya... ga ada sampel, bukti... terus chancenya ga jelas... mo chance tiap gebuk, ato digebuk, ato tiap ngeluarin skill... bingung lha....
Tapi kalo tiap gebuk kira-kira konsepnya begini :
Event : Unit is Attacked
Condition :Attacking Unit equal to "HERO"
Action :
set var_chance = Random Number Between 1 to 10 // bikin chance
if var_chance < 3 Then // kemungkinan 20%
ExecuteFunc(TOSS)
else
Do Nothing
Ngartos kan maxudnya?
thx, jd gini, aq bwt spell toss, base spellnya channel, aq pgn bkin tossnya jd chance, trigernya kek gmn? thx ya nanti aq cb triger kakakz
Kurang ngerti nih, jadi Tossnya ada chance buat gagal gitu?
jadi gini ni :
tiny has 45% chance to toss enemy to the sky.
trigger tossnya sudah jadi seperti ini :
itu untuk skill ACTIVE nyaCode:scope Toss
//******************************************************************************************
//*
//* Toss - By emjlr3, Original seen in DotA Allstars
//*
//* Toss a friend or foe from here to there by targeting on a unit, and grabbing
//* a random target in the area, launching them towards the targeted area.
//*
//* Requires:
//* - "TT" trigger copied to your map, if not already there
//* - The "Toss" ability copied to your map
//* - A vJASS Preprocessor
//*
//******************************************************************************************
globals
// Config Globals:
private constant integer abil_id = 'A001' // Toss ability rawcode
private constant integer fly_id = 'Amrf' // Rawcode of ability to use for fly trick, if you have not touched Crow Form, this doesn't need changing
private constant real impact_damage = .20 // Percent of toss damage dealt to tossed unit
private constant real time = 1. // Flight time for tossed unit (seconds)
private constant string fly_sfx = "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl" // Effect created on target during toss
private constant string end_sfx = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" // Effect created on target at end of toss
private constant boolean kill_trees = true // Whether trees are destroyed upon target landing
private constant attacktype attack_type = ATTACK_TYPE_NORMAL // Attack type used for damage
private constant damagetype damage_type = DAMAGE_TYPE_DEMOLITION // Damage type used for damage
// Needed Globals:
private group G = CreateGroup()
private unit U = null
private rect R = null
private location L = null
public trigger Trigger = null // Output trigger will be Toss_Trigger, which can be used publically
endglobals
// Config. Functions:
private function Damage takes integer lvl returns real
return 75.*lvl // Damage/lvl
endfunction
private function Area takes integer lvl returns real
return 275. // Area within to grab units and damage units/lvl
endfunction
//========================================================================================
private struct data
unit u
unit targ
player p
real xt
real yt
real xl
real yl
real dist
real ang
real cos
real sin
real speed
real hc
integer lvl
integer count = 1
effect e
static method FiltIsEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>.405
endmethod
static method DamageGroup takes unit damager, real radius, real x, real y, real amount returns nothing
local unit u
set bj_groupEnumOwningPlayer = GetOwningPlayer(damager)
call GroupClear(G)
call GroupEnumUnitsInRange(G, x, y, radius, Condition(function data.FiltIsEnemy))
loop
set u = FirstOfGroup(G)
exitwhen u == null
call GroupRemoveUnit(G,u)
call UnitDamageTarget(damager,u,amount,false,false,attack_type,damage_type,null)
endloop
endmethod
static method KillTrees_Child takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endmethod
static method KillTrees takes real x, real y, real radius returns nothing
set R = Rect(x - radius,y - radius,x + radius,y + radius)
call EnumDestructablesInRect(R,null,function data.KillTrees_Child)
call RemoveRect(R)
endmethod
method onDestroy takes nothing returns nothing
call SetUnitFlyHeight(.targ,GetUnitDefaultFlyHeight(.targ),0.)
call PauseUnit(.targ,false)
call SetUnitPathing(.targ,true)
call DestroyEffect(.e)
call UnitDamageTarget(.u,.targ,Damage(.lvl)*impact_damage,false,false,attack_type,damage_type,null)
call DestroyEffect(AddSpecialEffectTarget(end_sfx,.targ,"origin"))
call data.DamageGroup(.u,Area(.lvl),.xl,.yl,Damage(.lvl))
if kill_trees then
call data.KillTrees(.xl,.yl,Area(.lvl))
endif
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == abil_id
endfunction
private function Filt takes nothing returns boolean
return GetFilterUnit()!=U and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING)
endfunction
private function GetSpeed takes real dist returns real
return dist/(1./TT_PERIOD)
endfunction
private function GetCountConversion takes integer count returns real
return (50./(time/TT_PERIOD))*count
endfunction
private function Movement takes nothing returns boolean
local data d = TT_GetData()
local real conv
local real height
local real speed
local real x
local real y
if d.count<=time/TT_PERIOD then
set conv = GetCountConversion(d.count)
set height = (conv-25.)*(conv-25.)
set speed = d.count*d.speed
set x = d.xt+speed*d.cos
set y = d.yt+speed*d.sin
call SetUnitX(d.targ,x)
call SetUnitY(d.targ,y)
call SetUnitFlyHeight(d.targ,625.-height,0.)
set d.count = d.count + 1
return false
else
call d.destroy()
return true
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.p = GetOwningPlayer(d.u)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
call GroupClear(G)
set U = d.u
call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),Area(d.lvl),Condition(function Filt))
set d.targ = GroupPickRandomUnit(G)
if d.targ==null then
call d.destroy()
return
endif
set d.xt = GetUnitX(d.targ)
set d.yt = GetUnitY(d.targ)
set L = GetSpellTargetLoc()
set d.xl = GetLocationX(L)
set d.yl = GetLocationY(L)
set d.ang = Atan2(d.yl-d.yt,d.xl-d.xt)
set d.cos = Cos(d.ang)
set d.sin = Sin(d.ang)
set d.dist = SquareRoot((d.xt-d.xl)*(d.xt-d.xl) + (d.yt-d.yl)*(d.yt-d.yl))
set d.speed = GetSpeed(d.dist)
call PauseUnit(d.targ,true)
call SetUnitPathing(d.targ,false)
call UnitAddAbility(d.targ,fly_id)
call UnitRemoveAbility(d.targ,fly_id)
set d.e = AddSpecialEffectTarget(fly_sfx,d.targ,"origin")
call TT_Start(function Movement,d)
call RemoveLocation(L)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
set Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Trigger, Condition( function Conditions ) )
call TriggerAddAction( Trigger, function Actions )
endfunction
endscope
sedagnkan saya buat lg trigger untuk menjalankan skill itu.
base skill passive toss adalah skill channel
nah, saya bingung harus bagaimana. waktu Units - order (attacking unit) to yang ini (attacked unit)
notice : problem solve, setelah dipikir-pikir ternyata bs d tambahin fungsi chance di codenya ^^. ada yang bs ubahkan spell diatas menjadi chance ga ? nanti saya kasih grp n thanks.
Wah ini mah buat Jasser . . . .
iya emg ak mesti tambahin function chancenya di bagian mana ya @@ atau ada yang bs gantiin ?
public function InitTrig takes nothing returns nothing
set Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Trigger, Condition( function Conditions ) )
call TriggerAddAction( Trigger, function Actions )
endfunction
ganti toh jadi EVENT_UNIT_ATTACKED
trus
call TriggerAddCondition( Trigger, Condition( function Conditions ) )
sesuaikan dengan eventnya.
pke if i_var == 1 then ...
trsh..
^_^