TheSkylarr

  • Content Count

    101
  • Joined

  • Last visited

Community Reputation

9 Neutral

About TheSkylarr

  • Rank
    Member
...

Recent Profile Visitors

456 profile views
  1. Simple mistake, whenever you define a function, you need to put a parenthesis after you name it, with whatever variables you need to pass into it inside them, so instead of local function InsanityHealthPenalty, it should be local function InsanityHealthPenalty(inst). Keep in mind, it will only pull these variables, in this case inst, from the thing that called it, so if you just randomly call InsanityHealthPenalty, the game will probably crash. Also, sorry for the late reply. I haven't been on the forums lately due to development burnout.
  2. This is actually an error I see in a lot of mods myself, no idea how to fix it, but it never seems to make the game crash.
  3. In my mod, I have a few items that have a modular upgrade system using an inventory slot, all of these, except for one, are Hat's. When equipped, it looks like Walter's slingshot ammo slot, like this My problem here, is actually also in the image, both the Purple Hat and the Blue Umbrella thing should have that slot above them, but it seems since they both share a container type, only one can be open at a time. When I tried to specify my own container type, I no longer had some of the important properties that hand_inv, which is the container type I'm using right now, has. Specifically how it's integrated into the hotbar, and moves with it if you have a backpack on with integrated backpack mode enabled, and it also has some slight size modification to the slot and other things. How would I go about making my own slot similar to hand_inv?
  4. When you say this, do you mean you don't know where to start with obtaining the music, coding it, using FMOD, or what? There's a lot to get into, but don't be intimidated! Ask any questions you need and I'll do my best to help you out.
  5. Well, according to this log there aren't any errors, it just shuts down very quickly though. Could you send both the client and server log?
  6. Sorry for reviving a dead thread, but I just wanted to says I figured out a solution that worked for me, and wanted to put it here in case anyone else needs help and finds this. Why does this problem happen? It happens because even though the server knows all the properties of your container, the client doesn't know a thing, since containers are handled differently when you aren't the server. You need to this inside your prefab's main function, and it needs to happen when the client is still reading it, and only for the clients. To do this, you need to add it in the part of your prefab's main function that only executes on clients, and not on the server. This is inside an if statement that looks like this: if not TheWorld.ismastersim then return inst end To add it in, simply paste this line inside the if statement, before return inst, just be sure to change CONTAINER_NAME to whatever the name of your container is. inst.OnEntityReplicated = function(inst) inst.replica.container:WidgetSetup("CONTAINER_NAME") end If you don't have anything else special already inside the client only part of the main function, it should look something like this if not TheWorld.ismastersim then inst.OnEntityReplicated = function(inst) inst.replica.container:WidgetSetup("CONTAINER_NAME") end return inst end I hope this helps anyone who finds this, and I'm sorry of it doesn't work for you, and once again, sorry for reviving an almost 4 year old thread.
  7. Hello! In my mod I have a weapon hat is normally identical to a spear, but can be upgraded using different items in it's own inventory slot. I'm wondering if, since these upgrades essentially change the item to a completely different item, should I use a different prefab for each upgraded version of the weapon, or should I change the components and textures on the fly?
  8. I'm assuming at the moment your character is losing health when they lose sanity? If you want it to be a linear loss of health, all you'd need to do is multiply the players max health by their sanity percentage. A script like this might work if you attach it to whatever the sanity delta event is called (I can't remember at the moment). local function SanityGaming(inst) -- inst should be whatever entity your effecting, probably a character. local NormalHP = 150 -- Replace 150 with whatever your characters HP would be at 100% sanity. local Sans = inst.components.sanity:GetPercent() -- This will be a decimal representative of your characters current sanity level. inst.components.health:SetMaxHealth(NormalHP * Sans) -- This sets your characters max health to the max HP multiplied by the sanity level. end This isn't the most elegant solution, as using something like SetPenalty instead of SetMaxHealth would be a better visual indicator, I just don't know how to use it, so you may want to look into that instead. Also this kind of kills your character if they drop to 0% sanity, as their max health gets set to MaxHP * 0. Finally, this might crash since I didn't test this at all and I have a bad habit of forgetting small things, let me know if you need any help.
  9. DoPeriodicTask is specifically intended to be used on top of something, you can't just run it alone as far as I know, however you COULD just run it using the player character, with something like GLOBAL.ThePlayer:DoPeriodicTask(20, FunctionToBeatAllFunctions) I don't see why that wouldn't work, but you may be trying to do something really weird. If you don't like this, or it doesn't work, and you're trying to time events or something, you may want to look into a non networked entity. It's used for things like Meteor Spawners, and they'd be great for something like a timer entity if you really needed it.
  10. Glad that you solved it, though the mod's don't generally close topics for us around here. Add a prefix tag yourself if you really want to.
  11. Well this is actually really interesting, even if I can't do what I wanted to do, this is a really good tool I could use in the future. I'm assuming the params would be the same as they show up in FMOD correct?
  12. Is there some way I can change the pitch of sounds being played, and sounds that will start playing, until I specify for it to stop? I want to do this globally on a server, but I don't think it's possible, though I very well could be missing some important component, or something with SoundEmitter that I missed.
  13. One of the items in my mod freezes my character, then freezes the entities around it after a short time. Functionality wise, it works fine, however there is a sound thing I don't know how to deal with. Whenever my character is frozen, the game plays all it's own freezing sounds, and on unfreezing, the ice shatter sound is played, along with my character's hurt sound, even though they're not taking any damage. Is there a way I could interrupt all three of these sounds, silencing them? My mod has it's own sounds it plays during this interaction, so I can't have the game doing it's own thing. Edit: I do know that SoundEmitter:KillSound exists, I just don't know what the sound names of these sounds are, or if this is even the right way to go about things.
  14. I feel really dumb for this comment I made, yes it was unreadable, but the code for all these items is still in the actual game code, no need for me to look at the mod. After looking into it, although I successfully did everything required to add a targetting reticule to my item, it doesn't work due to a limitation of playercontroller.lua. It seems that targetting reticules are implemented expecting only Hand slot items to have them, but in this case I want a hat to have one. I guess the only way to do this is gonna be in one of these ways, at least that I can think of. Make my own component based on Targetting Reticule that bypasses playercontroller somehow. Have my hat give the character a hand slot item for targetting, by temporarily storing whatever item is in their hand slot in some invisible slot, and replacing it with the targetting one during the targetting. This may also simplify the process of throwing my item, as I can reuse the TOSS action from the game instead of making my own action. Which one would be the best option here? I'm thinking option 2 myself, as it would make other parts of my code easier as well, but it seems a bit janky.
  15. Hello! I'm making a Hat in my mod that allows you to throw explosives while you're wearing it. My problem is as follows: While trying to add an AOE reticule to the Hat, I figured out that PlayerController:TryAOETargeting() is what controls detecting and displaying AOE Reticules. The problem here, is that the function specifically only looks at the hand slot for the item you are trying to target with, but in this case, it's a hat. How can I work around this and get my hat to have a reticule?