Guest User

Untitled

a guest
Feb 11th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. <Darthseid> Previously, onModDota
  2. <Darthseid> Dartjseid:Is it possible to get the attribute bonuses from an item to also apply when it is in stash? Or do you need to write out the txt of each item or something like that?
  3. <Darthseid> Noya:You need to do a loop of slots 6 to 11
  4. <Darthseid> with GetItemInSlot
  5. <Darthseid> then GetIntrinsicModifierName em
  6. <Darthseid> and apply them
  7. <Darthseid> everytime the stash changes you have to remove/reapply
  8. <Darthseid> https://codeshare.io/662cN
  9. <Darthseid> I am getting no prints or errors in console.
  10. * Disconnected (Connection reset by peer)
  11. * Now talking on #dota2modhelpdesk
  12. * Topic for #dota2modhelpdesk is: Dota 2 Modding Helpdesk: Ask your question, and we'll try to answer you | Forum: https://d2md.me/ | If in doubt, refer to https://d2md.me/d/14 | Use http://codeshare.io/new to share code bits. | Check for dota updates at http://store.steampowered.com/news/?appids=570&feed=steam_updates
  13. * Topic for #dota2modhelpdesk set by *.GameSurge.net (Sun Dec 13 19:11:13 2015)
  14. * ChanServ gives voice to Noya
  15. <Darthseid> Well show me how its done cuz incontestably, there's a disagreement.
  16. <Darthseid> Noya, do you need me to fill you in the deets or can you already guess what's going on?
  17. <BMD> wtf is "(attribute)"
  18. <BMD> why are you just guessing
  19. <BMD> why do you always guess
  20. <BMD> like, you're kind of on the right track, though it still needs some work
  21. <BMD> but you seem to think nthat somehow "(attribute)" will get the value from your local named "attribute"
  22. <BMD> which is crazy, but what's even crazier is instead of "(attribute)", all you had to do was
  23. <BMD> attribute
  24. <BMD> because that's how variables work
  25. <BMD> now that said, you don't provide any way to remove modifiers applied ikn this way, this way will only work for default dota items or item_lua
  26. <BMD> and nothing else
  27. <BMD> or wait
  28. <BMD> it'll work for nothing
  29. <BMD> because ability:ApplyModifier isn't a thing
  30. <BMD> it's nothing
  31. <BMD> there's ability:ApplyDataDrivenModifier
  32. <BMD> and npc:AddNewModifier
  33. <BMD> you've chosen neither
  34. <BMD> and the thing is, whichever one you choose isn't sufficient
  35. <Darthseid> I was going to use ApplyDatadriven but I didn't think it would be datadriven
  36. <BMD> one covers only datadriven, and the other covers only built-in dota items adn item_lua
  37. <BMD> additionally, if it IS datadriven, then item:GetIntrinsicModifierName doesn't work
  38. <BMD> because a datadriven doesn't have an intrinsic modifier, it has potentially multiple Passive modifiers
  39. <BMD> which work similarly but aren't accessed in the same way
  40. <BMD> if you want to know how to get at that stuff, then you get to check out some of the fun KV diving code I wrote for my containers library
  41. <BMD> and now, let's assume that you fix all that
  42. <BMD> and now you can handle datadriven + regular dota items + item_lua
  43. <BMD> and add them correctly
  44. <BMD> now you need to handle removal correctly
  45. <Noya> wait
  46. <BMD> because shit is going to go really badly unless you have extraordinarily tight controls over your items
  47. <BMD> really really badly
  48. <Noya> datadriven doesnt have intrinsic modifier?
  49. <Noya> Even if its "Passive" "1" ?
  50. <BMD> that didn't show up when i build containers.lua
  51. <Noya> in an item
  52. <BMD> so unless it was added in the last patch
  53. <Noya> I see
  54. <Noya> so yeah you'll have to read some KVs
  55. <func_door> An ability can only have one intrinsic but a data driven can have multiple "Passive" "1"
  56. <func_door> Afaik
  57. <BMD> https://github.com/bmddota/ContainersPlayground/blob/master/game/dota_addons/containersplayground/scripts/vscripts/libraries/containers.lua#L342-L385
  58. <BMD> that's how i handle finding the passives for datadrivens
  59. <Darthseid> What were you saying about removal?
  60. <BMD> and here's how oyu apply them correctly https://github.com/bmddota/ContainersPlayground/blob/master/game/dota_addons/containersplayground/scripts/vscripts/libraries/containers.lua#L101-L141
  61. <BMD> notice all of the tracking actions
  62. <BMD> because you need fun stuff like this
  63. <BMD> https://github.com/bmddota/ContainersPlayground/blob/master/game/dota_addons/containersplayground/scripts/vscripts/libraries/containers.lua#L1647-L1657
  64. <BMD> in order to handle cases like where your items get pulled into a recipe from stash
  65. <BMD> and are effectively "destroyed"
  66. <BMD> or in my case, where a user eats a mango in their equipment container
  67. <BMD> so that i can properly remove the mango +1 hp regen passive
  68. <Darthseid> So should this code be on the ability file or should it be apart of the library?
  69. <BMD> you need to explain what you want to do
  70. <BMD> very carefully and correctly
  71. <BMD> and i'm going to tell you if it's even remotely possible for you to accomplish it
  72. <Darthseid> I want the passive modifiers in inventory to also apply from the stash.
  73. <BMD> that's a terrible idea
  74. <BMD> don't do it
  75. <Darthseid> So if I have boots in my stash, I move faster
  76. <BMD> there are dozens of seriouslty fucked up edge cases
  77. <BMD> when workign with this stuff
  78. <BMD> and at least 4 ways to crash a server
  79. <BMD> by doing incredibly simple things
  80. <BMD> you're literally asking for something no one else has done except me
  81. <BMD> ever
  82. <BMD> and there's a reason for that
  83. <Darthseid> I thought this was a community of boundary pushers who's motto is "The sky is the limit."
  84. <Darthseid> If only we had an actual Valve employee with us.
  85. <Darthseid> Well, I guess my 3rd ability is officially in beta stage now.
  86. <func_door> I mean, if every item in the game is custom, it becomes more sane
  87. <Darthseid> If the game was coded completely in lua and we had the source code, it would be doable.
  88. <BMD> dude
  89. <BMD> you can't write code for shit
  90. <BMD> you're literally the worst i've ever seen at it
  91. <BMD> who didn't give up immediatley after realizing it
  92. <BMD> and you're asking to do something that literally no one else besides me has done
  93. <Darthseid> But I'll get over it, I almost in the beta stage for my mod.
  94. <BMD> adn that's the thing, i have done it
  95. <BMD> and i can do it
  96. <BMD> but *you* can't do it
  97. <BMD> i could write every line for you
  98. <BMD> and i don't think you'd be able to even use it
  99. <BMD> this isn't a simple change
  100. <BMD> this is the fucking real world of dota modding you're asking about
  101. <BMD> not some bullshit fuckaround time
  102. <BMD> you're asking for a way to evade one of the intrinsic properties of the game engine
  103. <BMD> and literally no one does that but me
  104. <BMD> i can also tell you for sure that i know more about this side of the engine that almost anyone at valve
  105. <Darthseid> you must truly be the duke of modders here.
  106. <BMD> so trust me when i tell you that what you want to do shouldn't be done
Add Comment
Please, Sign In to add comment