#How the item binds to the lua script?
1 messages · Page 1 of 1 (latest)
doesn't look like this is the item that adds exp
I am confused too. but other items kv are almost the same as this item except for id,texture things. it is import that the content in "Runscript" is null for all items, but they do have different functionalities like heal hp, add mana.
This item doesn't do anything at all from its datadriven definition. They probably are listening to "buy item" event and are doing something in lua on it
But if they are then this is a terrible way to do it
dota_item_purchased is the event name: https://moddota.com/api/#!/events/dota_item_purchased
You use ListenToGameEvent to listen to events.
Here is an example usage (not the same event but the idea is the same):
https://github.com/EarthSalamander42/dota_imba/blob/b9ab7f040020fb5020820275cc36b3095b8771de/game/scripts/vscripts/components/frantic/events.lua
Events guide that I wrote, it is for Typescript but the same concept works fine for lua:
https://moddota.com/scripting/Typescript/typescript-events/
I have read the doc. it is useful . The reason I think that the author write the pattern of code is that he doesn't want the hacker to see the code in the lua file. He just uses listen to the event in server, and then write the server code to handle the logic. At last, encrypt the logic with GetDedicatedServerKey. Using this pattern, the client can not see the item handler anymore?
Oh we're still talking about that game with the encryption. Sorry, can't help you.
@pine gorge are people that worried about code stealing? I was under the impression that after darklord passed away, that kind of behavior died down. Bad actors on the chinese scene?
Maybe it's about MouseCallback event on panorama? double click with lmb to launch custom event the server already listens to