• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Talaturen] About Lottery Ticket Seller

Mokerhamer

Retired Global Mod
Senator
Joined
Aug 6, 2007
Messages
1,786
Reaction score
37
Oke,

Today i wanted to make an lottery ticket seller for my addon quest and for Questing, But as soon as i started i got some troubles that you cant fix unless you got 2 New Lua functions:o

So Tala mind helping us out?

How does my ticket seller works:
-U need to trade 100 Empty vials for 1 lottery ticket (Need new function)
-When u get the item it sets an Description and an action it (Action id bug)


Oke i'v used this script.
Code:
	if msgcontains(msg, 'ticket') or msgcontains(msg, 'tickets') then
		selfSay('So you want to trade 100 empty vials for 1 lottery Ticket?')
		talk_state = 1
		
			elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if rand >1 and rand <10 then
            if doPlayerTakeItem(cid,2006,1) then
			ticket = doPlayerAddItem(cid,5957,1)
           if doSetItemSpecialDescription(ticket,'It sais: Congratulations, You have an Winning Ticket!') and doSetItemActionId(ticket,8888) then  	   
			selfSay('Here you are!')
						
			elseif msgcontains(msg, 'no') then
				selfSay('Then not.')
				talk_state = 0
			end
		end
		end
		end
	return TRUE
end


Now i have these bugs.
-Player can use all vials becuase the have the same action id i tought about an new vial remove function example "DoRemoveVial(Cid,itemid,Type,Count)"
And how to use it well to creat an Empty vial u need to sai /i 2006 8, so u need to use this function like.

DoRemoveVial(Cid,2006,8,100) (I want 100 vials removed.

Oke the second thing i found out that you cant set an description + action id, so i have 2 solutions.

-Change actiond id code so u can make it work with description or an new description function like
"getItemSpecialDescription('It sais: Congratulations, You have an Winning Ticket!')" why do i need this description checker? because other Npc's need to check if you have an winning ticket through this or action id.

Tala i really hope u can help me out actually us since more people are going to use it.
 
Hi.
Can't you make like this?
Code:
 if msgcontains(msg, 'vial') or msgcontains(msg, 'vials') then
        selfSay('Do you want trade 100 vials for 1 Lottery Ticket?')
        talk_state = 1
    elseif msgcontains(msg, 'yes') and talk_state == 1 then
        if getPlayerItemCount(cid,2006) >= 100 then
            if doPlayerTakeItem(cid,2006,100) == 0 then
                selfSay('Here you are.')
                doPlayerAddItem(cid,5952,1)
            end
        else
            selfSay('Sorry, you don\'t have the items.')
        end
And set the description on items.xml?

Code:
function onUse(cid, item, frompos, item2, topos)
	if (math.random(1,5) == 1) then
		doSendMagicEffect(frompos, 2)
		doTransformItem(item.uid, 5958)
	else
		doRemoveItem(item.uid, 1)
	end
	return 1
end

I hope it help's you ;)
 
Actually i want an npc to set discription on it so if i need to change things i can change it in 1 script and this is not only about ticket seller we can use these functions in other npc's to!


and about the first script it will acsept any vial example it will acsept vials with water mana blood anything!
 
Yea, the fuctions would help.
and about the first script it will acsept any vial example it will acsept vials with water mana blood anything!
For me that's not a problem.
 
@Bump

Oke i'v made for the ticket an new function in actions, in actions it will set discription but when you buy it from npc it will set action id i have an problem now i'm not able to make an random npc.
 
You haven't added - "itemid", so i think thats why this not set desription.

Try this:
Code:
if doSetItemSpecialDescription(ticket.itemid,'It sais: Congratulations, You have an Winning Ticket!') and doSetItemActionId(ticket.itemid,8888) then
I think it should fix your problem 99%, becouse i was have same problem but with GetPlayerSlotItem. ;)
 
You haven't added - "itemid", so i think thats why this not set desription.

Try this:
Code:
if doSetItemSpecialDescription(ticket.itemid,'It sais: Congratulations, You have an Winning Ticket!') and doSetItemActionId(ticket.itemid,8888) then
I think it should fix your problem 99%, becouse i was have same problem but with GetPlayerSlotItem. ;)

it sets discription but i want it to set action id, then it will only set action id and bug my characters with Ioitems or somting like that but dosen't matter i found an other way but i have some problems with my Npc randomiser i cant figure it out.. it should work in action files it works to..
 
Back
Top