• Content Count

  • Joined

  • Last visited

Community Reputation

9 Neutral

About Jpianist

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Sorry i didn't reply to this message @DarkXero, i'm still trying to fully understand it What i had to do to make it work was eliminating one of them (since like you said they do the same), and also, use only one "local function onattack", so i mixed your stuning code with the gaining sanity when hitting someone without the tag "Wall" and they both work perfectly. I wanted to ask you something, could you please give me a sample ítem that when used freezes everyone around my screen BUT myselft? An usable ítem without being equippable, and with a really short animation like rising the arms or something, so it looks like he's conjuring something. Of course i mean an existing game animation, like the animation when you use a spell with a staff or something similar. I found this topic in the fórum search which is the most similar: But instead of a staff, just an usable ítem non equippable. Also need exactly the same thing but a healing one that gives 20hp. Both need to have cooldown before being able to use them again, since i still haven't implemented the MP bar which will take over the cooldown. Freeze ítem with 10 seconds of cooldown and healing 15 seconds. It will be awesome if you could make the cooldown configurable, with at least 3 options, but if it's a lot to ask then it's ok. I'm sorry for bothering you, i already know how the char.lua, myequipableweapon.lua, modmain.lua and modinfo.lua Works, but a nonequippable usable ítem (with infinite uses) seems off my limits. Once i understand how they work it will be simplier for me to just edit them and modify their behavior. Thanks a lot in advance Dark! This is for the phase 2 ítems.
  2. Is it possible to change the animation of the character playing the flute to a much quicker and simplier one? I'm guessing that the line that makes the animation happends is this one: inst.components.tool:SetAction(ACTIONS.PLAY) But i'm not sure though. I would rather the animation that happends when using an ítem, like the spider glant (is just an the first quick animation that came into my mind, not the best though)
  3. Well thanks for trying. Maybe i'm just asking for something impossible in the game's coding. It was an stetic thing i wanted to add, not really important, so it's okay.
  4. This message is a Microsoft edge mistake, it wasn't ment to be sent. EDIT: Now that is sent... Well ill tell you something extra. Add this : local function common_postinit(inst) inst:DoTaskInTime(0, OnInitNightVision) end
  5. Yeah Allthough it might be easier for the pros to help if you give us the error you get when the game is crashing with the line that the game suggest is the problem. I'm done for today but tomorrow i'll try this myself.
  6. instead of owner.discordnightvision:set(true)" i would use "inst.discordnightvision:set(true)" since "owner" is for ítems, "inst" would be posible to install in the char.lua so go ahed and try adding that code to the common_postinit.
  7. Thanks @SuperDavid, it's exactly what i was looking for, the only problem is that the color shows when the weapon is on the ground, but when i equip the weapon i lose the color. Any ideas what could i do to have the weapon colored glowing permanent all the time?
  8. I can't make the sanity part but i can give you the nightvision code that Works, you test it yourself to see that is working and then you modify it to your desier maybe with the help of the amazing coders in this fórum. This goes into your modmain,lua --Darkxero's code local function UpdateNightVision(inst) local enable = GLOBAL.TheWorld.state.phase == "night" and inst.discordnightvision:value() inst.components.playervision:ForceNightVision(enable) inst.components.playervision:SetCustomCCTable(enable and {} or nil) end local function OnInitNightVision(inst) if GLOBAL.TheWorld.ismastersim or inst.HUD then inst:WatchWorldState("phase", UpdateNightVision) inst:ListenForEvent("discordnightvisiondirty", UpdateNightVision) UpdateNightVision(inst) end end AddPlayerPostInit(function(inst) -- Sword nightvision inst.discordnightvision = GLOBAL.net_bool(inst.GUID, "player.discordnightvision", "discordnightvisiondirty") inst.discordnightvision:set(false) inst:DoTaskInTime(0, OnInitNightVision) end And this i used it in my item: local function OnEquip(inst, owner) owner.discordnightvision:set(true) end local function OnUnEquip(inst, owner) owner.discordnightvision:set(false) end This is so when i equip the item i get nightvision, and lose it when i unequip it. Hope it helps you, the code i got it from @DarkXero so i take no credit for it, thanks him.
  9. @DarkXero i just tried the stuning but it doesn't seem to triger, i tried stuning spiders and tailbirds, and also for testing i used < 0.90 so i could be sure it wasn't because of %. Maybe is because i also got this in fn? inst.components.weapon.onattack = onattack besides ofc the one you gave me inst.components.weapon:SetOnAttack(onattack) i'm using this function with the "inst.components.weapon.onattack = onattack" that i already had. local function onattack(inst, owner, target) if not target:HasTag("wall") then owner.components.sanity:DoDelta(0.2) end end I'm guessing that i shouldn't have two "onattack" functions... what about merging your code with this one, like this? local function onattack(inst, attacker, target, owner) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if not target:HasTag("wall") then owner.components.sanity:DoDelta(0.2) end local chance = math.random() if chance < 0.25 then if target ~= nil and ~= nil and not then if not target:HasTag("discordstunned") then StartStun(target) target:DoTaskInTime(stuntime, StopStun) end end end end I had the nil value problem at first, but then added the line "local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner" and it started to work, now i get sanity for every hit (0.2), stun enemies with a 25% chance and gain sanity if they die and not smallcreatures. Thanks @DarkXero, i can move on to the next phase now, which is: Mp bar system. Btw, i know i'm adding a lot of sanity stuff to the mod, but the character i'm making is literally insane and loves to kill, so i got to add a lot of sanity features. Now i'm gonna start analysing mods like the jutsu mode to implement a special bar and make special ítems that uses that bar's energy to work. Once i got that working i'll publish the mod and start working on phase 3 which is the companion. Now that phase 1 is done i'm closer to publishing. Thanks a lot @DarkXero. if i get stuck in something from the phase 2 i'll look for help again, i can't bother people without trying first, is not right and is not my style. I ask for help only when i feel hopeless
  10. @DarkXero That codes looks great, it goes into myweapon.lua right? Also, this lines stands for the seconds of the stunned effect, right? local stuntime = 5 And this one sets the % if chance < 0.25 then So "if chance < 0.50 then" would be 50%, for example. Man, thanks to you the mod it's actually making a lot of progress, you're amazing. I hope i get to be half as good as you someday. I'm starting to understand more and more. Did you started doing DST mods knowing so much or did you also were a noob that got pro with time? (just curious to see if it's possible for me to become better)
  11. Hello, so I want to know is there a code to make an item glow a certain color? Like the character ítem glow code from this topic: By using this topic's code the char will take the color when equipping the item: owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(0) But what about the color glow just affecting the ítem? The most similar effect i've got is the haunted code which you put in the function fn: inst.AnimState:SetHaunted(true) Is it possible or am i going to far away? Thanks in advance I know am asking a lot of questions lately, but i think it might gonna worth it.
  12. You're right Well i have a better idea which is using a bar parameter (MP-energy) and when you don't have enough energy, you can't use the magic attack.
  13. This is not even my question but your answer is brilliant and shows how useful this could be in a mod. If i got it right this code could help to modify a weapon's cooldown time before being able to strike again, which is really important when coding a powerful weapon that without cooldown could overpower the player too much to be fun.
  14. I though you said i had to replace it with mycharname Look: So the code should be like this? local function onentitydeath(world, data) if data.inst and not data.inst:HasTag("prey") and not data.inst:HasTag("veggie") and not data.inst:HasTag("structure") and not data.inst:HasTag("butterfly") then if data.afflicter and data.afflicter.components.sanity and data.cause and data.cause.prefab == "myweaponname" then data.mycharname.components.sanity:DoDelta(4) end end end