• Announcements

    • JoeW
    • JanH

      Rhymes with Play 148 - Oxygen Not Included Art Stream!   07/20/2017

      Join Oxygen Not Included artists Alex and Erica this Thursday, July 20th at 3:30 PM Pacific (10:30 PM UTC) where they will be showing off how your favourite dupes are drawn, as well as creating a summer-themed ONI illustration, only on the Rhymes with Play Dev Cast on Twitch. Where is it?
      On our official Twitch channel here:
      http://www.twitch.tv/kleientertainment
       
      When is it?
      Twitch Stream Date: July 20th, 2017 

      10:30 PM UTC (Coordinated Universal Time)
      6:30 PM ET (East)
      5:30 PM CT (Central)
      4:30 PM MT (Mountain) Here's a handy tool to figure out what time that means for you. Check out the stream announce thread for discussions!

IronHunter

Registered Users
  • Content count

    45
  • Joined

  • Last visited


Community Reputation

50 Excellent

1 Follower

About IronHunter

Converted

  • Biography Severely limited with free time.
  • Location Vancouver, BC, Canada
  • Interests Programming, Gaming, Magic The Gathering, and Lego
  • Occupation Student

Recent Profile Visitors

145 profile views
  1. The werebeaver code might be a good place too look. It overides actions and other default features and resets them when transforming back. It should mostly be in the woodie.lua file at least its a start.
  2. No credit is needed, I am just happy to help. =) no offense intended and taken we all make mistakes, just trying to clear up confusion. Cheers
  3. I wrote similar code to the one that he is using, which is also the thread I linked in my previous post. As long as he uses the self.inst within the function as this is where the magic is done that causes all the crits. Combat.CalcDamage = function(self, target, weapon, ...) Excuse the poor formating of the post, I am on mobile. The thread I posted is a solved one with nearly identical code to this one. E.g. self.inst.prefab == "esctemplate" in the if statement. Cheers
  4. The comments make me believe you got it from this thread, which explains how to use it. Any instance of inst will have to be self.inst as inst is not defined by default. If you are planning on calling inst a lot in the code, maybe define inst locally e.g. local inst = self.inst at the top of your code around the same place as the other local variables are defined at the top. Cheers
  5. I remember the :IsOnValidGround() function checks if there is any ground beneath you, not valid ground is the ocean and the black void of the caves. Take note that by default items are deleted when they fall on said invalid ground, as for calculating distance I would check out how the rescue command is used its in the entityscript.lua Apparently FindNearbyLand in simutil.lua could be of use? Using the function EntityScript:GetDistanceSqToPoint(x, y, z) to figure out your distance from x,y,z that is returned from FindNearbyLand() Have a look at these files, and you can probably work something out, but this should get you started on the concept.
  6. Is this what you want? I provided a couple of different answers here that may help, as well as explainations. Cheers, IronHunter
  7. Ya just remove the default damage, stuff. You could probably do something like check the self.inst.components.hunger:GetPercent() and do some of your characters code in there or you could just make one variable in your character's prefab like inst.crit chance in your characters postinit. Then you could just check local crit = 0 if self.inst.crit then local crit = self.inst.crit end Then your character can change that value at your leisure. Seeing as this code is run in the modmain and only runs for your character's prefab I would modify it to look something like
  8. I have this code snippet running in the modmain.lua or import it using modimport() The problem is listenforevent happens after damage is already dealt, its too late to modify damage because its in the past. To solve this we need to modify the combat component when you initiate the attack, before damage is calculated and overide the damage we would of done. To prevent it from rapidly escalating we need to revert back to our previous damage. This has been tested by me and works completely fine on my end, on caves enabled servers. Cheers
  9. You can rename inst.pet to whatever you want it is assigned the path of your "tieravil" prefab. It is just a name for the variable Yes you should be able to do inst.tieravil.components etc There is no reason for it to call other pets as you are assigning it once to the path of the tieravil prefab when you run the loop after your pet spawns. Probably want to set it to nil if your pet tieravil dies.
  10. It is more like, if you make a variable like inst.pet = nil in your master_postinit, you can then assign it for your own use. Its just an idea, so you don't have to constantly run a "for loop" to find your pet so you could interact with it. As well as a way to tidy up your document besides efficiency, depending on how frequently you are using this code.
  11. What I meant was store the path for your pet as a variable that way you don't have to constantly call the function. It just makes your code cleaner and more optimal. See how I made that local variable called pet, it is storing the path to your pet "tieravil". I am saying you could instead of making a local variable there save it somewhere in the file so that other functions can access it without having to run this search again. E.g. wx78.lua has a variable called inst.level, this stores his level and is accessed by many different functions in his code. If you make it local only the function that you defined the variable can use it. I hope this clears it up
  12. I don't have time to test right now but judging from the petleash code it looks like accessing pets array in the petleash component is what you want.
  13. If I am not mistaken the onattackother event uses the data of {target, weapon, projectile, stimuli} Target is what is being attacked Weapon is the thing smacking it Projectile is if its a projectile hitting it Stimuli is an element e.g. "electric" weapon is also a component, maybe try data.weapon.components.weapon.damage I'll do some testing when I have some time Cheers
  14. Instead of listening for "consumeingredients" which is called for all recipes you could listen for "builditem" which uses data (item = prod, recipe = recipe, skin = skin) I don't really have access to all my modding tools, but it should be a simple enough to edit from here. Depending on how many items you want to make have this penalty you could do a array to store their values so you don't have to make as many if statements. Cheers