Jump to content

toastonrye

Member
  • Posts

    2
  • Joined

  • Last visited

toastonrye's Achievements

  1. function ISWorldMap:onRightMouseUp(x, y) local playerNum = 0 local playerObj = getSpecificPlayer(playerNum) if not playerObj then return end local context = ISContextMenu.get(playerNum, x + self:getAbsoluteX(), y + self:getAbsoluteY()) local worldX = self.mapAPI:uiToWorldX(x, y) local worldY = self.mapAPI:uiToWorldY(x, y) if getWorld():getMetaGrid():isValidChunk(worldX / 10, worldY / 10) then option = context:addOption("Teleport: " .. math.floor(worldX) .. " | " .. math.floor(worldY), self, self.onTeleport, worldX, worldY) end return true end After the above option is clicked on, I'd like to run self:close() to close the map. I see in ISContextMenu.lua there is: function ISContextMenu:onMouseDown(x, y) end But I can't work it out.
  2. I'm trying to wrap my head around the java docs, how to work with them. Looking at getSpecificPlayer(0), it looks like IsoPlayer is returned, https://projectzomboid.com/modding/zombie/characters/IsoPlayer.html Question 1: How do I know which getX() and getY() they are using? -Methods inherited from class zombie.iso.IsoMovingObject -Methods inherited from interface zombie.chat.ChatElementOwner I had also tried doing a local targeted = tostring(plr:targetedByZombie()). Referencing a snipped of code, from another mod, plus the targeted variable stuff I added: Question 2: How do I determine what functions can be used with plr: ? local plr = getSpecificPlayer(0); if not plr then return 1; end local posX = math.floor(plr:getX()); local posY = math.floor(plr:getY()); local targeted = plr:targetedByZombie(); -- error local txt1 = "x:" .. posX .. " y:" .. posY .. " t: " .. targeted; edit: My question was answered in the Discord, I was using a field not a function. The function should have been :isTargetedByZombie()
×
×
  • Create New...