Jump to content


  • Posts

  • Joined

  • Last visited

Kenneth's Achievements

  1. I still don't know how to loop through IsoFlagType:values() but I did found a workaround. local function getIsoFlag(propertyContainer) for i, value in pairs(IsoFlagType) do if value and type(value) == "userdata" and value.index and propertyContainer:Is(value) then print("Found IsoFlagType->") print("IsoFlagType: ",value , " type: ",type(value), " index: ",value:index()) return true end end end print(getIsoFlag(getPlayer():getSprite():getProperties()))
  2. How can I easily reload mode entirely? Without needing to go back to main menu and reload mod there. I want to reload mod directly from the lua debugger. I already saw you can reload files.
  3. I want to loop through the values of IsoFlagType[] IsoFlagType:values() --This returns a userdata Since that returns lua userdata how would I go about looping through array since the IsoFlagType.lua says it returns array of IsoFlagType[] ---@public ---@return IsoFlagType[] function IsoFlagType:values() end
  4. The reason I am doing this is I want have the effect of you monitoring a camera like cctv camera. I already got the code to hide the player and move him to a position (the shadow still shows) and I also give him ghostmode.
  5. Hey so I want to prevent player from doing any actions or any states. So far I found a method that prevents player from using walk keys to move around getPlayer():setBlockMovement(true) This will prevent movement keys to not work which I want. But I also want to prevent him from interacting with object around him like opening door etc. I want to also completely hide the UI on your screen and also when right clicking an object also hide the context menu.
  6. To disable the player movements and also interaction with context menu. So far I found getPlayer():setBlockMovement(true) --Prevent movement keys to work local function clearContext(player, context, worldObjects, test) context:clear() end Events.OnFillWorldObjectContextMenu.Add(clearContext) --To turn of all UI on screen use if ISUIHandler.allUIVisible == true then ISUIHandler.toggleUI() end
  7. It seems to me I can get non moving objects using. local function getWorldObjectWhenRightClicking(player, context, worldObjects, test) print("player",player) print("context ",context) print("worldObject ",worldObjects) print("test ",test) for i, v in pairs(worldObjects) do print("i ",i, " v ",v) v:removeFromSquare() end end Events.OnFillWorldObjectContextMenu.Add(getWorldObjectWhenRightClicking) But I can't find the vehicle. Even when I click on zombie it doesn't remove the zombie.
  8. @stuck1a I have another question. Can you help me with I will send link to the post.
  9. How would a get an vehicle when right clicking on it or a door or any other object?
  10. I can share the the code here. I get IsoChunks around the player you can just adjust the values if you want it bigger. local function getField(class, fieldName) local i = 0 while true do local field = getClassField(class,i) if field:getName() == fieldName then return getClassFieldVal(class,field) end i = i + 1 end end local function getVehiclesAroundPlayer() local currentCell = getWorld():getCell() --works local player = getPlayer() local halfSize = 20 --Increase by 10 to get more chunks local varX = player:getX() - halfSize local varY = player:getY() - halfSize local yOrigin = varY local incr = 10 local fullSize = halfSize * 2 local allVehicles = {} for _ = 0, fullSize, incr do for _ = 0, fullSize, incr do local chunk = currentCell:getChunkForGridSquare(varX, varY, 0) if not chunk then return end print(chunk) local baseVehicles = getField(chunk,"vehicles") for i = 0, baseVehicles:size()-1 do local vehicle = baseVehicles:get(i) local alreadyFound = false for _, car in ipairs(allVehicles) do if car:getId() == vehicle:getId() then alreadyFound = true break end end if alreadyFound == false then table.insert(allVehicles,vehicle) end print("vehicle Id: ",getField(vehicle,"VehicleID")) end varY = varY + incr end varY = yOrigin varX = varX + incr end return allVehicles end getVehiclesAroundPlayer()
  11. So I have thought that the reason I don't want to use that because if you are close to the edge of a cell won't it disregard vehicles in adjacent cells. What I currently am doing is getting IsoChunk around player and then get vehicles from those chunks.
  12. Hey @stuck1a thanks for the reply I think it would be best to use the methods if you find the method like you showed. But where I got stuck was at IsoChunk.vehicles I was unable to find a method to get me the vehicles in an iso chunk.
  13. A Solution I found was --Doesn't work on private java fields local indexOfField = 21 --CanHearAll local player = getPlayer() local field = getClassField(player,indexOfField) local value = getClassFieldVal(player, field) print(value) To get the index of field 0 then count in the java class files until you reach your field I wrote a function that does this for you and get field local function getField(class, fieldName) local i = 0 while true do local field = getClassField(class,i) if field:getName() == fieldName then return getClassFieldVal(class,field) end i = i + 1 end end print(getField(getPlayer(), "closestZombie"))
  14. When I get the player class getPlayer() then I want to index a field it gives me nil. Why can't I index fields from class but only methods? Example The java IsoPlayer closestZombie field in a public float But in a lua script below getPlayer().closestZombie --Gives me nil
  • Create New...