ZionOt
New Member
- Joined
- Aug 8, 2010
- Messages
- 178
- Reaction score
- 1
Well i just started scripting, This is my first script i made. Thanks to Evil Hero's Scripting Guild, i understood it pretty well.
As he said, "Now you know the Basics of Scripting. Now you should be able to build a proper structure and explain what it does." Enjoy!
This script is to make it so when you use whatever the item is, it will say some sort of message. Yes, this can be modified to any item , as long as its not used already... then you will have to play around with it . Anyways back to the script!
Tested with TFS 8.60
First what you need to do is open up your data/actions/actions.xml
Make a new line and add this:
Now that you have that added, make sure you have the item you want to use, and the ID of that item. Add the ID were the first 3 "XXX" are. Keep this file open but save it. Now we will make the script!
Open your actions/actions, and copy one of the files already made and rename it. Once you have renamed it, go back to your actions.xml and replace the last three "XXX" with the name that you named your script.
Now Open your script and copy this:
Now, with the first "XXX" put the item ID there. Then Insert whatever you want the item to say when you use it. Save it.
MAKE SURE THIS ITEM DOES NOT ALREADY HAVE A ACTION TEXT WHEN USE OR YOU WILL DEBUG!
Thats it your done! Now you should Reload or Restart your OT and use the item. It should work , If you need any help i will try my best to help you solve the problem.
As he said, "Now you know the Basics of Scripting. Now you should be able to build a proper structure and explain what it does." Enjoy!
This script is to make it so when you use whatever the item is, it will say some sort of message. Yes, this can be modified to any item , as long as its not used already... then you will have to play around with it . Anyways back to the script!
Tested with TFS 8.60
First what you need to do is open up your data/actions/actions.xml
Make a new line and add this:
Code:
<action itemid="XXX" event="script" value="XXX.lua"/>
Now that you have that added, make sure you have the item you want to use, and the ID of that item. Add the ID were the first 3 "XXX" are. Keep this file open but save it. Now we will make the script!
Open your actions/actions, and copy one of the files already made and rename it. Once you have renamed it, go back to your actions.xml and replace the last three "XXX" with the name that you named your script.
Now Open your script and copy this:
Code:
--[[
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message from the Item by ZionOt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == XXX then --Id of the item
doPlayerSendTextMessage(cid, 21, "XXX") --Items Message
end
return TRUE
end
Now, with the first "XXX" put the item ID there. Then Insert whatever you want the item to say when you use it. Save it.
MAKE SURE THIS ITEM DOES NOT ALREADY HAVE A ACTION TEXT WHEN USE OR YOU WILL DEBUG!
Thats it your done! Now you should Reload or Restart your OT and use the item. It should work , If you need any help i will try my best to help you solve the problem.
Last edited: