Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Rekomendowane odpowiedzi

Opublikowano

Dzisiaj postanowiłem napisać bardzo podstawowy skrypt do Cassiopei. Niby, żę wszystko działa, ale po zabiciu jednego przeciwnika skrypt przestaje spamować z E.

 

Kod:

require "SpellDamageLibrary"
require "VPrediction"

function Init()
	SpellQ = {id = "Q", delay = 0.4, width = 150, range = 850, speed = nil, ready = false}
	SpellW = {id = "W", delay = 0, width = 125, range = 850, speed = 2500, ready = false}
	SpellE = {id = "E", range = 700, ready = false}
	SpellR = {id = "R", delay = 0.3, width = 80, range = 825, speed = nil, ready = false}
	
	SpellQ.ready = (myHero:CanUseSpell(_Q) == READY)
	SpellW.ready = (myHero:CanUseSpell(_W) == READY)
	SpellE.ready = (myHero:CanUseSpell(_E) == READY)
	SpellR.ready = (myHero:CanUseSpell(_R) == READY)
	
	Config = scriptConfig("Cassio", "cass")
	Config:addParam("combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
	Config:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("V"))
	Config:addParam("ult", "Use ult", SCRIPT_PARAM_ONOFF, false)
	Config:addParam("ks", "AutoKS", SCRIPT_PARAM_ONOFF, true)
end

function OnLoad()
	if myHero.charName ~= "Cassiopeia" then return end

  ts = TargetSelector(TARGET_LOW_HP_PRIORITY, 850)
	VP = VPrediction()
	
	Init()
	PrintChat(">> Cassio by apilat loaded! <<")
end

function OnTick()
	ts:update()
	
	if ts.target ~= nil and Config.ks then
		AutoKS()
	end
	
	if ts.target ~= nil and Config.combo then
		Combo()
	end
	
	if ts.target ~= nil and Config.harass then
		Harass()
	end
	
	if ts.target ~= nil and Poisoned(ts.target) and SpellE.ready and (Config.combo or Config.harass) then
		CastSpell(_E, ts.target)
	end
end

function OnDraw()
	DrawCircle(myHero.x, myHero.y, myHero.z, SpellQ.range, 0xD00000)
	DrawCircle(myHero.x, myHero.y, myHero.z, SpellE.range, 0x3300CC)
end

function Combo()
	-- Cast Q
	if SpellQ.ready and ts.target ~= nil then
		local AOECastPosition, MainTargetHitChance, nTargets = VP:GetCircularAOECastPosition(ts.target, SpellQ.delay, SpellQ.width, SpellQ.range, SpellQ.speed, myHero)
		
		if MainTargetHitChance >= 2 then
			CastSpell(_Q, AOECastPosition.x, AOECastPosition.z)
		end
	end
	-- Cast W
	if SpellW.ready and ts.target ~= nil then
		local AOECastPosition, MainTargetHitChance, nTargets = VP:GetCircularAOECastPosition(ts.target, SpellW.delay, SpellW.width, SpellW.range, SpellW.speed, myHero)
		
		if MainTargetHitChance >= 2 then
			CastSpell(_W, AOECastPosition.x, AOECastPosition.z)
		end
	end
	-- Cast R
	if SpellR.ready and ts.target ~= nil and Config.ult then
		local ConeCastPosition, MainTargetHitChance, nTargets = VP:GetConeAOECastPosition(ts.target, SpellR.delay, SpellR.width, SpellR.range, SpellR.speed, myHero)
		
		if MainTargetHitChance > 2 and nTargets > 2 then
			CastSpell(_R, ConeCastPosition.x, ConeCastPosition.y)
		end
	end
end

function Harass()
	-- Cast Q
	if SpellQ.ready and ts.target ~= nil then
		local AOECastPosition, MainTargetHitChance, nTargets = VP:GetCircularAOECastPosition(ts.target, SpellQ.delay, SpellQ.width, SpellQ.range, SpellQ.speed, myHero)
		
		if MainTargetHitChance > 2 then
			CastSpell(_Q, AOECastPosition.x, AOECastPosition.z)
		end
	else
		-- Cast W
		if Config.useW and SpellW.ready and ts.target ~= nil then
			local AOECastPosition, MainTargetHitChance, nTargets = VP:GetCircularAOECastPosition(ts.target, SpellW.delay, SpellW.width, SpellW.range, SpellW.speed, myHero)
		
		if MainTargetHitChance > 2 then
			CastSpell(_W, AOECastPosition.x, AOECastPosition.z)
		end
		end
	end
end

function AutoKS()
	for i = 1, heroManager.iCount do
		local enemy = heroManager:getHero(i)
		dmgQ = getDmg("Q", enemy, myHero)
		dmgE = getDmg("E", enemy, myHero)
		-- KS with E
		if dmgE > enemy.health and GetDistance(enemy, myHero) <= SpellE.range and SpellE.ready then
			CastSpell(_E, enemy)
		end
	end
end

function Poisoned(target)
	for i = 1, target.buffCount do
		local tBuff = target:getBuff(i)
		if BuffIsValid(tBuff) and tBuff.name:find("poison") then
			return true
		end
	end
	return false
end

Z góry dziękuję za pomoc.

apilat.

Opublikowano

Skrypt sprawdza gotowośc speli tylko przy załadowaniu

 

Do OnTick() dodaj Check()

 

function Check()

SpellQ.ready = (myHero:CanUseSpell(_Q) == READY)
SpellW.ready = (myHero:CanUseSpell(_W) == READY)

SpellE.ready = (myHero:CanUseSpell(_E) == READY)
SpellR.ready = (myHero:CanUseSpell(_R) == READY)

end

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...