Near4422

  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

4 Neutral

About Near4422

  • Rank
    Junior Member
...

Recent Profile Visitors

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

Enable
  1. It works if I cut the code for sanity check, so I think that's not an issue. At least for now. I've found a solution. attacker.components.sanity This part above was an issue and caused crashes. Without it it works like a charm!
  2. @Combustiblemon Thank you for your reply, I knew i was getting close. Saddly it doesn't work... I don't know why - I can't even log onto server with mod enabled with this code. local assets= { Asset("ANIM", "anim/greatericestaff.zip"), Asset("ANIM", "anim/swap_greatericestaff.zip"), Asset("ATLAS", "images/inventoryimages/greatericestaff.xml"), Asset("IMAGE", "images/inventoryimages/greatericestaff.tex"), } local function onattack_atiesh(inst, attacker, target) if not inst.components.fueled:IsEmpty() and attacker.components.sanity and attacker.components.sanity.current > 5 then inst.components.weapon:SetDamage(40) attacker.components.sanity:DoDelta(-10) if target.components.freezable ~= nil then target.components.freezable:AddColdness(1) target.components.freezable:SpawnShatterFX() end inst.components.fueled:DoDelta(-1) else inst.components.weapon:SetDamage(12) if target.components.freezable ~= nil then target.components.freezable:AddColdness(0.25) target.components.freezable:SpawnShatterFX() end end end local function fn(colour) local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_greatericestaff", "purplestaff") if not owner:HasTag("rubick") then --Replace TAG with a tag only your character has inst:DoTaskInTime(0, function() if owner:HasTag("player") then owner.components.inventory:DropItem(inst) --Drops the item if they don't have the above TAG owner.components.talker:Say("I can't pick that up!")-- Generic line return end end) return end owner.AnimState:OverrideSymbol("swap_object", "swap_greatericestaff", "greatericestaff") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) anim:SetBank("greatericestaff") anim:SetBuild("greatericestaff") anim:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "greatericestaff" inst.components.inventoryitem.atlasname = "images/inventoryimages/greatericestaff.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst:AddComponent("fueled") inst.components.fueled.maxfuel = 20 inst.components.fueled.fueltype = FUELTYPE.BLUEGEMS inst.components.fueled.accepting = true -- so it takes fuel inst.components.fueled:InitializeFuelLevel(20) inst:AddComponent("weapon") inst.components.weapon:SetOnAttack(onattack_atiesh) inst.components.weapon:SetRange(8, 10) inst.components.weapon:SetProjectile("ice_projectile") inst:AddComponent("tool") -- inst.components.tool:SetAction(ACTIONS.CHOP, 1) -- inst.components.tool:SetAction(ACTIONS.DIG, 1) -- inst.components.tool:SetAction(ACTIONS.MINE, 1) -- inst.components.tool:SetAction(ACTIONS.HAMMER, 1) return inst end return Prefab("common/inventory/greatericestaff", fn, assets, prefabs) It's a simple custom ice staff. Do you have any idea what's wrong?
  3. How do you get the value of component... let's say sanity? inst.components.sanity: I am blindfully trying GetValue, Value, Get but none of them seems working. I know you can get percent, but I'd rather go with exact value. I am trying to build a if statement that gets player character's sanity value and if it's higher than X then rest of the code occurs.
  4. Oh so it's components then... I was trying to reach the 'combat' part in so many weird ways but didn't actually think it needs to be called by components. Thank you so much!
  5. local function DMGaura(inst) local x,y,z = inst.Transform:GetWorldPosition() local pt = inst:GetPosition() local range = TUNING.LIFESTEAL_RANGE -- range of ability local DMG = -TUNING.LIFESTEAL_DAMAGE -- Damage dealt to enemies around per tick local HP = TUNING.LIFESTEAL_HEAL -- HP restored per tick local tagz = {"monster"} local canttagz = {"scarecrow"} local check = TheSim:FindEntities(pt.x,pt.y,pt.z, range, tagz, canttagz) for _,ent in ipairs(check) do if not ent.components.health:IsDead() and ent.prefab == "spider" or ent.prefab == "spider_hider" or ent.prefab == "spider_spitter" or ent.prefab == "deerclops" or ent.prefab == "hound" or ent.prefab == "firehound" or ent.prefab == "icehound" or ent.prefab == "houndfire" or ent.prefab == "houndbone" or ent.prefab == "houndmound" or ent.prefab == "krampus" or ent.prefab == "mosquito" or ent.prefab == "crawlinghorror" or ent.prefab == "terrorbeak" or ent.prefab == "spider_warrior" or ent.prefab == "spiderqueen" or ent.prefab == "tallbird" or ent.prefab == "tentacle" or ent.prefab == "dragonfly" or ent.prefab == "klaus" or ent.prefab == "bearger" or ent.prefab == "stalker" or ent.prefab == "antlion" or ent.prefab == "bunnyman" or ent.prefab == "pigman" or ent.prefab == "merm" or ent.prefab == "walrus" or ent.prefab == "little_walrus" or ent.prefab == "leif" then ent.components.health:DoDelta(DMG) SpawnPrefab("toadstool_cap_releasefx").Transform:SetPosition(ent.Transform:GetWorldPosition()) inst.components.health:DoDelta(HP) SpawnPrefab("wortox_portal_jumpin_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end end local function maincheck(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") and not inst:HasTag("playermonster") then DMGaura(inst) end end -- 1 time interval between every tick (seconds-ish, it's not 100% accurate) inst:DoPeriodicTask(2, maincheck, nil, inst)
  6. I've no idea what am I looking for while scrolling through the combat.lua to be honest. Or actually how to use it.
  7. Hey there, I am wondering if there's a way to gain monsters attention? I do have a damage aura around my custom character that deals damage to monsters around every couple of seconds, but it doesn't bother the monsters themselfs. I mean - if a players sets aura range high enough - he can be dealing damage to them without them noticing - I'd like to change that. Anyone got the idea how to make it?
  8. Hmm... for some reason this code doesn't allow me even compile the mod. I get error whenever i try to launch a server :c local function onequip(inst, owner) local owner = inst.components.inventoryitem.owner or nil if not owner:HasTag("scarecrow") then --Replace TAG with a tag only your character has inst:DoTaskInTime(0, function() if owner:HasTag("player") then owner.components.inventory:DropItem(inst) --Drops the item if they don't have the above TAG if owner:HasTag("mime") then owner.components.talker:Say("") --Nothing, mimes aren't able to talk elseif owner.prefab=="wx78" then owner.components.talker:Say("ERROR: READ-ONLY ITEM") --Custom WX line, he is a robot. elseif owner.prefab=="wilbur" then owner.components.talker:Say("Ooo")-- Wilbur is monkee else owner.components.talker:Say("I can't pick that up!")-- Generic line return end end) return end owner.AnimState:OverrideSymbol("swap_object", "swap_scare_scythe", "scare_scythe") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end I've literarly this code above. Uhm... nevermind... i've been impatient... I just cut the code for the custom character lines and it worked.. weird but... I am fine with that.... Thank you for your time!
  9. Hmmm... I think other characters could pick it up if that's easier... just not be able to use it - it's weapon and tool. If it's easier it could be completely not pickable.. dunno. Makes no differace to me. Altough I think it would be harder to prevent usage than pick up at all. As it is for crafting - Yeah - now i remember. Gonna work on that Thanks!
  10. How to simply specify the character that can use the item? And add item recipe that is only avaiable for him (not global)?
  11. Hey there! I am working on my first mod and finally got into the part with animations. Altough i do understand what I am supposed to do in order to decompress and edit the animation - the part with decompressing doesn't work for me at all. Everytime i try to do so with krane [ktools] i get an error: ERROR: krane.exe: UnableToOpenConfigureFile 'colors.xml' @ warning/configure.c/GetConfigureOptions/706 Could anybody help me with that matter? Am I doing something wrong? Or it's simply the caus of x64 bit system architecture?
  12. Is there a way to check all the regular tags inside the game? OR Is there any tag assigned to players only? My mod uses a 'monster' tag and i would like it not to target players that play as a monster characters (Wortox for example).
  13. Bump. Still looking for a help with this stuff :/
  14. No matter what i am trying to generate from I am still getting the same error -> UnableToOpenConfigureFile 'colors.xml'. (screenshots attatched) Anybody got an idea how to fix it? I am trying to learn about animations a bit and create a new one for my custom boomerang. @JamesBucket
  15. I've just created a custom boomerang-item (based on some files found in other mod) and now i'd like to change the animations for it. I've already managed to change it's icon in inventory but really can't figure it out how to create or change the animations. Couldn't also find any good tutorials for the boomerang animations on forum. There's this one tutorial here -> [Tutorial] Creating a "handslot-equippable-item" from scratch but it covers only a ground animation. I think i might need to see how the animations are done before i can make my own. Could anyone help me with that task? Also I've tried to generate Spriter project files with ktools (krane) but I am getting an error all the time, no matter what animation i am trying to generate from (error message attached).