• 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!

Click item, give random addon ?

psilocibe

Member
Joined
Jul 9, 2007
Messages
479
Reaction score
8
Is there any script that when you click on an item it a random addon for the player?
 
I use tfs 1.0
Look at the picture.

addon.jpg


I buy items by clicking on them.
I want to click the DOLL and when he uses it to give me a random addon.
This way I can influence the trade DOLL.

Can you understand me? Is there a script to do this?
 
I think the question is,

Should it give Player Outfits or Creature Outfits?
If it gives player outfits, should it give the full outfit with Addons? Should all outfits be avaialabe in the table or do you have a selection of outfits that you wish to be randomized?

A little more detail on which outfits you would like to be available through the random selection.
 
Should it give Player Outfits or Creature Outfits?
>> Only Player Outfits.

If it gives player outfits, should it give the full outfit with Addons?
>> Only clothes without supplements.

Should all outfits be avaialabe in the table or do you have a selection of outfits that you wish to be randomized?
>> It is only one outfit of time.The doll clothes by item should disappear after use.

A little more detail on which outfits you would like to be available through the random selection.?
>> All clothing. But only one player will receive, that is lucky. And he can not get an outfit you already have.

How is this possible?
 
Which addons should it give, from which outfits and the first or second addon or both? Post a list of outfit ids.
What should happen with the doll, should te be removed or a storage added so the player can't get another addon?
 
Which addons should it give, from which outfits and the first or second addon or both?
>> First and second. One Full addon. Boths.

Post a list of outfit ids.

>> data/XML/outfits.xml

<outfit type="1" looktype="128" name="Citizen" premium="0" unlocked="1" enabled="1" />
<outfit type="1" looktype="129" name="Hunter" premium="0" unlocked="1" enabled="1" />
<outfit type="1" looktype="130" name="Mage" premium="0" unlocked="1" enabled="1" />
<outfit type="1" looktype="131" name="Knight" premium="0" unlocked="1" enabled="1" />
<outfit type="1" looktype="132" name="Nobleman" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="133" name="Summoner" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="134" name="Warrior" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="143" name="Barbarian" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="144" name="Druid" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="145" name="Wizard" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="146" name="Oriental" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="151" name="Pirate" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="152" name="Assassin" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="153" name="Beggar" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="154" name="Shaman" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="251" name="Norseman" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="268" name="Nightmare" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="273" name="Jester" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="278" name="Brotherhood" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="289" name="Demonhunter" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="325" name="Yalaharian" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="328" name="Husband" premium="0" unlocked="0" enabled="1" />
<outfit type="1" looktype="335" name="Warmaster" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="367" name="Wayfarer" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="430" name="Afflicted" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="432" name="Elementalist" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="463" name="Deepling" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="465" name="Insectoid" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="472" name="Entrepreneur" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="512" name="Crystal Warlord" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="516" name="Soil Guardian" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="541" name="Demon" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="574" name="Cave Explorer" premium="1" unlocked="0" enabled="1" />
<outfit type="1" looktype="577" name="Dream Warden" premium="1" unlocked="0" enabled="1" />

This list ?



What should happen with the doll, should te be removed or a storage added so the player can't get another addon?

If the addon random DOLL by the player already has, he must try again until it comes a new outfit. If the player already has all the outfits, then DOLL may be sold, or used in another player.

Sorry my English. I'm struggling.

I think this script is very hard to do.

: - /
 
I'm pretty sure Limos can make almost anything but the concept needs to clear.

So the doll has unlimited uses until the player has all the outfits:
When the player uses the doll does he have to pay something or is the click free?
Is there a random chance of getting no outfit as well?

I think, for me atleast, it's still a little unclear exactly how the doll should be working.
 
What do you think?

The doll must have to give one full addon.
If the player already has, so it can be used again to try to take another addon.
If the player already has all the addons it can no longer be used in this player.
The doll can not be used by a player to another player.
Thus it can be sold or traded.
There are other ways to improve this. But I believe that this is the basic way to start the script.

Thank you for your attention in this case.
 
Ok there are just a few thing that I'm still unclear about.

There must be some sort of payment for using the doll otherwise players can keep using it until they have all addons and then you might as well just give them all the outfits after 1 click.

Second, I didn't understand these lines:
The doll can not be used by a player to another player.
Thus it can be sold or traded.
The doll CAN or CAN NOT be traded and used by another player?
 
There must be some sort of payment for using the doll Otherwise players can keep using it Until They have all addons And Then you might as well just give them all the outfits after one click.

>> Yes. To have the doll must pay 20cc

These are the steps
>> Step 1: Click here to buy the 1x doll
>> Step 2: Click the doll to use on you
>> Step 3:
If doll == used and the player does not have random addon. Doll gives the addon and disappears.
If doll == used and player has the addon. Doll can be reused.
If doll == used and player has all the addons. Doll can not be used in this player.


The doll CAN or CAN NOT be traded and used by another player?
>> Can be marketed.
>> Can not be used on another player. "NO TARGET"

Example: potions.
I can use potions on me. But I can not use another player.
Doll must be equal.
 
This will work, I already tested it.
Let me know if you get any errors or want to make some changes.

Code:
local looktypes = {
    [1] = {male = 128, female = 136, name = 'citizen'},
    [2] = {male = 129, female = 137, name = 'hunter'},
    [3] = {male = 130, female = 138, name = 'mage'},
    [4] = {male = 131, female = 139, name = 'knight'},
    [5] = {male = 133, female = 141, name = 'summoner'},
    [6] = {male = 134, female = 142, name = 'warrior'},
    [7] = {male = 143, female = 147, name = 'barbarian'},
    [8] = {male = 144, female = 148, name = 'druid'},
    [9] = {male = 145, female = 149, name = 'wizard'},
    [10] = {male = 146, female = 150, name = 'oriental'},
    [11] = {male = 151, female = 155, name = 'pirate'},
    [12] = {male = 152, female = 156, name = 'assassin'},
    [13] = {male = 153, female = 157, name = 'beggar'},
    [14] = {male = 154, female = 158, name = 'shaman'},
    [15] = {male = 251, female = 252, name = 'norseman'},
    [16] = {male = 268, female = 269, name = 'nightmare'},
    [17] = {male = 273, female = 270, name = 'jester'},
    [18] = {male = 278, female = 279, name = 'brotherhood'},
    [19] = {male = 289, female = 288, name = 'demonhunter'},
    [20] = {male = 325, female = 324, name = 'yalaharian'},
    [21] = {male = 335, female = 336, name = 'warmaster'},
    [22] = {male = 367, female = 366, name = 'wayfarer'},
    [23] = {male = 430, female = 431, name = 'afflicted'},
    [24] = {male = 463, female = 464, name = 'deepling'},
    [25] = {male = 465, female = 466, name = 'insectoid'},
    [26] = {male = 472, female = 471, name = 'entrepreneur'},
    [27] = {male = 512, female = 513, name = 'crystal warlord'},
    [28] = {male = 516, female = 514, name = 'soil guardian'},
    [29] = {male = 541, female = 542, name = 'demon'},
    [30] = {male = 574, female = 575, name = 'cave explorer'},
    [31] = {male = 577, female = 578, name = 'dream warden'},
  
}

local cost = 200000

function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)

if player:getMoney() < cost then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 20 cc to use this doll.")
return true
end

local random1 = math.random(31)
outfitName = looktypes[random1].name

if player:getSex() == 1 then
outfit = looktypes[random1].male
else
outfit = looktypes[random1].female
end

if not player:hasOutfit(outfit) then
player:addOutfit(outfit)
player:removeMoney(cost)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the base ".. outfitName .." outfit.")
elseif player:hasOutfit(outfit) and not player:hasOutfit(outfit, 1) then
player:addOutfitAddon(outfit, 1)
player:removeMoney(cost)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the first ".. outfitName .." addon.")
elseif player:hasOutfit(outfit, 1) and not player:hasOutfit(outfit, 2) then
player:addOutfitAddon(outfit, 2)
player:removeMoney(cost)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the second ".. outfitName .." addon.")
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You already have the full ".. outfitName .." outfit.")
end

    return true
end
 
Last edited:
This will work, I already tested it.
Let me know if you get any errors or want to make some changes.

Code:
local looktypes = {
    [1] = {male = 128, female = 136, name = 'citizen'},
    [2] = {male = 129, female = 137, name = 'hunter'},
    [3] = {male = 130, female = 138, name = 'mage'},
    [4] = {male = 131, female = 139, name = 'knight'},
    [5] = {male = 133, female = 141, name = 'summoner'},
    [6] = {male = 134, female = 142, name = 'warrior'},
    [7] = {male = 143, female = 147, name = 'barbarian'},
    [8] = {male = 144, female = 148, name = 'druid'},
    [9] = {male = 145, female = 149, name = 'wizard'},
    [10] = {male = 146, female = 150, name = 'oriental'},
    [11] = {male = 151, female = 155, name = 'pirate'},
    [12] = {male = 152, female = 156, name = 'assassin'},
    [13] = {male = 153, female = 157, name = 'beggar'},
    [14] = {male = 154, female = 158, name = 'shaman'},
    [15] = {male = 251, female = 252, name = 'norseman'},
    [16] = {male = 268, female = 269, name = 'nightmare'},
    [17] = {male = 273, female = 270, name = 'jester'},
    [18] = {male = 278, female = 279, name = 'brotherhood'},
    [19] = {male = 289, female = 288, name = 'demonhunter'},
    [20] = {male = 325, female = 324, name = 'yalaharian'},
    [21] = {male = 335, female = 336, name = 'warmaster'},
    [22] = {male = 367, female = 366, name = 'wayfarer'},
    [23] = {male = 430, female = 431, name = 'afflicted'},
    [24] = {male = 463, female = 464, name = 'deepling'},
    [25] = {male = 465, female = 466, name = 'insectoid'},
    [26] = {male = 472, female = 471, name = 'entrepreneur'},
    [27] = {male = 512, female = 513, name = 'crystal warlord'},
    [28] = {male = 516, female = 514, name = 'soil guardian'},
    [29] = {male = 541, female = 542, name = 'demon'},
    [30] = {male = 574, female = 575, name = 'cave explorer'},
    [31] = {male = 577, female = 578, name = 'dream warden'},

}

local cost = 200000

function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)

if player:getMoney() < cost then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 20 cc to use this doll.")
return true
end

local random1 = math.random(31)
outfitName = looktypes[random1].name

if player:getSex() == 1 then
outfit = looktypes[random1].male
else
outfit = looktypes[random1].female
end

if not player:hasOutfit(outfit) then
player:addOutfit(outfit)
player:removeMoney(200000)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the base ".. outfitName .." outfit.")
elseif player:hasOutfit(outfit) and not player:hasOutfit(outfit, 1) then
player:addOutfitAddon(outfit, 1)
player:removeMoney(200000)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the first ".. outfitName .." addon.")
elseif player:hasOutfit(outfit, 1) and not player:hasOutfit(outfit, 2) then
player:addOutfitAddon(outfit, 2)
player:removeMoney(200000)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the second ".. outfitName .." addon.")
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You already have the full ".. outfitName .." outfit.")
end

    return true
end
Just wondering, isn't it better to give the addon for both sexes?
If they were to change gender they wouldn't retain the addons they have obtained the way it is currently scripted, until they swapped back to being male.
 
Where do you put this file? Is it an action script?
Yes.
Here's the script tabbed as well.
Code:
<action itemid="1111111111" script="random_addon_doll.lua"/>
Code:
local looktypes = {
     [1] = {male = 128, female = 136, name = 'citizen'},
     [2] = {male = 129, female = 137, name = 'hunter'},
     [3] = {male = 130, female = 138, name = 'mage'},
     [4] = {male = 131, female = 139, name = 'knight'},
     [5] = {male = 133, female = 141, name = 'summoner'},
     [6] = {male = 134, female = 142, name = 'warrior'},
     [7] = {male = 143, female = 147, name = 'barbarian'},
     [8] = {male = 144, female = 148, name = 'druid'},
     [9] = {male = 145, female = 149, name = 'wizard'},
     [10] = {male = 146, female = 150, name = 'oriental'},
     [11] = {male = 151, female = 155, name = 'pirate'},
     [12] = {male = 152, female = 156, name = 'assassin'},
     [13] = {male = 153, female = 157, name = 'beggar'},
     [14] = {male = 154, female = 158, name = 'shaman'},
     [15] = {male = 251, female = 252, name = 'norseman'},
     [16] = {male = 268, female = 269, name = 'nightmare'},
     [17] = {male = 273, female = 270, name = 'jester'},
     [18] = {male = 278, female = 279, name = 'brotherhood'},
     [19] = {male = 289, female = 288, name = 'demonhunter'},
     [20] = {male = 325, female = 324, name = 'yalaharian'},
     [21] = {male = 335, female = 336, name = 'warmaster'},
     [22] = {male = 367, female = 366, name = 'wayfarer'},
     [23] = {male = 430, female = 431, name = 'afflicted'},
     [24] = {male = 463, female = 464, name = 'deepling'},
     [25] = {male = 465, female = 466, name = 'insectoid'},
     [26] = {male = 472, female = 471, name = 'entrepreneur'},
     [27] = {male = 512, female = 513, name = 'crystal warlord'},
     [28] = {male = 516, female = 514, name = 'soil guardian'},
     [29] = {male = 541, female = 542, name = 'demon'},
     [30] = {male = 574, female = 575, name = 'cave explorer'},
     [31] = {male = 577, female = 578, name = 'dream warden'}
}

local cost = 200000

function onUse(cid, item, fromPosition, itemEx, toPosition)

     local player = Player(cid)
 
     if player:getMoney() < cost then
         player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 20 cc to use this doll.")
         return true
     end

     local random1 = math.random(31)
     outfitName = looktypes[random1].name
   
     if player:getSex() == 1 then
         outfit = looktypes[random1].male
     else
         outfit = looktypes[random1].female
     end
   
     if not player:hasOutfit(outfit) then
         player:addOutfit(outfit)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the base ".. outfitName .." outfit.")
     elseif player:hasOutfit(outfit) and not player:hasOutfit(outfit, 1) then
         player:addOutfitAddon(outfit, 1)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the first ".. outfitName .." addon.")
     elseif player:hasOutfit(outfit, 1) and not player:hasOutfit(outfit, 2) then
         player:addOutfitAddon(outfit, 2)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the second ".. outfitName .." addon.")
     else
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You already have the full ".. outfitName .." outfit.")
     end
   
     return true
end
 
Yes.
Here's the script tabbed as well.
Code:
<action itemid="1111111111" script="random_addon_doll.lua"/>
Code:
local looktypes = {
     [1] = {male = 128, female = 136, name = 'citizen'},
     [2] = {male = 129, female = 137, name = 'hunter'},
     [3] = {male = 130, female = 138, name = 'mage'},
     [4] = {male = 131, female = 139, name = 'knight'},
     [5] = {male = 133, female = 141, name = 'summoner'},
     [6] = {male = 134, female = 142, name = 'warrior'},
     [7] = {male = 143, female = 147, name = 'barbarian'},
     [8] = {male = 144, female = 148, name = 'druid'},
     [9] = {male = 145, female = 149, name = 'wizard'},
     [10] = {male = 146, female = 150, name = 'oriental'},
     [11] = {male = 151, female = 155, name = 'pirate'},
     [12] = {male = 152, female = 156, name = 'assassin'},
     [13] = {male = 153, female = 157, name = 'beggar'},
     [14] = {male = 154, female = 158, name = 'shaman'},
     [15] = {male = 251, female = 252, name = 'norseman'},
     [16] = {male = 268, female = 269, name = 'nightmare'},
     [17] = {male = 273, female = 270, name = 'jester'},
     [18] = {male = 278, female = 279, name = 'brotherhood'},
     [19] = {male = 289, female = 288, name = 'demonhunter'},
     [20] = {male = 325, female = 324, name = 'yalaharian'},
     [21] = {male = 335, female = 336, name = 'warmaster'},
     [22] = {male = 367, female = 366, name = 'wayfarer'},
     [23] = {male = 430, female = 431, name = 'afflicted'},
     [24] = {male = 463, female = 464, name = 'deepling'},
     [25] = {male = 465, female = 466, name = 'insectoid'},
     [26] = {male = 472, female = 471, name = 'entrepreneur'},
     [27] = {male = 512, female = 513, name = 'crystal warlord'},
     [28] = {male = 516, female = 514, name = 'soil guardian'},
     [29] = {male = 541, female = 542, name = 'demon'},
     [30] = {male = 574, female = 575, name = 'cave explorer'},
     [31] = {male = 577, female = 578, name = 'dream warden'}
}

local cost = 200000

function onUse(cid, item, fromPosition, itemEx, toPosition)

     local player = Player(cid)

     if player:getMoney() < cost then
         player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 20 cc to use this doll.")
         return true
     end

     local random1 = math.random(31)
     outfitName = looktypes[random1].name
  
     if player:getSex() == 1 then
         outfit = looktypes[random1].male
     else
         outfit = looktypes[random1].female
     end
  
     if not player:hasOutfit(outfit) then
         player:addOutfit(outfit)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the base ".. outfitName .." outfit.")
     elseif player:hasOutfit(outfit) and not player:hasOutfit(outfit, 1) then
         player:addOutfitAddon(outfit, 1)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the first ".. outfitName .." addon.")
     elseif player:hasOutfit(outfit, 1) and not player:hasOutfit(outfit, 2) then
         player:addOutfitAddon(outfit, 2)
         player:removeMoney(cost)
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have gained the second ".. outfitName .." addon.")
     else
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You already have the full ".. outfitName .." outfit.")
     end
  
     return true
end
No point in using indexes in the table, might as well remove them
 
Back
Top