What's new

Surprise Bag

Status
Not open for further replies.

Warchief

User
Joined
Apr 3, 2010
Messages
47
Reaction score
6
Witam !
Dzisiaj udost?pni? wam item Surprise Bag !!!
Polega na tym, ?e jak u?yj? si? go to wylatuj? z niego s?odycze i r??ne inne ?eczy.
A wi?c:
w OTS/data/actions/actions.xml doklejamy linijk?:

PHP:
	<action fromid="6570" toid="6571" event="script" value="surprisebag.lua"/>
Potem w OTS/data/actions/scripts tworzymy plik o nazwie surprise bag.lua
a w nim wklejamy:

PHP:
local PRESENT_BLUE = {2687, 6394, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114}
local PRESENT_RED = {2152, 2152, 2152, 2153, 5944, 2112, 6568, 6566, 2492, 2520, 2195, 2114, 2114, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local count = 1
	if(item.itemid == 6570) then
		local randomChance = math.random(1, #PRESENT_BLUE)
		if(randomChance == 1) then
			count = 10
		elseif(randomChance == 2) then
			count = 3
		end
		doPlayerAddItem(cid, PRESENT_BLUE[randomChance], count)
	elseif(item.itemid == 6571) then
		local randomChance = math.random(1, #PRESENT_RED)
		if randomChance > 0 and randomChance < 4 then
			count = 10
		end
		doPlayerAddItem(cid, PRESENT_RED[randomChance], count)
	end
	doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
	doRemoveItem(item.uid, 1)
	return true
end
Potem w OTS/data/items/items.xml doklejamz linijk? :
PHP:
	<item fromid="6570" toid="6571" article="a" name="surprise bag">
I Gotowe !!! :)
Oczywi?cie mo?na zmieni? to co surprise bag wy?uca

PHP:
local PRESENT_BLUE = {2687, 6394, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114}
local PRESENT_RED = {2152, 2152, 2152, 2153, 5944, 2112, 6568, 6566, 2492, 2520, 2195, 2114, 2114, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574}
Dziekuj? i du?o zabawy z nowym bagiem ;)


@Edit

Item tworzymy komend?:
/i 6570 = Blue Surprise Bag
/i 6571 = Red Surprise Bag (Wy?uca fajne fajerwerki ;))
 

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Surprise Bag

Warn ?
Skrypt nie tw?j, widz? go w prawie ka?dym TFS.
Akurat, ci? z?apa?em bo pobra?em TFS'sa czystego, bez niczego podstawowe skrypty, i akurat znalaz?em ten skrypt.
Popraw ?e nie tw?j, albo leci raport.
 

sebastian666

New User
Joined
Mar 10, 2009
Messages
6
Reaction score
0
Odp: Surprise Bag

Dzi?ki, fajny skrypt :) Cho? nie tw?j ale dobrze ?e go tu wstawi?e?.
 
Last edited:
Status
Not open for further replies.
Top