ShinyMoogle

  • Content count

    26
  • Joined

  • Last visited

Community Reputation

18 Good

About ShinyMoogle

  • Rank
    Junior Member

Recent Profile Visitors

100 profile views
  1. Mobs not moving?

    It will help if you share some relevant prefab files where you're encountering the problem. Here's a quick checklist of things you'll need to include: The locomotor component, which handles all the movement and pathfinding stuff A brain, which tells the mob how to behave A stategraph with action handlers, which translates actions into animations and interactions with other things
  2. I got your "Dot 2" set of files working, attached below. There was an error resolving the file path to your bigportrait textures, which I fixed by renaming some of the files and file references with lower-case capitalization. I can't tell you exactly why that fixes it - I spent a few minutes tracing the function calls and then figured it would probably take a fair bit more time than I have today. But judging from a few lines in characterutil.lua, there are bits and pieces of the code that automatically concatenate character file strings based on the character name. Somewhere along the way, the code arrives at (as presented in the game log) atlas = bigportraits/dot.xml and tries to look for the corresponding file. But it doesn't exist, because in your folder structure, that is saved as bigportraits/Dot.xml. Generally speaking, if you're seeing something in the code or files that's consistently written in lowercase, or consistently written in uppercase, I highly, highly recommend just sticking with that convention. It might look a little odd or silly, and you might want to capitalize proper names properly, but don't do it unless you're sure nothing else needs to reference it. I believe the Extended Character Template does have the proper formatting in place already - just make sure you're matching case when doing a find-and-replace across all files. Dot.zip
  3. Character mod help!

    All of that is controlled in the character's temperature component in temperature.lua. Take a look through the component - most of that functionality should be a pretty straightforward task of setting the right variables to some custom values. The insulation variables handle your freezing/overheating rates - "inherentinsulation" is your insulation against colder temperatures, while "inherentsummerinsulation" is insulation against hotter temperatures. There are a few other variables you might want to check out in the component as well, such as your overheating threshold.
  4. Try taking a look through the stormwatcher.lua component. That seems to be the main player sandstorm component. There's a SetSandstormSpeedMultiplier function there, try adding this to your master_postinit: inst.components.stormwatcher:SetSandstormSpeedMultiplier(1) As far as I can tell, the stormwatcher component checks to see if you've entered a sandstorm each time you enter a new area, then updates your movement depending on whether or not you have goggle vision or some other stuff. But it'll skip that check if your sandstormspeedmult is not less than 1.
  5. Character mod help!

    For the temperature thing, it will depend on what you mean when you want Incineroar to feel heat. Do you want him to freeze slower? Overheat faster, or not overheat at all? Slowly gain heat over time (this one will take a bit of extra coding)?
  6. Great! I'm glad I could help! I forgot the code might make Popuko give herself Sanity. You can try something like this to exclude the player getting hit. This will prevent the entity calling Combat:GetAttacked from being considered for Sanity restoration. for i, ent in ipairs(ents) do if self.inst ~= ent and ent.components.sanity ~= nil then ent.components.sanity:DoDelta (5) end Minor confession - I think I misremembered Combat:IsAlly(guy) since it doesn't actually check if the target is a player. It's more for checking leader/follower associations. Oops.
  7. Oh wait no, I misspoke! I meant it would return true for any player, but FindEntities would still only search Popuko players. You can leave that out of the for loop. Won't do anything bad specifically, just extra code that the game will run that doesn't need to be run.
  8. It would target any player in that case, yes. Hm... Do you have PvP turned on? If you do, you can leave out "and self.inst.components.combat:IsAlly(ent)". I guess you might have it on if the perk is for when other players get hurt. Combat:IsAlly is a function for checking to see if a particular entity is friendly to the entity calling it (here that is the thing getting attacked). One of those conditions is that both the checker and the entity in question are players and PvP is off. If PvP is on, then it'll return false and you won't get Sanity restoration.
  9. Ah, nope. The tag code is correct, but tags should get added in your character prefab's common_postinit.
  10. Hm... that looks like it should work to me. Did you add the "popu" tag to your character prefab?
  11. PrefabPostInits do go in modmain.lua, you got that correct. Remember that the code is specifically for when a fellow player gets hurt, so you won't be seeing the effects unless you're in multiplayer. For testing purposes, you can remove/comment out: if not self.inst:HasTag("player") then return end And in the FindEntities function: and self.inst.components.combat:IsAlly(ent) which will remove the tests to see if the entity that got attacked is a player or ally. That should allow sanity restoration whenever anything in range gets attacked.
  12. Character mod help!

    If you're unfamiliar with coding in general, I'd definitely recommend looking through the link Ultroman posted above! Learning the basics enough to be able to follow existing code (variables, functions, etc.) is a huge help, and generally applicable to anything you might need to look at code for. Even if you don't immediately know all the specific functions and syntax, you can roughly grasp what's happening. WatchWorldState is an existing function - you'll be using it, not declaring a new local one. Try to emulate what's being done in the WX-78 code. I'll try and outline the order things are happening in the wx78.lua file, but definitely take a look at the guides posted if stuff is going over your head. local function onisraining(inst, israining): When called, this will check to see if it's raining or not, and do stuff accordingly. You want to set your lowered damage multiplier here. You also need to make sure to set your damage multiplier back to its original value here! If you don't, then you will do 60% damage forever*, even after it stops raining. *until you restart local function onbecamerobot(inst): A bit of an intermediate step paired with onbecameghost, which only runs the weather check if you're not dead. Optional, but it's more efficient code-wise. This is where you call inst:WatchWorldState("israining", onisraining). It tells the entity to listen for changes in the weather, and then calls onisraining when the rain state changes. local function master_postinit: This is all run when the player character is created for each game session, and where you tell the game to start event listeners for events such as dying and being revived. In wx78.lua, these listeners are responsible for calling onbecamerobot above. It also calls onbecamerobot (which, in turn, calls onisraining) at the very start to do the appropriate action for the current weather state.
  13. A little bit off. I think it'll help to take a bit of a step back and take a moment to understand some of the data and functions involved. DST offers several "PostInit" functions for mods to work with, which modify existing files in the game. AddComponentPostInit specifically modifies an existing component, which is basically a collection of common variables and functions that can be added to an entity in the game (a player, an item, a structure, etc.) These components, like combat and health, are then used when entites need to interact with each other. For example, if you want something to fight, then it needs the "combat" component. Once that has been added, then you know it will have a standard set of functions for determining target, attacking, getting attacked, etc. You can view all of these in the components folder. An AddComponentPostInit can either modify one of these existing component functions, or add a brand new one. It takes two inputs (parameters): the name of the component, so in this case "combat", and a function to define a new component function or overwrite an existing one. You don't want to use "sociopath" because that does not exist in the game as a component. You're modifying the existing "combat" component, so that's what you should be telling AddComponentPostInit to do. Still with me here? Okay! Here specifically, we're modifying "GetAttacked", because anytime something is attacked, that function within its combat component is called. If you look into combat.lua, this handles a whole ton of stuff like calculating damage and making a target flinch and all sorts of other things. We don't want to touch all that, so we make sure to save that and call all that old stuff in our modified function. This is the "_oldfunction" snippet. Next, we want to check if the target being attacked is a player - if not, nothing else happens. Right now, your code checks to see if the target being attacked is Popu... which is not what we want! GetAttacked will be called by the entity that is taking damage, not your character. We want to see if it's a player being attacked. If that's true, and a player has been attacked, then we should search for any Popu players near the player that was just attacked, verify if they're allied, and then increment that player's sanity. The original code I gave you is missing some variable declarations, but should be roughly correct as far as the internal logic flow goes. Here's what it'll look like cleaned up a bit: I left the range variable unassigned here. It's called in TheSim:FindEntities, which will look for all entities fulfilling certain conditions (in this case, being Popuko) within range of a certain point (here, anything that gets attacked). Play around with the value until you find something you're satisfied with. This is the required maximum distance a player can be from Popu for her to gain sanity when the player is hurt. AddComponentPostInit("combat", function(self) if not GLOBAL.TheWorld.ismastersim then return end local _oldfunction = self.GetAttacked --Save existing function so you can refer to it function self:GetAttacked(attacker, damage, weapon, stimuli) _oldfunction (self, attacker, damage, weapon, stimuli) if not self.inst:HasTag("player") then return end local x, y, z = self.inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, range, { "popu" }, nil) for i, ent in ipairs(ents) do if ent.components.sanity ~= nil and self.inst.components.combat:IsAlly(ent) then ent.components.sanity:DoDelta (5) end end end end)
  14. Character mod help!

    Heater If you want to use variables, you'll need to declare them in your character prefab before calling them in your master_postinit function (this is also where you add most components to your character prefab). Take a quick look at how it's coded in lavae_pet.lua for a basic implementation. You can also just assign a value manually like is done in lava_pond.lua. If you want something more complex with varying degrees of heat, you'll need to add a function in inst.components.heater.heatfn that will return a value for the emitted temperature - refer to heatrock.lua for an example there. (from lava_pond.lua) inst:AddComponent("heater") inst.components.heater.heat = 500 Rain It's hard to troubleshoot a tiny snippet of code like that by itself, without knowing where it lies in your code or a crash log. I'd hazard a guess that your crash is due to that particular code block not recognizing what you're referring to with "act.target". In general though, functions won't do anything by themselves unless they're called by something else somewhere. You need something to tell the game, "hey, run this piece of code when [x] happens to check if it's raining and do stuff." Fortunately I think there is a pretty easy way to handle this one using WatchWorldState. You can see an example in wx78.lua, where WX-78 is coded to start emitting sparks when it starts raining. You'll want to create a custom function to be called with WatchWorldState that will adjust your damage multiplier depending on whether or not it's raining. (from wx78.lua) local function onisraining(inst, israining) if israining then if inst.spark_task == nil then inst.spark_task = inst:DoPeriodicTask(.1, dorainsparks, nil, .1) end elseif inst.spark_task ~= nil then inst.spark_task:Cancel() inst.spark_task = nil end end local function onbecamerobot(inst) if not inst.watchingrain then inst.watchingrain = true inst:WatchWorldState("israining", onisraining) onisraining(inst, TheWorld.state.israining) end --Override with overcharge light values inst.Light:Enable(false) inst.Light:SetRadius(2) inst.Light:SetFalloff(0.75) inst.Light:SetIntensity(.9) inst.Light:SetColour(235 / 255, 121 / 255, 12 / 255) end
  15. Good catch on the tag search - I'm all in favor of trimming down redundant operations!