Jump to content

RAINBOW

Member
  • Posts

    103
  • Joined

  • Last visited

Everything posted by RAINBOW

  1. http://www.sanctuary-pz.com/#!tutorialvegetarian/c1su There's that link to the tutorial I promised- At the moment it shows you how to hook your custom code into any existing code. So if, until now, all you've managed to do is "Add" things in by modding, give it a shot.- it's fairly comprehensive- but the format is scrappy I'll clean it up later. Note: The "Setting up" and other tutorials haven't been put in yet- actually, I'm not going to pretend anyone (Me included) can do as good a job as the robomat tutorial. So do it first. don't jump ahead.
  2. I was on another forum here: http://www.theindiestone.com/community/viewtopic.php%3Ff=38&t=7202.html where I discovered Moodles are not customisable/moddable yet. Actually, in truth, I discovered it when I was writing code for my custom trait "Vegetarian", when I reached the point of adding in a custom sickness- I started coding my own custom "Disease/poison" system, which was going to be put on a custom character token and all in all turn into a nightmare!- And then, I found the afforementioned (Link) forum, explaining it hasn't been implemented yet! If anyone else is currently trying to add/alter Moodles (Oh! A moodle example might be, Panic, Hunger, Boredom, Sickness... Etc ... etc..) it simply isn't supported yet- I've written all of my code for the custom vegetarian trait, apart from the code chunk which will implement sickness/sickness amount, I reached this point: --lots of stuff here player:getStats():getSickness(); Which I'm certain a few other(Serious) modders have. Instead, I'm turning my efforts into a tutorial for people looking to learn more about modding. It basically follows on from Robomats (Excellent) tutorial on adding a custom trait and profession, if you haven't done it yet, check it out here: http://theindiestone.com/forums/index.php/topic/61-robomats-modding-tutorials-updated-12112013/ It's a small follow on. I'll edit this post once I finish the tutorial, oh, it will be found on our persistent world servers "TUTORIAL" section. Check it out!
  3. Agh! Nevermind, I went back to it after a cup of tea, was calling a bloody nil table for the 1000th time, if anyone reading this ever see's the error "Called T nil table" or whatever it is, it is because one of your vars is undeclared. thing is working perfectly now. lol ! Sorry I bloody wasted everyones time. Here's some working code: RClickMenu = {}; --The player has right clicked the menu. If shit happens, do shit.function RClickMenu.init(player, context, items) --custom SANCTUARY here:function ISEatFoodAction:perform()-- do fun code stuff hereself.character:Say('Never Gonna Give You Up');endend Events.OnFillInventoryObjectContextMenu.Add(RClickMenu.init); Fixed code-tags. -RM
  4. I don't! There's just no "Event" in the "ISEatFoodAction.lua" for me to hook into
  5. The problem I have discovered, is I can hook into the Event fired in the "Right Click Inventory Panel" which is found here: C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\ISUI\ISInventoryPaneContextMenu.lua" here's some sample code that fires okay from right clicking in game: --The player has right clicked the menu. function RClickMenu.init(player, context, items) --debugplayer:Say("AAAAAAAA"); end Events.OnFillInventoryObjectContextMenu.Add(RClickMenu.init);But! what about when I want to access the code within, in particular, the "ISEatFoodAction.perform"?
  6. I'm eagerly awaiting your next post in this tutorial RoboMat, I'm hoping you will show a successful example of overloading a function. Also, sec_goat- The only difference between your folder structure there, and mine- is your "Mods/" folder is capitalised. Mine is spelled with a lower case 'm'. so "C:\Users\User\Zomboid\mods\SanctuaryMod\media\lua\mods\SanctuaryMod" is where my custom stuff lies within. Your code works fine.
  7. 3D modelling is relatively easy, I have been making models in 3DS max, Autodesk Maya and SoftImage for quite a long time now! Unfortunately, adding in 3D models isn't supported yet in PZ, but the dev teams intent is to allow it later on, I suspect there is just far too much that is higher priority. Am I ambitious? Perhaps. I prefer to believe I am just thinking long term, I've already recruited a mapper who is making the Quest Area's and main town whilst I am busy coding other things. Modding is actively encouraged by the PZ guys, but it's not an easy thing to do, unless you know what you are doing with Object Orientated programming languages like java. (What PZ is coded in) They(The devs) haven't added support for us to put in 3D models yet, and as for : Weapons mods, as it stands, are unable to use their own custom 3D models. For example a "Crossbow" mod, would be using the standard pistol or perhaps a null model (Nothing). If you are interested, have a look around the forums- it simply hasn't been implemented by the PZ team yet. The "Introduction of user created zombies" you mention, secondly, are what are known as "NPC'S". They are working on introducing more to the NPC system, so it will be a case of copying the default zombie behaviour code, and then adding/removing bits as I see fit. Is it easy? No. I'm just that good. It's all there in the "To-Do" list they have. I don't expect our server will be up for perhaps 6 months. Oh! I'm also writing tutorials and posting them on our (temporary) website at www.sanctuary-pz.com for people interested in learning a bit about the java programming language.
  8. I love fishing, my gaming experience has always revolved around the zen element of crafting and sim life.
  9. Found two methods, "Moodle" and "Moodles", and even more confusing was there is two effects for sickness, "Sick" and "Sickness". Sickness is the level of Sickness numerically(Int) and "Sick" relates to the moodle state itself (The moodle "Level" such As "Light Moodle" "Average Moodle" or "Heavy Moodle"). Ultimately, The java you listed is the way to go, but only relates to items, I don't see "BoredomChange, SicknessChange, PanicChange etc etc" as inherited methods in the player class, the way I modified was from a custom trait- Here is an example of what I did: player:Stats:setBoredom(50);Altering the Moodle level, is not supported yet, (Build 23 at time of writing) Check out this thread if anyone ended up here looking for a way to alter Moodle states from the player class, not items: http://theindiestone.com/forums/index.php/topic/7855-moodlefactory-adding-moodles-not-supported-yet-april-20th/ The basic jist of it, is MoodleFactory hasn't been implemented (Yet!).
  10. Simple answer. No. (Or rather, not yet!) the game is still early alpha remember. I checked out a few threads on 3D models, we can't add our own in yet.
  11. 3D models haven't been implemented yet. When they have I might make a bow, would only take me ten minutes in 3DSmax.
  12. The military use condoms to collect water, you will find them in any serious soldiers kit. I basically brainstormed all of this stuff as I played a two month game of PZ, felt like worth putting in the list. Condoms removed from the "To-do" list. (I can just imagine the kind of weirdo roleplay that would encourage on the server anyway! ) So far the only thing modded in is the Custom Trait "Vegetarian". What is it you want to know about the server? I've made a temporary website and bought a domain. Check it out at www.sanctuary-pz.com if you are interested. Oh, children zombies will be in our server(Eventually). Children will not be playable. Got a mapper now, positions still open for a photoshop artist, and a website guy.
  13. Ah ha! I've been editing code where I shouldn't be, haven't I? I've been editing the "Right Click Inventory Panel" lua, when I needed to be in the "ISEatFoodAction.lua"! it's no wonder I've been unable to find a finish option!
  14. Highlighting bad syntax to name only one!, like how Eclipse underscores bad code. Like forgetting to stick a semi-colon in, etc.
  15. "www.sanctuary-pz.com" although still online, is defunct too incidentally, don't bother visiting it. Unless you want to check out that single tutorial I posted!
  16. Notepad++. Has anyone thrown together a plugin for pz modding yet? I'd love that.
  17. Hmm.. This is all well and good, but what about when you are wanting to "Check" on the progress of a timed action? Here's what I mean in code, the example is called from an overridden base lua file in my mod folder, and is working in the 'traditional sense' of throwing errors: --Lots of stuff came before here.... -- Then eat it.ISTimedActionQueue.add(ISEatFoodAction:new(player, item, 240)); --------------------------------------------------------------- --+Debug+-- "The statement AAAAAA will print fine, just after this action queue has been called here in my--overrided base lua. But BBBBB will not execute."player:Say("AAAAAA");---------------------------------------------------------------if ISTimedActionQueue.finish(ISEatFoodAction) == true thenplayer:Say("BBBBB"); end --------------------------------------------------------------- The code throws a "Called T nil" error, and "BBBBB" is never printed! I double checked that "finish" is an acceptable boolean here. I looked for examples of checking for a finished action queue, and have last resorted to this post. Cheers in advance! Raenbow
  18. OMG. I had one of those beautiful moments you get when you code, when it all fits together. It's so unbelievably simple now. Understanding that lua HOOK's into those functions through events is superb! I mean, really understanding it. I can completely compartmentalise my code. It's a beautiful thing, I re-read your last post Robert, about Events. To clarify what I have been doing up until now- I have been copying the ENTIRE lua file from the steamapps folder, instead of simply hooking into it with events! What a nightmare! Is it possible to create my own events (If I feel comfortable with it not causing other mod conflicts) using this function? "triggerEvent();" I suspect that is a "hard coded" thing. Am I wrong?
  19. I was interested in the moodle "Sickness". Didn't see a suitable method in the item class for it, I shall continue my trawling and report back here!
  20. Got it all figured out, yes. It took some time, and it didn't help I spent all day trying things that wouldn't work for me because I forgot to enable my mod in the modloader. It contributed no end to the confusion, so I made a cup of tea, started from fresh. I'm already taking a few little notes for some tutorials I will probably end up making in the future. Essentially, for anyone curious about this thread, I copied the lua file in its entirety (Highlighted in Red) in the following fashion : From "C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\ISUI\ISInventoryPaneContextMenu.lua" To "C:\Users\User\Zomboid\mods\SanctuaryMod\media\lua\mods\SanctuaryMod\ISInventoryPaneContextMenu.lua" ((Note: "SanctuaryMod" is my custom folder, set up in the traditional hierarchy explained in robomats beginners tutorial)) Edit: The above is a totally misunderstood way of doing things. Using Events to hook into these functions creates far more beautiful code, and completely avoids conflicts with other mods. I then located the part of the code with the function name "ISInventoryPaneContextMenu.eatItem = function(item, player)", which could not of been achieved without your help Robert Johnson. I simply had no experience how to navigate through the lua code until this forum post. I added the following code (Right after the final call, which a novice can identify by the words "TimedActionQueue" with regards to anything thats going to "Bring up" the action bar we all know and love in game ) --+ SANCTUARY MOD - Custom Eating (Vegetarian Trait) +--local string whatIam = item:getName(); --if you don't initialise your variables, they will default to "nil" if whatIam == "Ham" thenprint(whatIam);endFor novices trying to figure out where I "Plucked" the following from(highlighted in blue): "local string whatIam = item:getName(); " the way to navigate the heaps of methods you can call for literally everything is through the javadoc, you can check out the javadoc here: http://theindiestone.com/zomboidjavadocs/ As an addendum, In other scripting languages I've worked with, the "then" operand in an if statement was not compulsory. I learned today that in lua, you -need- that statement. Here's an example of what I mean: if condition(true) --do stuff --won't work!end if condition(true) then --do stuff --Will now work!end
  21. If I'm right- And i -think- I am right, the idea is to "Locate" the relevant code chunk, using the manner you suggested- so that it covers anything pertaining to what it will need- Then, I copy-paste that "Relevant" function into my custom lua file (What I called the derpFunction in the previous example- And from there, I can hack away, and it should execute okay.... Okay, here goes. Time to hack!
  22. Here's my current code, note the first remark/comment I put in there: --where should I be calling this function from with regards to the Events.etc.etclocal function custom_eating(_player, _context, _items) local player = _player;local menu = _context;local item = _items; --debugprint(player);print(player:getName());print(getItemText(item:getName()));print(item);print(player, item);print(item:getName()); print(menu);print(menu:getName()); --if item == item:getName("Ham") --endend -- This will be fired whenever A player opens up the inventory right click and selects "Eat":Events.OnFillInventoryObjectContextMenu.Add(player, context, items);My problem in understanding is coming from a combination of not understanding that last line, here, I've highlighted it(Blue)- Events.OnFillInventoryObjectContextMenu.Add(player, context, items); In the modding tutorials I've stuck into, (RoboMats, etc) I noticed that events take the following format usually: How do I combine these two things successfully in my example. I know If I can just see it in this example, it will allow me to write better code in the future. Nevermind "Working" code!
  23. Hahaha, you are NOT going to believe this. I feel like an absolute idiot. I've spent all day trying to figure out why this is not working- I didn't ENABLE the mod, in the modloader. What an absolute waste of the day! AGH.
  24. Hmmm... Further experimentation leads to me ripping apart other mods and learning how to make additions. For example using : "Events.OnFillWorldObjectContextMenu.Add" Like you said! Funnily Enough! But!- I'm trying to hook into existing functions not make additions. I know I can edit the "Standard" templates in "C:Steam/SteamApps...", in the media/lua folder there. And this is a solution. But a messy one. I'd much rather be able to figure out how to "hook" into the existing lua from my "Mod" folder, so everything is isolated to the mod, and not overwriting base code. Does it involve the "require" chunk at the top of code? I'm not certain what I'm doing, lol. I'm aware of "#include", is require the same as that? Here's my lua code I'm trying to hook into the event, it doesn't do anything other than Print statements for debugging purposes, or err... it SHOULD be doing that, but it isn't ! local function custom_eating()--debug -- A SHOTGUN of print statements for bug testing!print(getItemText(item:getName()));print(item);print(player, item);print(item:getName()); --if item == item:getName("Ham") --endendend -- This will be fired whenever A player opens up the inventory right click.Events.OnFillInventoryObjectContextMenu.Add(custom_eating);I appreciate the help incidentally, and I cringe that you might even think I am "trying to get you to write my code for me", I literally cringe - I'm wanting to learn the language. Very much so. For me this is about learning lua. I've experience with java, and have fallen in love with PZ, it's just taking these baby steps. So don't ever doubt I appreciate your aid! Thanks
  25. RoboMat, you are an absolute legend. I owe you a coke.
×
×
  • Create New...