Jump to content

Malacath

Registered Users
  • Posts

    780
  • Joined

  • Last visited

Reputation

124 Excellent

1 Follower

Converted

  • Modder
    http://forums.kleientertainment.com/user/245716-malacath/?tab=idm

Recent Profile Visitors

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

  1. @ZupaleX, I'm confused as well. Never did that and still don't do it. But I will write it in the tutorial to make sure noone has problems. @BaconAndRibs, yes, an EventListener is definitely more efficient. But I don't know if an according even is pushed anywhere in the code, so it's up to you to either find that event or use PostInit's to create it yourself.
  2. @BaconAndRibs, the only thing I can think about is modifying the player stategraph or doing a periodic task to check every frame. But I don't really have the time to try it myself. If you try it with a task then don't forget to cancel the task. -- In OnEquipinst.task = inst:DoPeriodicTask(0, UpdateAnim)-- In OnUnEquipinst.task:Cancel()isnt.task = nilAnd function UpdateAnim will check the facing and change the animation accordingly. It's easy but really suboptimal. @ZupaleX, that's only if you want to ovveride the default pivot, which is not necessary if you want to make just a weapon. If you want to do an armor or helmet then you need to do it.
  3. @BaconAndRibs, it doesn't work because you are accessing the same entity all the time. In your code there is only one inst, and I assume that that is the weapon since you (presumably) don't crash on inst.components.equippable:IsEquipped(). So instead you want to get the owner local owner = inst.components.inventoryitem.ownerAnd access the AnimState of this guy.
  4. @DerpTime, as long as the lootdropper component is not being removed on death, which I am pretty sure it isn't, then I don't believe you need to worry about that. So in general anything that you slap onto the player prefab stays there when the player dies. And since data.afflicter is the is the entity of what killed the player you can use most of DarkXero's code. Instead for checking in the table valid_murders you can instead check for tags of data.afflicter and decide upon that. And if I understand your dagger correctly, then you can either use DoTaskInTime after adding the tag to the target, there are many examples of this in the code, or you can listen for the event "losttarget". See what is more convinient for you and go with it. @DarkXero, I don't know what you mean. The code that I posted was a purely didactical example not meant to be ever used in anyone's code. So I don't see a problem with anything I did. And using _G is not actually a "bad habit", it just makes for more natural coding for me when using Lua.
  5. @Aurata,not really. There are many small things that could have gone wrong, so check every little detail with the tutorial, folder structure, spelling mistakes, and also check the log file. A common mistake is the following folder structure: mymod\exported\myitem\swap_myitem\swap_myitem\swap_myitem.png There is twice a folder named "swap_myitem" and that has to be like this! If you don't manage after sincerely trying you can upload the mod in a *.zip file and I can take a look.
  6. @BaconAndRibs, from my understanding you would need multiple files since the scml-compiler will create only one swappable anim file from one scml. If you manage with one file let me know though
  7. If you mean that A and B should be specific player/prefabs, the event "death" get's pushed with some data, see health.lua: self.inst:PushEvent("death", { cause = cause, afflicter = afflicter })So you can listen like this: _G = GLOBAL // A habit, I keep it in this post so the other posts makes sense ^^ inst:ListenForEvent("death", function(data) if data.cause == _G.ThePlayer then inst.components.lootdropper:DropLoot(inst:GetPosition()) end end)I can't promise you that cause will give the prefab that caused it, or if it says something like "combat" but I'm sure with some trial and error you will find out. Maybe you'll want to use afflicter instead.
  8. This clearly says that there is something wrong in your modmain.lua at line 45. Additionally this seems to me like you did something wrong with a filepath, maybe misspelled? Since you are adding a recipe it could simply be that the game is trying to open a file for the little recipe icon. So you possibly need to fix that. If you can't manage it you should probably post your modmain.lua alongside the error. Also in general be more descriptive when asking for help, on other sites people might not bother to answer if there is literally no information given. Tell us what you are trying to do, what you tried to fix it, what results you had from your own attempts, etc.
  9. @DarkXero, lots of "No"'s That's why it's important for me to ask. Thank you immensely for explaining me all of this! And sorry for making you explain all of this! When I was searching I couldn't really find some of the information you gave me in such a clear language, so it really helps a lot. And yes, since I am essentially recreating a crafting menu-of-sorts I am positive that I can reuse quite some existing code. And to summarize in short, more for myself: -Use the technique given up there to PushScreen on Client -Use Netvars to properly handle all screen elements and Client interaction -Use SendModRPC to tell the server the results of the Client interaction
  10. @Corrosive, Thanks for helping many many people in my abandoned tutorials! You're awesome @BaconAndRibs,unfortunately: No and no. Both could in theory be achieved by completely recreating the animations and using different symbols. But the amount of work to do for both of these is immense and I am not even going to attempt it. The second can also be achieved by swaping the symbol in the code, using some PeriodicTask and swaping every now and then. But that is tedious as well and needs to be hardcoded, an artist is not going to enjoy that. Both options are not really optimal, I would not do either (at least not a second time xD)
  11. @DarkXero, cool, first and foremost thank you a lot! I feel like my beginnings in DS modding though, so if you don't mind I will try to be more specific and ask some more question. Essentially what your code does is call the function doFunc for the respective player when attacking with a spear. Good so far? inst.pushmyscreen = GLOBAL.net_event(inst.GUID, "player.pushmyscreen")This registeres a network event on the player classified. Using the player classified here because it is designed for this I guess? if not GLOBAL.TheWorld.ismastersim then inst:ListenForEvent("player.pushmyscreen", doFunc)endThis here just because we can handle the serverside call of doFunv explicitly, like you mention later. attacker.player_classified.pushmyscreen:push()This is "essentially" resulting in a call of attacker:PushEvent("player.pushmyscreen") on the clientside? But can I easily pass data as one would expect? data = {target = target}attacker.player_classified.pushmyscreen:push(data)Resulting in something like attacker:PushEvent("player.pushmyscreen", data)? Then I can PushScreen in doFunc, needing to pay attention with that screen in may case because it accesses players components and what not. I guess I will need to tinker a lot here, but essentially I can just attach some more net_vars to player_classified and use those to communicate between server and client of what I need to properly represent the screen. Or is it a bad idea to clutter player_classified with more net_vers? Maybe there is some more appropriate way to do this?
  12. @DarkXero, to be honest, that is still a bit to vague for me. Do you know where I could see something similar in action? I just started looking into DST modding on thursday last week, so I am not really familiar with replicas. But if that is a safe way to do it I will need to learn it I guess.
×
  • Create New...