首页 > 白马西风 > lazyscript自定义判断范例
2023
10-17

lazyscript自定义判断范例

来自https://github.com/laytya/LazyScript/commit/0e3e5dbc6a2fca7f38a9b3c209ecc19325a8b170
自定义判断战士是否装备盾牌

	-- checks to see if a shield is equipped (get from Zorlen)
	function lazyWarrior.masks.isShieldEquipped()
		local slot = GetInventorySlotInfo("SecondaryHandSlot")
		local link = GetInventoryItemLink("player", slot)
		if link then
			local id, name = lazyScript.IdAndNameFromLink(link)
			local _, _, _, _, _, itemSubType = GetItemInfo(id)
			if itemSubType == ITEM_SUBTYPE_SHIELDS then 						
				if GetInventoryItemBroken("player", slot) then
					return false
				end
				return true
			end
		end
		return false
	end

	function lazyScript.bitParsers.ifShieldEquipped(bit, actions, masks)
		if (not lazyScript.rebit(bit, "^if(Not)?ShieldEquipped$")) then
			return false
		end
		local negate = lazyScript.negate1()
		table.insert(masks, lazyScript.negWrapper(lazyWarrior.masks.isShieldEquipped, negate))
		return true
	end
觉得文章有用,微信打赏一元。



留下一个回复

你的email不会被公开。