(stunlock = PLAYERSTUNLOCK.RARELY and TUNING.STUNLOCK_TIMES.RARELY) or ( (stunlock = PLAYERSTUNLOCK.NEVER and math.huge) or Not (inst.sg:HasStateTag("idle") and inst.sg.timeinstate > 0) andĭ ~= nil andĭ.playerstunlock or gjans: we transition to idle for 1 frame after being hit, hence the timeinstate check I was digging deeper into a and am almost certain this has something to do with it.ĮventHandler("attacked", function(inst, data)Įlseif inst.sg:HasStateTag("nointerrupt") then Is what I tried, maybe I'm doing it wrong? If inst.puturvaluefornotgettinghithere and a then a.playerstunlock = b end If inst.puturvaluefornotgettinghithere and a thenĪ.playerstunlock = Local puturvaluefornotgettinghithere = trueĪddStategraphPostInit("wilson", function(sg) Thanks for your response but it didn't seem to work. I'm not sure if LUA is supposed to be this difficult, or if the developers just made it hell to work with. But otherwise if I don't figure this out which took me two days of reading through code and using useless API, then I much rather mod another game. nor does it effectively explain anything. Yeah this is all I got following the API the provided us which clearly doesn't work. Inst.sg:GoToState("hit_spike", data.attacker)Īnd :HasStateTag("pushing") thenĮlseif ~= nil and :IsStuck() thenĮlseif data.stimuli = "electric" and not :IsInsulated() thenĪddStategraphActionHandler("willow",ActionHandler(MYACT, "newattack")) Pushing = data.attacker ~= nil and ~= nil and :HasStateTag("pushing"), Timeleft = inst.sg.statemem.task ~= nil and GetTaskRemaining(inst.sg.statemem.task) or inst.sg.statemem.parrytime, If not inst.sg:HasStateTag("parryhit") then :DoWakeUp()Įlseif inst.sg:HasStateTag("parrying") and data.redirected then Inst.SoundEmitter:PlaySound("dontstarve/wilson/hit")Įlseif inst.sg:HasStateTag("sleeping") then don't interrupt transform or when bucked in the air If data.weapon ~= nil and data.weapon:HasTag("tranquilizer") and (inst.sg:HasStateTag("bedroll") or inst.sg:HasStateTag("knockout")) thenĮlseif inst.sg:HasStateTag("transform") or inst.sg:HasStateTag("dismounting") then If not :IsDead() and not inst.sg:HasStateTag("drowning") then Inst.ListenForEvent("attacked", function(inst,data) PVPATTACK(inst, data, false)ĪpplyBuff(Buffs, data.attacker) :RemoveExternalSpeedMultiplier(inst, "Slow") :SetExternalSpeedMultiplier(inst, "Slow", 0.1) This is an example of how to use the CreateBuff() function to create a new buff. Local function CreateBuff(uniqueName, duration, applyFunction, removeFunction) This function creates a new buff-data object and adds it to the Buffs-dictionary Now to make some buffs and put them in a Buffs-dictionary. InstToBuff = instToBuff:DoTaskInTime(buffData.duration, function(inst) Set up removal after a certain amount of time. InstToBuff.OnSave = function(self, inst, data) Local buffOnSave = function(self, inst, data) Without it, you could apply a max-health buff, quit before it ran out, rejoin, and you would have kept This is only necessary if you change variables which are saved, like current health, health-penalty, etc. Make sure that our buff is removed BEFORE the entity is saved (the server is closed or player quits). Cancel any existing duplicate timed buff. Local buffUniqueName = buffData.uniqueName Local function Applybuff(buffData, instToBuff) That is why I tried using AddPlayerPostInit, yet whenever I tried to do any of this, it ALWAYS crashes. It seems like you have to create a function to begin to listen, but to run the function, it has to be called by another function. My biggest problem is how listen events work. I used the buff API and I think I set it correctly for the most part, yet the game crashes. So because I'm working on a PvP mod, I need to start dealing with buffs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |