Jump to content

Vanek

Member
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Vanek

  1. Hey ZimTown, Sorry, this got lost in my inbox I did manage to get the console to print out usable names for me. This is how I did it. This function prints out whatever is on the gridSquare under the mouse cursor. You could easily adapt it to whatever is under the player or npc, etc. function objectsUnderMouse() local world = getWorld(); local cell = world:getCell(); local mx = getMouseX(); local my = getMouseY(); local player = getPlayer(); local wz = math.floor(player:getZ()); local wx, wy = ISCoordConversion.ToWorld(mx, my, wz); wx = math.floor(wx); wy = math.floor(wy); print("Under the mouse:"); local square = cell:getGridSquare(wx, wy, wz); local objects = square:getObjects(); for i=0, objects:size() - 1 do print(i); local v = objects:get(i); local t = v:getTextureName(); print(t); endendI hope that helps
  2. Thanks I certainly hope I'll be able to get them done! Baby steps.
  3. Yea, that's closer but still only returns IsoObject.
  4. Can anyone make sense of my terminal output? When I run this, this is what I get: We're in the create menu entries function! table 0x145836625 zombie.iso.IsoObject@2f86104c nil It seems as if it is fetching the clicked objects properly (at least the first item, assuming there are multiples if a sink is clicked). And it seems that the object I am getting is one of IsoObject type. However, when I call the getName function on it I get no value returned. Edit: it seems there is also a function called getObjectName. I tried it and it does return a result, however, that result is simply IsoObject. function PZMDHygiene.createMenuEntries(_player, _context, _worldObjects) print("We're in the create menu entries function!"); local player = getSpecificPlayer(_player); local objects = _worldObjects; local objectName; local waterSource; print(objects); -- Output all of the objects to terminal. for _, object in ipairs(objects) do objectName = object:getName(); print(object); print(objectName); endend
  5. Huzzah! I figured it out. Turns out I was working with the wrong Event. I needed OnPreFillWorldObjectContextMenu. Duh... Thanks Aricane I just saw that as I posted my reply.
  6. So, it seems I'm already stuck I'm starting to remember how it felt when I was learning ObjC and XCode I apologise if I'm a little needy as I'm getting started. So, I wanted to start really small. I just wanted my mod to simply output a line to the terminal when the player right-clicked (i.e. print to terminal when a context menu is created). So, I wrote the most basic code possible I believe: PZMDHygiene = {};-- ----------------- ---- --- Functions --- ---- ----------------- ---- Create the context menu items.function PZMDHygiene.createMenuEntries() print("We're inside the context menu creation function.")end-- ------------- ---- --- Hooks --- ---- ------------- --Events.OnPreFillInventoryObjectContextMenu.Add(PZMDHygiene.createMenuEntries);I booted into PZ and the terminal window informed me that my lua file was being loaded. However, when I started in Sandbox mode, nothing happened when I right clicked. Does print perhaps not print to the terminal?
  7. So I ran PZ with the -Ddebug flag but no joy on the F11 (or any other F-key) bringing something up. I also tried running it via Terminal but it gave me an error "Trace/BPT trap 5" whatever that means. I wonder if I can't run a Steam game via Terminal? Or am I missing something? I just ran the Project Zomboid.app with the "open" command. Edit: I just found the little video RathLord made re: getting terminal output. So, that'd good now
  8. I'm not sure if I'm just not looking in the right place or if there's something different with the OSX architecture but I don't seem to have a media/src folder in my PZ. The closest I could find was media/lua/client(or server or shared) which contained a number of folders of lua files (e.g. Camping, NPCs, Xp System, etc.).
  9. Perfect! Thanks RoboMat. I'll see what I can get accomplished.
  10. Oh, I was curious. If the player right clicks over some tile (for instance, the tile holding the sink/tub/etc.) does it return a list of "objects" that are on that tile including the "tile type"? Or would it be blank since there aren't any objects on that tile other than the tile itself? Rawr...Forum spam...The bulk of my coding has been done re: iOS apps, so I'm used to all my debugging and coding being done in one area. Is there a way for me to put PZ into a debug mode so I can see what's going on at a code level? Or at least get a terminal output type of situation?
  11. I'm living in NSW, Australia at the moment so I'm running on Australian Eastern Time. 8:45 PM here at the moment. I certainly hope so! Is there somewhere I can find a library of the current code? Or is it just the javadocs?
  12. Hey Aricane, I've read a couple of your articles, they've been a great help. Thank you. Yea, that's pretty much what I've got laid out in my pseudo-code I'm pretty comfortable with Obj-C but Java and LUA is new to me so it'll be a learning experience. Thanks for the links! I'd read through the Events Reference one before but the others I hadn't seen. It look as if I should be able to get it done with that. Thanks again. I'll drop another post when I have it done! Cheers, - Vanek
  13. Hi all, First off I just want to say that I love PZ and I am excited to watch it grow into something great. I've been playing for a while now and I wanted to try my hand at creating a mod or two. I have an idea for a series of mods that I'm going to start working on called PZMD. I'm a medical student and basically, I'd like to try and inject some more realism regarding human physiology, medicine, pharmacology, etc. However, a lot of this is pretty complex so I wanted to start somewhere easy so my first mod is going to be "PZMD Hygeine". This is what I would like to to do: Track player hygeine level and have effects based around poor/good hygiene (increased happiness, decreased chance of infection, etc.) Allow player to perform hygiene related actions such as brush teeth, shower, wash hands, etc. To that end, I've decided to start with the "Brush Teeth" action. I'd like to use the existing toothbrush and toothpaste items in the players inventory to allow for the activation of a timed action when either the player right clicks on a water source (e.g. sink, bathtub) or has a water source in their inventory (e.g. bottle of water). So, I've started but I think I need a little direction. I've been trying to do some reverse engineering (RoboMat's Lockpicking mod) and I've been looking through the javadocs but I can't seem to figure out how to determine if the player is clicking on a water source item or not. Getting the inventory shouldn't be too difficult but I'm a little lost with the other bits. If any one could havefer a nudge in the right direction, that would be great. Thanks! Cheers, - Vanek
×
×
  • Create New...