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

Automatically Donation Castle System

Sirion_Mido

Experienced Member
Joined
Jul 22, 2012
Messages
579
Reaction score
43
Location
E-G-Y-P-T
Dear otland , i decided to share my script for Automatically donation castle system
what's the idea?:
a lot of servers' owner put the castle item on shop , and the buyer give it manual to the owner then the owner give the buyer that donation castle manual.

my point is: just the player go to castle door and use castle doll Automatically without any help of owner.

Here We Are ;)
i should give a screenshot to explain more how to set the configuare
sy48c2.jpg


you need to put the uniqueid which is 30001 on the sqm which next to the door same as screenshot.

Steps:

in your data/movements/movements.xml post the following code:
Code:
     <movevent type="StepIn" uniqueid="30001" event="script" value="castle.lua"/>

in your data/movements/scripts create file name: castle.lua and post the following code:
Code:
local items = 8985
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos,v = {x=1,y=1,z=1},getCreaturePosition(cid)
if(getPlayerItemCount(cid, items) > 0) then
doTeleportThing(cid,tpos)
else
doTeleportThing(cid,fromPosition)
                doSendMagicEffect(v,2)
doPlayerSendTextMessage(cid, 25, "You need Castle Doll to enter on this sqm.")
end
return true
end

now in your data/actions/actions.xml post the following code:
Code:
 <action itemid="8985" event="script" value="castle.lua"/>

in your data/actions/scripts create file name: castle.lua and post the following code:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Shortcuts
local item = 8985 -- id of castle doll
local look = "You have to be looking at door of the castle." -- cancel msg of looking to door to buy the castle
local other = "You already rent another house." -- cancel msg of already have other house
local already = "This castle is already owned by someone else " -- cancel msg of castle already owned by someone
local done = "You have successfully bought this donation castle " -- successfully msg for buy the house.
-- Shortcuts
--codes
local house = getHouseFromPos(getCreatureLookPosition(cid))
--codes
if not house then
doPlayerSendCancel(cid, look)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
if not getHouseInfo(house).guildHall then
if getHouseByPlayerGUID(getPlayerGUID(cid)) then
doPlayerSendCancel(cid, other)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
end
if getHouseOwner(house) > 0 then
doPlayerSendCancel(cid, already)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
setHouseOwner(house, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, done)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerRemoveItem(cid, item)
return true
end

Any errors i will be glad to help you.
Tested on distro 0.4 rev 3884.

Rep++ If It Helpful For You.
 
Last edited:
Aprroved

Aprroved , this really what i was search for it , thanks Sirion_Mido:rolleyes:
 
This is good, but it exist better scripts.
The player should use any item to recive the castle, and when they use it they got the next one who is empty.

I will post this in a few minutes.
 
@_CorneX_
that will be great :)

just i can't find some functions to do that ;)

will be good if you post this ;)
 
Why is there gps lying on the floor next to the doors? :p
 
:/.. the player who owns the castle can give the document to other guy after he used it, and if he doesn't have it wiht him he cant enter the castler, by the way the player cant invite friends becouse nobody can pass the SQM
 
Last edited:
its works prefectly but you should edit it to auto buy house

its now only acces the sqm.
 
Last edited:
[06/10/2013 18:01:35] Lua Script Error: [Action Interface]
[06/10/2013 18:01:35] data/actions/scripts/other/castle.lua:eek:nUse
[06/10/2013 18:01:35] data/actions/scripts/other/castle.lua:10: attempt to call global 'getHouseFromPos' (a nil value)
[06/10/2013 18:01:35] stack traceback:
[06/10/2013 18:01:35] [C]: in function 'getHouseFromPos'
[06/10/2013 18:01:35] data/actions/scripts/other/castle.lua:10: in function <data/actions/scripts/other/castle.lua:1>
 
can i please get some help with this......
what can be replaced with gethousefrompos
 
I use TFS 0.3.6, this is an amazing script except the downfall of..

Problem:
Item doesn't get removed.
You can buy another person's castle.
If item get's removed it doesn't give you any storage so obviously you won't be able to walk on the sqm again.

Would be amazing if this script would to get fixed up!
~Sin
 
I use TFS 0.3.6, this is an amazing script except the downfall of..

Problem:
Item doesn't get removed.
You can buy another person's castle.
If item get's removed it doesn't give you any storage so obviously you won't be able to walk on the sqm again.

Would be amazing if this script would to get fixed up!
~Sin


Change last line

doPlayerRemoveItem(cid, item)

doplayerRemoveItem(cid, ID of item,1)
 
Change last line

doPlayerRemoveItem(cid, item)

doplayerRemoveItem(cid, ID of item,1)

Didn't try it but it looks like it would work. That being said I wouldn't use it due to the other problems such as having the ability to buy someone else's castle. I don't doubt their is a solution to that but it's to advanced for me and I'd guess take to long lol

Thanks though,
~Sin
 
@Ray Rewind that would be extremely cool of you; at the moment if someone has a castle and another has a key to buy a castle they could just buy that already owned castle so if you could make a storage out of it that would be amazing!

Thank you in advance
~Sin
 
I'd guess for the fact it's not a "buy house command" it's a walk on uniid and right click item it automatically transfers house over; the only thing I could think of is to make the uniid change or tile change after it has been used by item (for me the item is a key to buy the castle)

Not to sure how I go about doing that though
~Sin
 
Hey, im having a problem with removing the item from player, @Sirion_Mido

TFS 0.3.6

Description
luaDoPlayerRemoveItem> player not found.

solved, only problem now is that i can't enter the sqm outside the door cuz it says i need a box
 
Last edited:
Back
Top