Created
March 12, 2019 20:13
-
-
Save Mikhael-Danilov/c40d3fda4480a8eb68d31ce8fbfaea40 to your computer and use it in GitHub Desktop.
Выдаем герою случайный предмет. Один раз.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local storage = require "scripts/lib/storage" — подключаем библиотеку для работы с сейвами | |
local key = "ItemGiven" —id нашей записи о том что предмет выдан | |
if not storage.get(key) then —если предмет ещё не давали | |
local items = {"Dagger","RatHide"} — список предметов | |
local item = RPD.ItemFactory:itemByName(items[math.random(1,#items)]) — создаем предмет из списка | |
RPD.Dungeon.hero:collect(item) —даем предмет герою | |
storage.put(key,true) — запоминаем что дали предмет | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment