Luna Hell Pass/Contaminated Underpath - Beta 28.10.2017

Post Reply

Build a Hell Pass script?

NO!!!
0
No votes
Yes
16
43%
Yes. (How to write script video tutorial)
21
57%
 
Total votes: 37

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Luna Hell Pass/Contaminated Underpath - Beta 28.10.2017

Post by cooco » Mon Oct 02, 2017 1:24 am

Luna Hell Pass/Contaminated Underpath - Beta 28.10.2017

How to use
1) Get Bright Aether
2) Open the gate and start script

TODO:
- Add routine if character die
- Auto loot boss

Know Bug:
- When disable script sometime NoGravity still remain active

Is a beta version, i'll try to improve script

Code: Select all

-- Final boss ID
finalBossId = 245575; -- http://aiondatabase.net/en/npc/245575/
finalBossMeatId = 243648; -- http://aiondatabase.net/en/npc/243648/
finalBossDischarge = 11173; -- http://aiondatabase.net/en/skill/11173/
finalBossDemolition = 21399; -- http://aiondatabase.net/en/skill/21399/ 30.000 Damage
finalBossControl = 11174; -- http://aiondatabase.net/en/skill/11174/ 18.000
finalBossDestruction = 21400; -- http://aiondatabase.net/en/skill/21400/  15.000

-- Krall ID
krallTypeId = 243647; -- http://aiondatabase.net/en/npc/243647/

-- Barricade ID
forwardBarricade = 833863; -- http://aiondatabase.net/en/npc/833863/
readBarricade = 833985; -- minor barricade http://aiondatabase.net/en/npc/833985/
readBarricade2 = 833864; -- major barricade http://aiondatabase.net/en/npc/833864/

-- Skill ID
SoulStrikeID = 411; -- http://aiondatabase.net/en/skill/411/
DestructionOfDarknessID = 412; -- http://aiondatabase.net/en/skill/412/
MercilessRuptureID = 413; -- http://aiondatabase.net/en/skill/413/
HellStrikeID = 414; -- http://aiondatabase.net/en/skill/414/
HellWaveID = 415; -- http://aiondatabase.net/en/skill/415/
HellWaveTimer = Time();

-- Barricade position
forwardBarricadePos = nil; -- http://aiondatabase.net/en/npc/833863/
readBarricadePos = nil; -- minor barricade http://aiondatabase.net/en/npc/833985/
readBarricade2Pos = nil; -- major barricade http://aiondatabase.net/en/npc/833864/

-- Recovering Energy
RecoveringEnergyID = 834491;


-- Confused Priest, 

playerID = Player:GetID();
setupInitialPosition = true;
forwardBarricadeIsUp = false;
checkForwardBarricadeIsUp = false;
setupInitialCannon = false;

-- Cannons position
cannonID = 833811;
cannonRealName = "Unknow";

cannonPos = {};
cannonPos[0] = {225.2, 217.8};
cannonPos[1] = {234.0, 217.8};
cannonPos[2] = {225.2, 214.4};
cannonPos[3] = {234.0, 214.4};
cannonPosCurrent = 0;
stepMoveToCannon = 0;
stepActiveCannon = 0;
selectCannonNPC = true;
needToActiveCannon = false;
cannonType = 2;
canActivated = true;

-- Move variable
updatePositionTime = 200; --100ms delay
moveDistance = 20; -- meters
moveSpeed =7; -- meters/second
offsetTimer = Time();

escapeOffsetTimer = Time();
goToStartRoom = true;
weNeedReturnBack = false;
weAreAtStartRoomPos = false;
t = Time();--delete this

-- Recovery energy variables
--recoveryEnergyOffsetTimer = Time();
stepRecoveryEnergy = 0;
weAreRecoveryHealth = false;
recoveringEnergyReversePath = false;
weNeedReturnBackAfterRecovery = false;
checkNewRecoveryEnergy = false;
checkNewRecoveryEnergyDelay = Time();
recoveringEnergyPos = nil;
--236, 215
--236, 202

-- Loot Krall variables
lootKrallCount = 0;
stepLootKrall = 0;
needToLootKrall = false;
checkAetherLootTimer = Time();
checkAetherLoot = false;

finalBossStage = false;
centerRoomX = 229;
airZ = 165;
airZBoss = 166.5;
groudZ = 162;
genericDelay = Time();
moveToGreenAcidPool = true;
moveToExpPearl = true;

-- Micro teleport variables
canMicroTeleport = true;
microTeleportStep = 0;


function OnLoad()
	-- Enable no gravity
	Player:SetNoGravity(true);

	local tempBarricate = SearchEntityByTypeId(forwardBarricade);
	if tempBarricate ~= nil then
		forwardBarricadePos = tempBarricate:GetPosition();
		forwardBarricadeIsUp = true;
		checkForwardBarricadeIsUp = true;
	end

	tempBarricate = SearchEntityByTypeId(readBarricade);
	if tempBarricate ~= nil then
		readBarricadePos = tempBarricate:GetPosition();
	end

	local tempRecoveringEnergy = SearchEntityByTypeId(RecoveringEnergyID);
	if tempRecoveringEnergy ~= nil then
		recoveringEnergyPos = tempRecoveringEnergy:GetPosition();
	else
		checkNewRecoveryEnergy = true;
		Write("Retrive Recovery Energy position fail");
	end

	if InventoryList:GetInventory(182007405) ~= nil and InventoryList:GetInventory(182007405):GetAmount() >= 2 then
		setupInitialCannon = true;
	end

	-- Retrive cannon name
	local tempcannonRealName = SearchEntityByTypeId(cannonID);
	if tempcannonRealName ~= nil then
		cannonRealName = tempcannonRealName:GetName();
	end
end

function OnClose()
	-- Disable no gravity
	Player:SetNoGravity(false);
	Write("OnClose");
end

function OnFrame()
	-- Setup our initial position
	if setupInitialPosition then
		if setupInitialCannon then
			if ActiveCannon() then
				setupInitialCannon = false;
			end
			return false;
		end

		local result = MoveToBarricade(6);
		if result then
			setupInitialPosition = false;
			Write("We are moved to initial barricade");
		end
		
		return false;
	end
	
	-- Update Barricade state
	if checkForwardBarricadeIsUp and SearchEntityByTypeId(forwardBarricade) == nil then
		-- forward barricade is down. Move to read barricade
		forwardBarricadeIsUp = false;
		if MoveToBarricade(6) then
			checkForwardBarricadeIsUp = false;
			checkNewRecoveryEnergy = true;
			return false;
		end
		Write("Barricate is down. Move to Rear Barricade");
		return false;
	end

	if checkNewRecoveryEnergy and checkNewRecoveryEnergyDelay <= Time() then
		local tempRecoveringEnergy = SearchEntityByTypeId(RecoveringEnergyID);
		if tempRecoveringEnergy ~= nil then
			recoveringEnergyPos = tempRecoveringEnergy:GetPosition();
			checkNewRecoveryEnergy = false;
			Write("New Recovery energy position has found");
		end
	end
	
	-- Search for important entity
	local krallEntity = SearchEntityByTypeId(krallTypeId);
	if krallEntity ~= nil and krallEntity:IsDead() == false then
		local bossIsSkilling = krallEntity:GetSkillID();
		-- Target krall
		if Player:GetTargetID() ~= krallEntity:GetID() then
			Player:SetTarget(krallEntity);
			genericDelay = Time() + 2000;
			return false;
		elseif Player:GetTargetID() == krallEntity:GetID() and bossIsSkilling ~= 0 then
			if Player:GetPosition():DistanceToPosition(krallEntity:GetPosition()) <= 8 then
				-- One shot entity
				--Write("Kill Krall");
				PlayerInput:Ability(415);--("Hell Wave");
				
				-- Loot only if there are 3 or less cannon activated
				if cannonPosCurrent <= 3 then
					needToLootKrall = true;
				end
				
				return false;
			end
		elseif Player:GetTargetID() == krallEntity:GetID() and bossIsSkilling == 0 then
			if CheckAvailable(DestructionOfDarknessID) then
				PlayerInput:Ability(DestructionOfDarknessID);
				return false;
			end
		
			if CheckAvailable(SoulStrikeID) then
				PlayerInput:Ability(SoulStrikeID);
				return false;
			end
		end
		return false;
	end

	if needToLootKrall then
		krallEntity = SearchEntityByTypeId(krallTypeId, false);
		if LootKrall(krallEntity) then
			checkAetherLoot = true;
			checkAetherLootTimer = Time();
			needToLootKrall = false;
			returnBackAfterKrallLoot = true;
		end
		return false;
	elseif checkAetherLoot then
		if checkAetherLootTimer + 1000 > Time() and InventoryList:GetInventory(182007405) ~= nil and InventoryList:GetInventory(182007405):GetAmount() >= 2 then
			needToActiveCannon = true;
			canActivated = true;
			checkAetherLootTimer = Time() - 1000;
		elseif checkAetherLootTimer + 1000 <= Time() then
			checkAetherLoot = false;
		end
		return false;
	elseif needToActiveCannon  then
		if checkAetherLootTimer + 1000 > Time() and InventoryList:GetInventory(182007405) ~= nil and InventoryList:GetInventory(182007405):GetAmount() >= 2 then
			checkAetherLoot = true;
			checkAetherLootTimer = Time();
			return false;
		end

		if canActivated and ActiveCannon() then
			checkAetherLootTimer = Time();
			canActivated = false;
		elseif canActivated == false then
			needToActiveCannon = false;
		end
		return false;
	elseif returnBackAfterKrallLoot then
		local result = MoveToBarricade(6);
		if result then
			returnBackAfterKrallLoot = false;
		end
		return false;
	end
	

	-- Heal
	if (Player:GetHealth() < 30 and checkNewRecoveryEnergy == false) or weAreRecoveryHealth then
		weAreRecoveryHealth = true;
		if weNeedReturnBackAfterRecovery == false and UseRecoveringEnergy() then
			weNeedReturnBackAfterRecovery = true;
			checkNewRecoveryEnergy = true;
			checkNewRecoveryEnergyDelay = Time() + 10000; -- Wait 10second then check Recovery energy
		end
		if weNeedReturnBackAfterRecovery then
			local result = MoveToBarricade();
			if result then
				weNeedReturnBackAfterRecovery = false;
				weAreRecoveryHealth = false;
			end
		end
		return false;
	end

	-- Search for final boss
	local finalBossEntity = SearchEntityByTypeId(finalBossId);
	if finalBossEntity ~= nil then
		airZ = airZBoss;
		finalBossStage = true;
		if moveToGreenAcidPool then
			if MoveToAcidPool() then
				moveToGreenAcidPool = false;
			end
			return false;
		elseif Player:GetTargetID() ~= finalBossEntity:GetID() then -- Target krall
			Player:SetTarget(finalBossEntity);
			airZ = airZBoss;
			genericDelay = Time() + 300;
			return false;
		elseif Player:GetTargetID() == finalBossEntity:GetID() and genericDelay < Time() then
			local dist = Player:GetPosition():DistanceToPosition(finalBossEntity:GetPosition());
			local bossIsSkilling = finalBossEntity:GetSkillID();
			
			-- if boss focus us
			if finalBossEntity:GetTargetID() == playerID then
				-- One shot entity
				if CheckAvailable(HellWaveID) and HellWaveTimer < Time() then
					PlayerInput:Ability(HellWaveID);
					HellWaveTimer = HellWaveTimer + 5000;
					--return false;
				end
				-- Skill
				if CheckAvailable(HellStrikeID) then
					PlayerInput:Ability(HellStrikeID);
					--return false;
				end

				if CheckAvailable(MercilessRuptureID) then
					PlayerInput:Ability(MercilessRuptureID);
					--return false;
				end

				--Write("Dist aggro "..Player:GetPosition():DistanceToPosition(finalBossEntity:GetPosition()));
				if Player:GetPosition():DistanceToPosition(finalBossEntity:GetPosition()) <= 8 then
					EscapeAggro();
				end
				weNeedReturnBack = true;
				return false;
			end
			
			-- Boss skill. escape
			if bossIsSkilling ~= 0 and bossIsSkilling ~= finalBossDischarge then
				-- No taget skill
				if CheckAvailable(DestructionOfDarknessID) then
					PlayerInput:Ability(DestructionOfDarknessID);
					--return false;
				end
				
				if CheckAvailable(SoulStrikeID) then
					PlayerInput:Ability(SoulStrikeID);
					--return false;
				end

				MoveForwardBarricade();
				weNeedReturnBack = true;
				return false;
			end

			if weNeedReturnBack then
				local result = MoveToBarricade(0);
				if result then
					weNeedReturnBack = false;
				end
				return false;
			end

			if Player:GetPosition():DistanceToPosition(finalBossEntity:GetPosition()) <= 10 and CountMobs(20) <= 200 then
				-- One shot entity
				if CheckAvailable(HellWaveID) and HellWaveTimer < Time() then
					PlayerInput:Ability(HellWaveID);
					HellWaveTimer = HellWaveTimer + 5000;
					return false;
				end

				if CheckAvailable(HellStrikeID) then
					PlayerInput:Ability(HellStrikeID);
					return false;
				end

				if CheckAvailable(MercilessRuptureID) then
					PlayerInput:Ability(MercilessRuptureID);
					return false;
				end
				return false;
			else
				-- One shot entity
				if CheckAvailable(HellWaveID) and HellWaveTimer < Time() then
					PlayerInput:Ability(HellWaveID);
					HellWaveTimer = HellWaveTimer + 5000;
					return false;
				end
				
				if CheckAvailable(DestructionOfDarknessID) then
					PlayerInput:Ability(DestructionOfDarknessID);
					return false;
				end
			
				if CheckAvailable(SoulStrikeID) then
					PlayerInput:Ability(SoulStrikeID);
					return false;
				end
			end
		end
		return false;
	end

	-- Instance complete
	if finalBossStage and finalBossEntity == nil and moveToExpPearl then
		if forwardBarricadeIsUp then
			if MoveToBarricade(-6) then
				moveToExpPearl = false;
			end
		else
			if MoveToBarricade(6) then
				moveToExpPearl = false;
			end
		end
		stopScriptTimer = Time() + 10000;
	end

	-- Micro teleport to avod to lose mob's aggro
	if canMicroTeleport and finalBossStage == false then
		MicroTeleport();
	end

	if CheckAvailable(DestructionOfDarknessID) then
		PlayerInput:Ability(DestructionOfDarknessID);
		return false;
	end

	if CheckAvailable(SoulStrikeID) then
		PlayerInput:Ability(SoulStrikeID);
		return false;
	end

	if moveToExpPearl == false then
		if stopScriptTimer > Time() then
			Player:SetNoGravity(false);
		else
			local ourFinalPos = Player:GetPosition();
			ourFinalPos.Y = ourFinalPos.Y + 2;
			Player:SetMove(ourCurrentPos);
			Close();
		end
	end

	return true;
end

-- Move to acid pool
function MoveToAcidPool()
	--Write("MoveToAcidPool");
	local tempTimer = Time();
	local elapsedTime = tempTimer - offsetTimer;
	
	if elapsedTime < updatePositionTime then
		return false;
	end
	
	local d = moveSpeed * updatePositionTime / 1000;
	local ourCurrentPos = Player:GetPosition();
	local newY = ourCurrentPos.Y + d;

	if newY > 250 then
		Player:SetPosition(centerRoomX, 250, airZ);
		return true;
	else
		Player:SetPosition(centerRoomX, newY, airZ);
	end
	offsetTimer = tempTimer;

	return false;
end

--Active cannon
function ActiveCannon()
	if stepActiveCannon == 0 then
		local tempTimer = Time();
		local elapsedTime = tempTimer - offsetTimer;
	
		if elapsedTime < updatePositionTime then
			return false;
		end
	
		local d = moveSpeed * updatePositionTime / 1000;
		local ourCurrentPos = Player:GetPosition();

		if stepMoveToCannon == 0 then
			local newY = ourCurrentPos.Y - d;
			if newY < cannonPos[cannonPosCurrent][2] - moveSpeed then
				ourCurrentPos.Y = newY + d + d;
				Player:SetPosition(ourCurrentPos);
			elseif newY < cannonPos[cannonPosCurrent][2] then
				ourCurrentPos.Y = cannonPos[cannonPosCurrent][2];
				Player:SetPosition(ourCurrentPos);
				stepMoveToCannon = stepMoveToCannon + 1;
			else
				ourCurrentPos.Y = newY;
				Player:SetPosition(ourCurrentPos);
			end
		elseif stepMoveToCannon == 1 then
			local newX = ourCurrentPos.X + d;
			
			if newX > cannonPos[cannonPosCurrent][1] then
				ourCurrentPos.X = cannonPos[cannonPosCurrent][1];
				Player:SetPosition(ourCurrentPos);
				stepMoveToCannon = stepMoveToCannon + 1;
			else
				ourCurrentPos.X = newX;
				Player:SetPosition(ourCurrentPos);
			end
		elseif stepMoveToCannon == 2 then
			ourCurrentPos.Z = airZ - 2;
			Player:SetPosition(ourCurrentPos);
			stepMoveToCannon = 0;
			stepActiveCannon = stepActiveCannon + 1;
		end
		offsetTimer = tempTimer;
		return false;
	elseif stepActiveCannon == 1 then
		local hDialog = DialogList:GetDialog( "dlg_dialog" );

		if hDialog ~= nil and hDialog:IsVisible() then
			DialogList:GetDialog("dlg_dialog/html_view/"..cannonType):Click();
			selectCannonNPC = false;
			return false;
		elseif selectCannonNPC then
			PlayerInput:Console("/Select "..cannonRealName)
			PlayerInput:Console("/Attack");
			return false;
		end
		cannonType = 3;
		stepActiveCannon = stepActiveCannon + 1;
		return false;
	elseif stepActiveCannon == 2 then
		local tempTimer = Time();
		local elapsedTime = tempTimer - offsetTimer;
		
		if elapsedTime < updatePositionTime then
			return false;
		end
		
		local d = moveSpeed * updatePositionTime / 1000;
		local ourCurrentPos = Player:GetPosition();

		if stepMoveToCannon == 0 then
			ourCurrentPos.Z = airZ;
			Player:SetPosition(ourCurrentPos);
			stepMoveToCannon = stepMoveToCannon + 1;
		elseif stepMoveToCannon == 1 then
			local newX = ourCurrentPos.X - d;
			if newX < centerRoomX then
				ourCurrentPos.X = centerRoomX;
				Player:SetPosition(ourCurrentPos);
				stepMoveToCannon = stepMoveToCannon + 1;
			else
				ourCurrentPos.X = newX;
				Player:SetPosition(ourCurrentPos);
			end
		elseif stepMoveToCannon == 2 then
			local result = MoveToBarricade(6);
			if result then
				stepMoveToCannon = 0;
				stepActiveCannon = 0;
				selectCannonNPC = true;
				cannonPosCurrent = cannonPosCurrent + 1;
				return true;
			end
		end
		offsetTimer = tempTimer;
	end

	return false;
end

-- Loot krall
function LootKrall(krallEntity)
	if stepLootKrall == 0 then
		local ourCurrentPos = Player:GetPosition();
		ourCurrentPos.Z = airZ - 2;
		Player:SetPosition(ourCurrentPos);
		stepLootKrall = stepLootKrall + 1;
		return false;
	elseif stepLootKrall == 1 and lootKrallCount <= 20 then
		PlayerInput:Ability( "Loot" );
		--Write("loot "..lootKrallCount);
		lootKrallCount = lootKrallCount + 1;
		return false;
	elseif stepLootKrall == 2 then
		local ourCurrentPos = Player:GetPosition();
		ourCurrentPos.Z = airZ;
		Player:SetPosition(ourCurrentPos);
		stepLootKrall = stepLootKrall + 1;
		return false;
	end

	lootKrallCount = 0;
	stepLootKrall = 0;

	return true;
end

--
function UseRecoveringEnergy()
	if Player:GetHealth() < 30 and recoveringEnergyReversePath == false then
		local tempTimer = Time();
		local elapsedTime = tempTimer - offsetTimer;
		
		if elapsedTime < updatePositionTime then
			return false;
		end
		
		local d = moveSpeed * updatePositionTime / 1000;
		local ourCurrentPos = Player:GetPosition();

		if stepRecoveryEnergy == 0 then
			local newY = ourCurrentPos.Y - d;
			if newY < recoveringEnergyPos.Y - moveSpeed then
				ourCurrentPos.Y = newY + d + d;
				Player:SetPosition(ourCurrentPos);
			elseif newY < recoveringEnergyPos.Y then
				ourCurrentPos.Y = recoveringEnergyPos.Y;
				Player:SetPosition(ourCurrentPos);
				stepRecoveryEnergy = stepRecoveryEnergy + 1;
			else
				ourCurrentPos.Y = newY;
				Player:SetPosition(ourCurrentPos);
			end
		elseif stepRecoveryEnergy == 1 then
			local newX = ourCurrentPos.X + d;
			if newX > recoveringEnergyPos.X then
				ourCurrentPos.X = recoveringEnergyPos.X;
				Player:SetPosition(ourCurrentPos);
				stepRecoveryEnergy = stepRecoveryEnergy + 1;
			else
				ourCurrentPos.X = newX;
				Player:SetPosition(ourCurrentPos);
			end
		elseif stepRecoveryEnergy == 2 then
			ourCurrentPos.Z = groudZ;
			Player:SetPosition(ourCurrentPos);
			stepRecoveryEnergy = 0;
			recoveringEnergyReversePath = true;
		end

		offsetTimer = tempTimer;
	elseif Player:GetHealth() > 80 and recoveringEnergyReversePath then
		local tempTimer = Time();
		local elapsedTime = tempTimer - offsetTimer;
		
		if elapsedTime < updatePositionTime then
			return false;
		end
		
		local d = moveSpeed * updatePositionTime / 1000;
		local ourCurrentPos = Player:GetPosition();

		if stepRecoveryEnergy == 0 then
			ourCurrentPos.Z = airZ;
			Player:SetPosition(ourCurrentPos);
			stepRecoveryEnergy = stepRecoveryEnergy + 1;
		elseif stepRecoveryEnergy == 1 then
			local newX = ourCurrentPos.X - d;
			if newX < centerRoomX then
				ourCurrentPos.X = centerRoomX;
				Player:SetPosition(ourCurrentPos);
				stepRecoveryEnergy = 0;
				recoveringEnergyReversePath = false;
				return true;
			else
				ourCurrentPos.X = newX;
				Player:SetPosition(ourCurrentPos);
			end
		end

		offsetTimer = tempTimer;
	end
	
	return false;
end

-- Escape if we are focuse
function EscapeAggro()
	--Write("EscapeAggro");
	if goToStartRoom then
		local tempTimer = Time();
		local elapsedTime = tempTimer - offsetTimer;
	
		if elapsedTime > updatePositionTime then
			local d = moveSpeed * updatePositionTime / 1000;
			
			local ourCurrentPos = Player:GetPosition();
			local newY = ourCurrentPos.Y - d;
			
			if newY < 190 then
				Player:SetPosition(centerRoomX, 190, airZ);
				weAreAtStartRoomPos = true;
				goToStartRoom = false;
				return true;
			else
				Player:SetPosition(centerRoomX, newY, airZ);
			end
			offsetTimer = tempTimer;
		end
	else
		if MoveToBarricade(10) then
			weAreAtStartRoomPos = false;
			goToStartRoom = true;
			return true;
		end
	end

	return false;
end

-- Micro teleport to avoid loss aggro
function MicroTeleport()
	--Write("MicroTeleport");
	
	local tempTimer = Time();
	local elapsedTime = tempTimer - offsetTimer;
	
	if elapsedTime > updatePositionTime then
		local d = moveSpeed * updatePositionTime / 1000;
			
		local ourCurrentPos = Player:GetPosition();
		local newX = 0;
		if microTeleportStep == 0 then
			newX = ourCurrentPos.X + d;
		elseif microTeleportStep == 1 then
			newX = ourCurrentPos.X - d;
		end	
		if newX >= 233 and microTeleportStep == 0 then
			Player:SetPosition(233, ourCurrentPos.Y, airZ);
			microTeleportStep = 1;
		elseif newX <= 226 and microTeleportStep == 1 then
			Player:SetPosition(226, ourCurrentPos.Y, airZ);
			microTeleportStep = 0;
		else
			Player:SetPosition(newX, ourCurrentPos.Y, airZ);
		end
		offsetTimer = tempTimer;
	end

	return true;
end

-- Move To Barricade
function MoveToBarricade(barricadeOffset)
	--Write("MoveToBarricade");
	local currentBarricadeY;
	
	local _barricadeOffset = 3;
	if barricadeOffset ~= nil then
		_barricadeOffset = barricadeOffset;
	end

	if forwardBarricadeIsUp then
		currentBarricadeY = forwardBarricadePos.Y + _barricadeOffset;
	else
		currentBarricadeY = readBarricadePos.Y + _barricadeOffset;
	end
	
	local tempTimer = Time();
	local elapsedTime = tempTimer - offsetTimer;

	if elapsedTime > updatePositionTime then
		local d = moveSpeed * updatePositionTime / 1000;
		
		local ourCurrentPos = Player:GetPosition();
		--local newY = ourCurrentPos.Y + d;
		if math.abs(ourCurrentPos.Y - currentBarricadeY) <= d then
			Player:SetPosition(centerRoomX, currentBarricadeY, airZ);
			return true;
		elseif ourCurrentPos.Y < currentBarricadeY then
			Player:SetPosition(centerRoomX, ourCurrentPos.Y + d, airZ);
		elseif ourCurrentPos.Y > currentBarricadeY then
			Player:SetPosition(centerRoomX, ourCurrentPos.Y - d, airZ);
		end
		offsetTimer = tempTimer;
	end
	
	return false;
end

-- Move forward barricate
function MoveForwardBarricade(barricadeOffset)
	--Write("MoveForwardBarricade");
	local currentBarricadeY;
	
	local _barricadeOffset = 3;
	if barricadeOffset ~= nil then
		_barricadeOffset = barricadeOffset;
	end

	if forwardBarricadeIsUp then
		currentBarricadeY = forwardBarricadePos.Y + _barricadeOffset;
	else
		currentBarricadeY = readBarricadePos.Y + _barricadeOffset;
	end
	
	local tempTimer = Time();
	local elapsedTime = tempTimer - offsetTimer;

	if elapsedTime > updatePositionTime then
		local d = moveSpeed * updatePositionTime / 1000;
		local ourCurrentPos = Player:GetPosition();
		local newY = ourCurrentPos.Y - d;
		
		if currentBarricadeY - newY > moveDistance then
			Player:SetPosition(centerRoomX, currentBarricadeY - moveDistance, airZ);
			return true;
		else
			Player:SetPosition(centerRoomX, newY, airZ);
		end
		offsetTimer = tempTimer;
	end
	
	return false;
end

-- Search for entity
function SearchEntityByTypeId (typeId, checkDeadState)
	local _checkDeadState = true;
	if checkDeadState ~= nil then
		_checkDeadState = checkDeadState;
	end

	for ID, TempEntity in DictionaryIterator(EntityList:GetList()) do
		local tempTypeId = TempEntity:GetTypeID();

		if tempTypeId == typeId and (TempEntity:IsDead() == false or _checkDeadState == false) then
			return TempEntity;
		end
	end

	return nil;
end

-- Count how many mob target us
function CountMobsFocusPlayer(dist)
	local i = 0;
	
	-- Iterate through all entities
	for ID, Entity in DictionaryIterator( EntityList:GetList()) do
		
		local mobRange = Player:GetPosition():DistanceToPosition( Entity:GetPosition());	
		
		-- Add Mob
		if Entity ~= nil and not Entity:IsFriendly() and Entity:GetTargetID() == playerID and Entity:GetHealth() > 0 and mobRange <= dist then--Entity:IsHostile() and 
			i = i + 1;
		end
	
	end
	
	return i;	
end

function CountMobs(dist)
	local i = 0;
	
	-- Iterate through all entities
	for ID, Entity in DictionaryIterator( EntityList:GetList()) do
		
		local mobRange = Player:GetPosition():DistanceToPosition( Entity:GetPosition());	
		
		-- Add Mob
		if Entity ~= nil and not Entity:IsFriendly() and Entity:GetHealth() > 0 and mobRange <= dist then--Entity:IsHostile() and 
			i = i + 1;
		end
	
	end
	
	return i;	
end

function WeReachedPosition(destination)
	if Player:GetPosition():DistanceToPosition(destination) < 5 then
		return true;
	end

	return false;
end


--[[

	--------------------------------------------------
	Copyright (C) 2011 Blastradius

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
	--------------------------------------------------
	
]]--

--- Check if the provided ability is available and has cooled down.
--
-- @param	string	Name of the ability to check.
-- @param	bool	Indicates whether or not to skip the activation check.
-- @return	boolean

function CheckAvailable( Name, SkipActivation )
	-- Retrieve the ability with the provided name.
	local Ability = AbilityList:GetAbility( Name );
	
	-- Check if the ability is valid and is not in cooldown.
	if Ability ~= nil and Ability:GetCooldown() == 0 and ( SkipActivation ~= nil or Ability:GetActivated()) then
		return true;
	end
	
	-- Either we do not have the ability or it is in cooldown.
	return false;
end
Last edited by cooco on Wed Nov 22, 2017 3:28 pm, edited 7 times in total.

User avatar
smaion40
Posts: 83
Joined: Tue Apr 25, 2017 12:11 pm
Has thanked: 42 times
Been thanked: 16 times

Re: Lunar Hell Pass Script

Post by smaion40 » Mon Oct 02, 2017 1:44 am

This is the same as Contaminated Underpath for NA, aka Luna Daily?.

The option with a tutorial about how to make the script is waaaay more productive in my opinion, this will also help people to understand how scripting inside instances work and therefore allow them to create for other instances and share.

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Re: Lunar Hell Pass Script

Post by cooco » Mon Oct 02, 2017 10:55 am

smaion40 wrote:
Mon Oct 02, 2017 1:44 am
This is the same as Contaminated Underpath for NA, aka Luna Daily?.

The option with a tutorial about how to make the script is waaaay more productive in my opinion, this will also help people to understand how scripting inside instances work and therefore allow them to create for other instances and share.
Yes. Contaminated Underpath

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Re: Lunar Hell Pass Script

Post by cooco » Fri Oct 13, 2017 11:53 pm

Beta version script code :)

vivi
Posts: 21
Joined: Wed Feb 08, 2017 11:21 pm
Been thanked: 4 times

Re: Lunar Hell Pass Script

Post by vivi » Sat Oct 14, 2017 2:44 am

i have tested it with 2 runs, 1 was rank A, other one was rank B, i think you need to put those cannons to have a constant rank a/s script

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Re: Lunar Hell Pass Script

Post by cooco » Sat Oct 14, 2017 12:18 pm

do u know the difference between cannon? how to choose them?

vivi
Posts: 21
Joined: Wed Feb 08, 2017 11:21 pm
Been thanked: 4 times

Re: Lunar Hell Pass Script

Post by vivi » Sat Oct 14, 2017 4:37 pm

mmm i dont really know, since it is a dialog like npc with different options maybe with the DialogList:GetDialog() is any option to point to x number of dialog option? it could solve the issue.

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Re: Lunar Hell Pass Script

Post by cooco » Sat Oct 14, 2017 5:17 pm

vivi wrote:
Sat Oct 14, 2017 4:37 pm
mmm i dont really know, since it is a dialog like npc with different options maybe with the DialogList:GetDialog() is any option to point to x number of dialog option? it could solve the issue.
I mean the difference between each cannon, i just active alway cannon 3. What the difference with cannon 1/2/3? :?

vivi
Posts: 21
Joined: Wed Feb 08, 2017 11:21 pm
Been thanked: 4 times

Re: Lunar Hell Pass Script

Post by vivi » Sat Oct 14, 2017 10:04 pm

cooco wrote:
Sat Oct 14, 2017 5:17 pm
vivi wrote:
Sat Oct 14, 2017 4:37 pm
mmm i dont really know, since it is a dialog like npc with different options maybe with the DialogList:GetDialog() is any option to point to x number of dialog option? it could solve the issue.
I mean the difference between each cannon, i just active alway cannon 3. What the difference with cannon 1/2/3? :?
The 2nd option is the aoe cannon for tons of mobs, the 3rd one is the one target for horses/bosses.

Since this is full afk it may be a good idea to just use the 2nd cannon once and the rest the 3rd one.

I dunno what other people use as cannon strategy.

cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Re: Lunar Hell Pass Script

Post by cooco » Sat Oct 14, 2017 10:47 pm

Tnx for info :mrgreen:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest