Jump to content

Search the Community

Showing results for tags 'scripting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Oxygen Not Included
    • Oxygen Not Included FAQ
    • [Oxygen Not Included] - Developer log
    • [Oxygen Not Included] - General Discussion
    • [Oxygen Not Included] - Bug Tracker
    • [Oxygen Not Included: Spaced Out!] - Bug Tracker
    • [Oxygen Not Included] - Mods and Tools
    • [Oxygen Not Included] - Suggestions and Feedback
    • [Oxygen Not Included] Art, Music & Lore
    • Community Challenges
    • [Oxygen Not Included] - Latest Content Update
    • [Oxygen Not Included] - Latest Animated Short
    • Oxygen Not Included DLC Alpha
  • Don't Starve Together
    • Don't Starve Together FAQ
    • [Don't Starve Together] Developer log
    • [Don't Starve Together] General Discussion
    • [Don't Starve Together] Beta Branch
    • [Don't Starve Together] PlayStation
    • [Don't Starve Together] Xbox One
    • [Don't Starve Together] Nintendo Switch
    • [Don't Starve Together] Bug Tracker
    • [Don't Starve Together] Trading
    • [Don't Starve Together] Server Bulletin
    • [Don't Starve Together] Dedicated Server Discussion
    • [Don't Starve Together] Mods and Tools
    • [Don't Starve Together] Tales of Life and Death
    • [DS + DST] Art, Music and Lore
    • [Don't Starve Together] Suggestions and Feedback
    • [Don't Starve Together] The Forge
    • [Don't Starve Together] The Gorge
    • [Archived Bugs]
  • Don't Starve
    • Don't Starve FAQ
    • [Don't Starve: Pocket Edition] iOS / Android
    • [Don't Starve] General Discussion
    • [Don't Starve] Mods and tools
    • [Don't Starve] Art, Music & Lore
    • [Don't Starve] Suggestions and Feedback
    • [Don't Starve] Videos
    • [Don't Starve] Bug Tracker
    • [Don't Starve] Trading
    • [Don't Starve] Testing Discussion (archive)
  • Griftlands
    • [Griftlands] - General Discussion
    • [Griftlands] - Suggestions and Feedback
    • [Griftlands] - Mods and Tools
    • [Griftlands] - Localization
    • [Griftlands] - Bug Tracker
    • [Griftlands] - Developer log
  • Hot Lava
    • [Hot Lava] - General Discussion
    • [Hot Lava] - Suggestions and Feedback
    • [Hot Lava] - Bug Tracker
    • [Hot Lava] - Strats and Records
    • [Hot Lava] - Developer Log
    • Hot Lava Latest Update
  • Klei Entertainment Games
    • Eets Munchies
    • [Invisible, Inc.] General Discussion and Strategies
    • Mark of the Ninja
    • Shank
  • Other Stuff
    • Other Klei Services

Categories

  • Don't Starve
    • Custom Characters
    • Game Modifications
    • Language Packs
    • Modding Tools, Tutorials & Examples
    • Custom Maps

Categories

  • Oxygen Not Included
  • Oxygen Not Included: Spaced Out!
  • Griftlands
  • Don't Starve
  • Don't Starve Together
  • Don't Starve Together: Beta Branch
  • [Don't Starve Together] Nintendo Switch
  • [Don't Starve Together] PlayStation
  • Don't Starve Together: Return of Them
  • Don't Starve Together: The Gorge
  • Don't Starve Together: The Forge
  • Don't Starve Together: The Forge (Archive)
  • [Don't Starve Together] Xbox One
  • Don't Starve: Shipwrecked [archive]
  • [Don't Starve Together] PS4 (archive)
  • [iOS] Don't Starve: Shipwrecked
  • Don't Starve: Hamlet [ARCHIVE]
  • Don't Starve: Shipwrecked [ARCHIVE]
  • Don't Starve: Hamlet Early Access [archive]
  • Don't Starve: Hamlet Closed Beta (ARCHIVE)

Categories

  • Oxygen Not Included
  • Oxygen Not Included: Spaced Out!
  • Griftlands
  • Hot Lava
  • Don't Starve Together
  • [Nintendo Switch] Don't Starve Together
  • [PlayStation] Don't Starve Together
  • [Xbox One] Don't Starve Together
  • Don't Starve
  • Don't Starve: Shipwrecked

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Biography


Location


Interests


Occupation


Favorite Game


Modder


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Klei Featured Artist


Early Supporter


Early Supporter


Don't Starve


Don't Starve Together


Oxygen Not Included

Found 22 results

  1. Hello, I would like to build a Character that can craft custom items but only if near an specific character. Has someone an idee how to do it?
  2. I was able to do this in single player Don't Starve, but I can't figure out how to do it in DST - I'd like to have this character I'm working on have a minor sanity drain rate when on a boat on the ocean, separate from the wetness sanity drain, basically the same as Woodleg's gain but reversed. Seeing as Woodlegs' code isn't in DST to work off of, nor would it work if I just copy-pasted, and as I'm basically lua illiterate, I'm not even sure where I should start.
  3. Hey so I have been trying to make my own character, who is a bit of a clone off of wortox but in trying to make it my own, but I seem to be running into error, and I''m not very good at lua scripting, If anyone can help me out here I'd greatly appreciate it, and if you want I could do art for your own character as a thank you, so right now i've been getting these errors and cant seem to figure it out, Ill attach everything ive ran into so far and ill also give the files as well Wolfshier character v1.0.3 for forum.zip client_log.txt DxDiag.txt
  4. Well now I've run into another fundamental issue I don't understand; replicas I believe I've gleaned from context from other threads I've been reading trying to solve this issue that replicas are essentially the client-side component of any object that needs to be referenced by said clients, but I don't understand what drives this or even if it's 100% correct. So recently I created a system by which Guano is renamed to a playfully ambiguous title in keeping with the game's sort of vague reference to natural bodily functions. I do this in my modmain.lua with the following code; AddPrefabPostInit("guano",function(inst) inst:AddComponent("named") end) and everything is well and good until I try to perform this in a world with caves. I'm assuming it's because I added the named component artificially with no supporting logic of when to replicate it? (I notice there's a named_replica.lua in the components folder) but I have no idea how to go about fixing this. The specific error log being
  5. This is more of a consultation than a direct how-to question. I implemented a feature that temporarily adds a tag to a specific target (can be anything that can do combat), and now I'd like to give this effect some visual representation, but I don't know what. I tried tinting the target red (by setting AnimState:SetMultColour(1, 0.5, 0.5, 1)), and while it worked, I'm not sure it's a good idea - A. because it might not be too noticeable, especially for reddish entities; B. because I think it might clash with other places setting color multipliers; and C... pretty sure I had a C when I started typing this sentence but I forgot it already. O_o I thought maybe to put a ring on the ground around it, but I'm not sure how to do that and it would also need to be scaled based on the target's size. Also I think if I did that then I'd want the back of the ring to be hidden by the character, another something I don't know how to do. Another idea is an aura, but I think just adding a light source would make it difficult to see exactly which entity is the target when there are several around. Also it has gameplay ramifications at night which I'd rather not have. Would be easy to abuse. So any feasible ideas on how to mark the target (and if possible an ideas on how to implement them) would be appreciated. If it helps, it's possible that only specific players will be able to see this marking (I already know how to implement that part). Thanks in advance. =)
  6. So this is what happened so far: I created a replicable component. Added it with AddReplicableComponent(). The game gave me some syntax errors in my _replica file so I know it loads it. Added it as a component in a player character's master_postinit(). Tried to access either the component or its replica in common_postinit(), both were nil. Moved the component to be added in common_postinit(), client now crashes silently, the word "error" does not show up in the log file for either the server or the client, but the client crashes due to a break in its C++ code and right before it there is a print warning that the replica already exists even though it was nil just before I added it. Right now I have this in common_postinit(inst): if not (inst.components.transformer or inst.replica.transformer) then print("Adding in common_postinit") inst:AddComponent("transformer") end if TheWorld.ismastersim then local tf = inst.components.transformer print("Server: tf = ", tostring(tf)) else local tf = inst.replica.transformer print("Client: tf = ", tostring(tf)) end And I have this in master_postinit(inst): if not (inst.components.transformer or inst.replica.transformer) then print("Adding in master_postinit") inst:AddComponent("transformer") end And the client log show this at the very end (with no other debug prints of mine anywhere): [00:01:02]: Adding in common_postinit [00:01:02]: Client: tf = nil [00:01:02]: Movement prediction enabled [00:01:02]: Craft Pot ~~~ component loaded with no data [00:01:02]: replica transformer already exists! scripts/entityreplica.lua:77 in (method) ReplicateEntity (Lua) <74-84> [00:01:02]: Registering duplicate lua network variable 3646546233 in entity tee[100201] [00:01:02]: Break at: ..\source\simlib\Entity.cpp(347) : So I have two questions: Why can't I access a replica if it already exists? Actually, also why does it exist already if I haven't added it yet? And where do I put client-side initialization code for a player character? Thanks in advance. =)
  7. I'm somewhat new to modding DST, and I haven't dealt much with host-client communications yet since I haven't needed to, but I do now so I've been looking at examples and searching through the forums but the way components and their replicas should be made is still not clear to me. I examined Kzisor's leveler component and its companion exp widget, as well as some standard game components and random things I found in the mods I have installed, but still. Some use classifieds, some use netvars, some reference the replica in the main component, some don't...I could really use a basic rundown of when you use replicable components as opposed to a regular component added in common_postinit(); when you should use player_classified (and what it even is to begin with); when to use netvars (are the instead of the classified thing?) - and if possible, seeing an example of a simple "Hello world" replicable component would be really great. Thanks in advance. =) P.S. If you're interested in the functional context here, I'm trying to create a "transformer" component to manage all character transformations in my mod. It's basically a state machine with forms and triggers that activate the transitions between them. I'd like to give it an AddTransformation() function that lets you define the transitions as well as the trigger, and, for example, I'd like key press to be one of the options. I really want to encapsulate the entirety of the functionality into the component and its replica. Ideally, the user would simply write something such as transformer:AddTransformation("justme", "superme", transformer.Triggers.OnKey(SOME_KEY)) where transformer is the component or its replica and it will simply work. For that end I made registered an RPC call for all transformations that passes along some transformation ID. Now I need to have the code that performs the transformation to be on the server and the code that listens for a key and invokes the RPC to be on the client, but I don't know what to put where, and how to raise an event on the client when the transformation is done. Thus I come seeking the wisdom of the forum elders.
  8. I made a new character and I'd like to override a specific state in its stategraph, but nobody else's (namely, I want to change its funnyidle animation to one of the emotes). I managed to override it for everyone,but I don't know how to override it just for him. I'd rather not copy Wilson's stategraph to a new file, make the modification and then assign that stategraph to him, since that would require updating when Wilson's stategraph changes. Thanks in advance. =)
  9. DST has a module called "util" in its scripts bundle which contains various scripting paraphernalia that one may find useful. I'd like to use the weighted_random_choice() function it has, but when I use require "util" to import the code (currently to my modmain file but I plan on moving it out of there shortly) and then use it, I get an error for invoking a nil value. I know I can copy the function, of course but since it's already there and various game scripts use it, I figure there should be a way to import it into a mod environment as well - or am I wrong? Assistance would be appreciated, like always. =)
  10. I'd like to find a way to make a character refuse to equip certain items (based on tags). I've found examples of this in other mods and posts but in all of them the item is equipped, checked and then unequipped if necessary. I got that working, and if I must then I'll keep that, but I would rather have the character refuse to equip it in the first place. I.e.: When right-clicking the equipment (armor) in the inventory, it will not be equipped at all and the character will say something about it - as opposed to what happens now, where it gets equipped, unequipped and then the characters says something about it. When the equipment is picked up and the character's equip slot is empty, it should go into the inventory without being equipped - as opposed to what happens now, where... (same as above) When equipping would cause a currently-equipped item to be unequipped, I'd like for the currently equipped item to remain equipped. In other words, as I said, the character should refuse to equip it, with the behavior you'd expect when that happens. Similarly, rather than using tags, I'd like to make specific items usable only by specific characters. I'm guessing that'll be similar though. Any ideas or leads would be appreciated. =) Edit: Problem solved; see the bottom part of my own reply below.
  11. I'm trying to modify damage taken before armor checks and in a non-multiplicative manner. Specifically, I'm making a "heavy armor" component which grants a fixed damage reduction that should go before everything else. For example, if the damage reduction is 10 then when a character wearing this armor is attacked, the damage should be reduced by 10 and then the entire combat mechanism should do its job. After the damage reduction takes place I want the normal armor damage reduction, so I can't make the armor component do this work. I also don't want any of the absorbed damage to affect the equipped armors and wear them down. Ideally I would wrap the function Inventory:ApplyDamage with my mechanism and alter the damage before the inventory does its work, but I can't do that since it's a local function. I looked at combat.lua to see if I could interject in the process somehow. I found Combat:GetAttacked and Combat:CalcDamage, but I didn't see any way for me to do what I want. The effects should occur after the damage calculation is performed but before the inventory applies the damage to the equipped armor. Any ideas on how I can do this? Of course, I could always replace inventory.lua or combat.lua, but that seems extremely intrusive and I imagine it would require constant updating with the game.
  12. Yo, me again. This time i need help making an item unusable when it runs out of uses. I have an item that works in some sorta fuel fashion, so i want it when it reaches 0 uses left, the item is left uniquippable untill it has uses. How can i do this?
  13. EDIT: All problems solved! Now on to balancing. :D Hey all. I started making a character mod some months ago and had to put the breaks on it just as I was getting close to completing things. I've forgotten a lot of what I learned while making it and I'm going to need some serous help to hammer out the last few things I want to complete. I'm good on the art side of these tasks but I need some clever coders to save me from myself. Task list One of the updates that dropped while I was away seems to have broken crafting for my character using their custom "Dream" ingredient. Not sure what is broken. I want to make a new tab on the crafting bar to put my characters item recipes under. Like WickerBottoms book crafting tab. Not sure if It is possible but I want to make a bag that has two different sections. One that can act like a cooler to keep food fresh and another that is normal storage. I already made an item and UI asset for this but have no idea how to make it a reality script wise. Lastly I want to see if I can rework the way my characters items use Dream power. Currently his custom items have durability and wear down as normal, with the ability to consume dream power to repair them. However what I originally envisioned is that weapons and tools would directly siphon energy from the Dream Power meter instead of having durability. For example, say his axe costs 5 Dream to swing/chop/mine. Each time he preforms one of those actions the 5 dream would be depleted from the Dream meter. If the item is used with less than 5 Dream available it will break. The amount of Dream would be different for each item for balance reasons. Any help would be very much appreciated. I can provide script files as needed
  14. Hello, For the Athor dwarven mod the two brew (Ale and Tonic) are working well now thanks to DarkXero. I would actually like to add to badges that pop-up to show you how much time you have left after drinking ale or tonic. I copied files from the Moisture mete; edited their visuals and tried implementing some code to the best of my ailities. But as expected, it doesn't show up after drinking any of the ales as i don't know which codes I should implement and where I should. Has any one an idea how to implement this relatively easy to execute idea? The ales have a resttime that adds to the component when one or both are drunk by a player who has the component. -Eremus007
  15. Hello, here I have a part of the scripting of a dwarventonic edible prefab that makes the drinker/eater see in the dark. (There are other codes that make this work in the modmain) The problem is that I would like to make this also work when the character is in the caves. Right now it only works at night and switches off automatically. I would like to do something like this, but I don't know how to say that in LUA: I hope someone can give me the right condition
  16. I want to make a sword that will harm the player instead of the target if he/she chooses to attack an innocent creature (which I specified with PrefabPostinits in the modmain). And when you attack anything that is not "innocent" then the basedamage of 75 will be put in place. I have experimented a lot and this is what I currently have at the best of my abilities: Like this in the Prefab file: local function onattack(inst, owner, target) if owner.components.health and target:HasTag("innocent") then if math.random() < 1 then inst.components.weapon:SetDamage(0) owner.components.health:DoDelta(-50) else inst.components.weapon:SetDamage(75) end end end The thing is that after you hit an innocent creature the value of the damage only sets in AFTER the creature is already been hit, and thus being killed which we don't want. And when attacking a spider for example after having hit an innocent creature before, it doesn't even make a scratch. So the value is stuck at Damage = 0 intil reset. I want the values to change immediatly or even before I even hit the creature. Can someone make this happen for me? Many thanks in regards -Eremus
  17. Hello again, I am trying to make an edible prefab for an ale that doubles the amount of damage dealt by my character. Unfortunately it crashes when my character eats it. It says something like: Can't use math problems on a nil value. (at least that was what I understood). This is the 'problem' code: inst.components.edible.oneaten = function(inst, eater) if eater.prefab == "skyminer" then eater.components.hunger:DoDelta(7) eater.components.sanity:DoDelta(-5) eater.dwarvenaleresttime = 30 * 6.5 eater.components.sanity.dapperness = eater.components.sanity.dapperness - TUNING.DAPPERNESS_MED eater.components.combat.damagemultiplier = eater.components.combat.damagemultiplier + TUNING.WILSON_DAMAGE_MULT end if eater.components.inventory ~= nil then local item = SpawnPrefab("woodenmug") eater.components.inventory:GiveItem(item) inst:Remove() end end I tried changing the mult into something else but I keep the same problem. It's weird because the same code works fine within the Witcher Geralt mod. If someone could tell me what I am doing wrong, that would be very helpful again Many thanks.
  18. Hey, I've got a question. I've figured everything out with the dwarventonic prefab and it works fine. Then I tried to add a custom crafting recipe to make the prefab available in survival. ------------------------------------------ This works: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) This doesn't work and crashes: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6), Ingredient("woodenmug", 1)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) The prefab "woodenmug" is a custom prefab that I added with the purpose of it being part of the recipe. Why can't I use a custom prefab in a recipe while I can debugspawn it sucessfully? How do I add a modded ingredient to the recipe? I couldn't find a solution anywhere on google. Many thanks! -Eremus
  19. Hello again, I am still breaking my head over how I make my custom prefab inflict nightvision for a specific amount of time when eaten. I was trying to copy the catpotion from the witcher mod, but I can't make it work. This is what I had in mind but doesn't work: local assets = { Asset("ANIM", "anim/dwarventonic.zip"), Asset("ATLAS", "images/inventoryimages/dwarventonic.xml") } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst.AnimState:SetBank("recycledpickaxe") inst.AnimState:SetBuild("dwarventonic") inst.AnimState:PlayAnimation("idle") inst.entity:AddNetwork() inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/dwarventonic.xml" inst:AddComponent("edible") inst.components.edible.oneaten = function(inst, eater) if eater.prefab == "skyminer" then eater.components.hunger:DoDelta(3) eater.components.sanity:DoDelta(-10) end if eater.components.inventory ~= nil then local item = SpawnPrefab("woodenmug") eater.components.inventory:GiveItem(item) inst:Remove() end end MakeHauntableLaunchAndIgnite(inst) return inst end return Prefab("common/inventory/dwarventonic", fn, assets) Can someone please point me in the right direction? Many thanks in advantage. -Eremus
  20. Hey, I am doing improvements to my custom dwarven character named Skyminer. I was trying to add three prefabs -Wooden mug [Done] (Plays role in the crafting recipe) -Dwarven tonic -Dwarven Ale I got stuck on the second one I was trying to make it so that when Skyminer ''eats'' the dwarven tonic that it will inflict him with nightvision for a specific amount of time and replaces the dwarven tonic with an empty wooden mug. That was the idea, It doesn't crash the game at the moment but I am not sure if the nightvision works but I am sure that the "Replacement" of the tonic isn't working. Here's the code: local function fn() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/dwarventonic.xml" inst:AddComponent("edible") inst.components.edible.oneaten = function(inst, eater) if eater.prefab == "skyminer" then eater.components.hunger:DoDelta(3) eater.components.sanity:DoDelta(-10) inst:AddTag("nightvision") inst:AddComponent("cooldown") inst.components.cooldown.cooldown_duration = TUNING.TOTAL_NIGHT_TIME if inst.components.cooldown:IsCharged() then inst:RemoveTag("nightvision") inst:RemoveTag("cooldown") end inst.components.edible.oneatenreplacement = "woodenmug" end end Can someone tell me what I am doing wrong so I can make it work? Many thanks in advantage.
  21. Hello fellow DST modders, I am in the progress of making a character mod and need some help with the scripting. My problem: One of the character perks is that items have a small chance to instantly break on use (regardless of remaining item durability). I just need a pointer on how to get the and item that the player is currently using and on how to change the durability of the item on use. Thanks a bunch in advance!
  22. What I'm trying to do: -Have the host choose some configurations and store the settings somewhere -Have the client download those settings and use them I'm a bit confused about where things are stored and retrieved from as well as just basic syntax. For example if in modmain.lua as a host I had: net_size = net_int(inst.GUID, "size", "size_dirty")net_size:set(1)Can the client get at it by doing: local size = net_size:value()And can this be done in the modmain.lua or would I have to go about it like in The Hunt mod and create a component with a class and hook it all in that way? Also, what -is- the proper syntax for creating the net variable, assigning a value, and retrieving a value if any of the above is off the mark?
×
  • Create New...