MrDoge124

  • Content Count

    56
  • Joined

  • Last visited

Community Reputation

3 Neutral

About MrDoge124

  • Rank
    Junior Member
...

Recent Profile Visitors

660 profile views
  1. I got it to work. I asked a friend and we fixed it. So while poking around at another character, we discovered differences in the code that allowed us to reverse engineer a solution. With the error message telling us that “Inst” was a null value. Initially we thought that Inst was always in reference to the player whenever it’s called. THIS IS NOT THE CASE. We then found that whenever we declared a function, "Inst" was not declared. AddModRPCHandler(“Green”,"GREEN_STUN", function(---INST IS MISSING HERE---) We changed “Inst” to “player” just to make the code more readable in the future and then changed any reference to Inst into player. In addition to this, several functions were missing declarations which we fixed by adding player. AddModRPCHandler(“Green”,"GREEN_STUN", function(player) Thanks for the help!
  2. I've tried to add RPC handlers to the code but it doesn't work, I'm not sure what I'm doing. I've found this error in the code.
  3. I've seen mods use those before but I'm not sure how I'd set one up for myself.
  4. In this previous post I managed to get a AOE stun attack working. However when I enable caves it doesn't work. Turns out I think I'm missing something. It might be an action handler or some sort of net code which could be why it doesn't work when caves are enabled. It also doesn't crash or print anything to the logs, So I'm not sure why it isn't working. This is the code. It's all contained inside a character lua file. Any help would be appreciated.
  5. I've looked at other examples and they all seem to use an action handler. I'm going to have to look into this and either figure out how these things work or try to find another way to do it.
  6. When I enable caves it does nothing, no errors. Nothing is printed even if I tell it to print something. I think something isn't being triggered properly. My best guess is the "TheInput:AddKeyDownHandler(KEY_Z, function()" part isn't working right as nothing happens when I press Z. I might have to add an action for the attack, but I'm not sure how that works. I've found an example where actions are used and it seems to work fine.
  7. I'm not sure what to do. I've looked at other aoe attacks and they seem to have stuff like "SendRPCToServer" and the code mentions actions. I've attached the code I'm using right now if you need it. green.lua
  8. Sorry to bother you but it doesn't seem to work when I enable caves. I think this might be because I don't have any networking code and I have no idea how to do that... Any help would be appreciated.
  9. Ok I got it to work with some help from a friend. Here is the code Also the keyhandler.lua which goes in a components folder in scripts. Thank you for the help! I'm sorry if i was being a pain.
  10. So I got it to find other things and the basics work Here is what I did to get it to work. (It probably isn't very efficient.) I'm not sure how to get cool downs to work and the effects to the character. (Turning off the light and the sanity penalty.)
  11. I think I'm missing something, because I get this error when I press the key [00:01:43]: [string "../mods/Green/modmain.lua"]:198: attempt to index local 'instToBuff' (a nil value) LUA ERROR stack traceback: ../mods/Green/modmain.lua:198 in (upvalue) ApplyBuff (Lua) <194-234> buffData = table: 4B41C1D0 instToBuff = nil buffUniqueName = stunbuff ../mods/Green/modmain.lua:273 in (field) fn (Lua) <272-274> scripts/events.lua:46 in (method) HandleEvent (Lua) <42-49> self = events = table: 29B1A1C0 event = 122 arg = nil handlers = table: 4B41C2C0 k = table: 4B41C270 v = true scripts/input.lua:187 in (method) OnRawKey (Lua) <184-191> self = onkeyup = table: 29B1A3F0 entitiesundermouse = table: 8E1BCF40 onmousebutton = table: 29B19F40 controllerid_cached = 0 onkey = table: 29B1A3C8 enabledebugtoggle = true ongesture = table: 29B1A418 mouse_enabled = true ontextinput = table: 29B1A648 position = table: 29B1A760 onkeydown = table: 29B1A198 oncontrol = table: 29B1A8C8 key = 122 down = true scripts/input.lua:396 in () ? (Lua) <395-397> key = 122 is_up = true [00:01:43]: [string "../mods/Green/modmain.lua"]:198: attempt to index local 'instToBuff' (a nil value) LUA ERROR stack traceback: ../mods/Green/modmain.lua:198 in (upvalue) ApplyBuff (Lua) <194-234> ../mods/Green/modmain.lua:273 in (field) fn (Lua) <272-274> scripts/events.lua:46 in (method) HandleEvent (Lua) <42-49> scripts/input.lua:187 in (method) OnRawKey (Lua) <184-191> scripts/input.lua:396 in () ? (Lua) <395-397> I think I'm just being stupid here, but I'm not sure what is wrong.
  12. I've been using this code to activate the buff TheInput:AddKeyDownHandler(KEY_Z, function() ApplyBuff(Buffs["stunbuff"], inst) end) However this seems to target me and nothing else. I'm not sure how to target things around me and not myself. I also need a way of adding a cool down so that I can't just use it constantly. Here is what the rest of the code looks like.
  13. So far I have this, inst.lightstunisapplied = false local applybuff = function(inst) -- Apply all your buff stuff here inst.components.locomotor:SetExternalSpeedMultiplier(inst, "lightstunkey", 0) end local removebuff = function(inst) -- Remove all your buff stuff here inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "lightstunkey") end inst:DoPeriodicTask(0.5, function(inst) if inst == nil or not inst:IsValid() or inst.components.health:IsDead() then -- If the player instance is invalid or they're dead, then we don't want to do anything. return end -- If our buff is applied and our measurements say it should not be applied anymore, we remove it. -- Else, if our buff is not applied and our measurements say it should be, we apply it. if inst.lightstunisapplied and inst.components.sanity:GetPercentWithPenalty() > 0.07 then removebuff(inst) elseif not inst.lightstunisapplied and inst.components.sanity:GetPercentWithPenalty() <= 0.07 then applybuff(inst) end end) This seems to slow him down when on 7% sanity. I'm not sure how to find an entity and slow them down with the inst thing and I am not sure how I would activate this with a key press. I do know however that I'll need a keyhandler.lua as other mods use this when dealing with key inputs.
  14. I had a character that can glow in the dark, I though of an idea where they could use this light to stun enemies. I've looked at examples but I couldn't quite get it right. I wanted to make it so when he activates it his light will be gone for 8 minutes (a day) and he'll get a sanity penalty. (About -10 to -15 maybe?) I was going to make it activated by a key press by I couldn't quite figure it out. Any help would be appreciated.