How would you make it so when a trigger activates it has a random number of things it could send and it randomly chooses which of those to send
like for send i would need it to send one of these randomly
craft iron helm
craft iron sword
craft iron chestplate
ect
Assuming you are using Lua scripting, you can "send to script", choosing an item from a list like this:
<triggers>
<trigger
enabled="y"
match="something"
send_to="12"
sequence="100"
>
<send>
items = {
"helm",
"sword",
"breastplate",
}
local which_item = items [ math.random (1, #items) ]
Send ("craft iron " .. which_item)
</send>
</trigger>
</triggers>
Ok this is what i get i have lua enabled. I check send to script.
ERROR:
[string "Trigger: "]:2: unexpected symbol near '<'
Heres my trigger
Trigger: You finish smithing a iron *
Send:
<triggers>
<trigger
enabled="y"
match="You finish smithing a iron *."
send_to="12"
sequence="100"
>
<send>
items = {
"Full plate",
"leggings",
"greaves",
"Crown",
}
local which_item = items [ math.random (1, #items) ]
Send ("smith iron " .. which_item)
</send>
</trigger>
</triggers>
Ok i want to spice this up a lil more and thanks for the help :P. Ok ive also added random materials to it to but what i need for it to do.. if i go to make an item with a type of material i dont have i need it to buy the material. Can i do this in the same trigger? Can you have more the one trigger in a trigger? im new to scripting..
the failed message is
You're not carrying right materials to make that.
<triggers>
<trigger
enabled="y"
match="You finish smithing a *."
send_to="12"
sequence="100"
>
<send>
materials = {
"iron",
"steel",
"copper",
}
items = {
"Full plate",
"leggings",
"greaves",
"Crown",
}
Local which_material = materials [math.random (1, #materials) ]
local which_item = items [ math.random (1, #items) ]
Send ("smith " ..which_material which_item)
</send>
</trigger>
</triggers>
Also this seems to interfere with some triggers i set up for when i finished creating the item it would sell.
I just made several differnt triggers for this
Trigger: You finish smithing iron hammer
send: sell hammer
Trigger: You finish smithing iron helm
Send: sell helm
Well you could check "keep evaluating" on the triggers, so that more than one fires. Or maybe you could have one trigger, once you make something you sell it (whatever it is) and then make something else.