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

Step on X item X actionID remove X Soul

Lifer420

Advanced OT User
Joined
Jul 27, 2009
Messages
1,490
Reaction score
196
Pretty cut and dry. Can anyone point me to a script I can edit, or help me with this?

What i'm asking-

I'd like a script that when you step on ANY item with actionID XXXX - it teleports you to X-Y-Z (it can just be a portal, with actionID, thats fine too) and removes X soul points. Can anyone help?
 
Code:
function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) and getPlayerSoul(cid) >= x then
        doTeleportThing(cid, {x=875,y=580,z=7}, true)
        doPlayerAddSoul(cid, -y)
    end
return true
end
 
Code:
function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) and getPlayerSoul(cid) >= x then
        doTeleportThing(cid, {x=875,y=580,z=7}, true)
        doPlayerAddSoul(cid, -y)
    end
return true
end

Hmm, how do I make it to where it will do this script though, if you step on item with X action ID?
 
Hmm, how do I make it to where it will do this script though, if you step on item with X action ID?
Read the script and you will understand it :S
>= x << write how many souls to stepin this place for example 10 to access this area so you need 10+ souls to TP
{x=875,y=580,z=7} << Teleport position
doPlayerAddSoul(cid, -y) << Write 10 souls to remove them from the player
 
Read the script and you will understand it :S

Code:
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) and getPlayerSoul(cid) >= x then
doTeleportThing(cid, {x=875,y=580,z=7}, true)
doPlayerAddSoul(cid, -y)
end
return true
end
I did read it, and it looks like it's saying that, if you stepOn whatever (there's nothing there, thats what im asking.. just says stepIn" if has X soul, teleport to XYZ, take soul. Thats what that script is doing. So, I do understand it, but what is the "stepIn" for? There's no ID for a portal or anything thats what I need to know

Do I make it - function onStepIn(cid, ITEM ID HERE?, position, fromPosition)
 
It worries me I have to tell you this, but when you add a script to movements, you incorporate the actionid on there. For example:
Code:
    <movevent type="StepIn" actionid="9999" event="script" value="soul"/>
 
It worries me I have to tell you this, but when you add a script to movements, you incorporate the actionid on there. For example:
Code:
    <movevent type="StepIn" actionid="9999" event="script" value="soul"/>

Thank you, I don't script alot thats obviously why im asking though xD I usually just edit scripts so there's no need for me to do that, but thanks alot.
 
@edit : Changed it up, fixed it!

Edit2 : now when you're under 50 soul, it wont do the teleport action, it'll just let you go back into the portal still, any idea?

Code:
function onStepIn(cid, item)
if isPlayer(cid) and getPlayerSoul(cid) < = 50 then
doTeleportThing(cid, {x=32369, y=32241, z=7}, true)
doPlayerAddSoul(cid, -50)
end
return true
end
 
Last edited:
@edit : Changed it up, fixed it!

Edit2 : now when you're under 50 soul, it wont do the teleport action, it'll just let you go back into the portal still, any idea?

Not sure what you meant but:

Edit: Shouldn't it be >= 50?

Code:
function onStepIn(cid, item, topos, frompos)
    if isPlayer(cid) and getPlayerSoul(cid) >= 50 then
        doTeleportThing(cid, {x=32369, y=32241, z=7}, true)
        doPlayerAddSoul(cid, -50)
    else
        doTeleportThing(cid, frompos)
    end
    return true
end
 
Last edited:
Not sure what you meant but:

Edit: Shouldn't it be >= 50?

Code:
function onStepIn(cid, item, topos, frompos)
    if isPlayer(cid) and getPlayerSoul(cid) >= 50 then
        doTeleportThing(cid, {x=32369, y=32241, z=7}, true)
        doPlayerAddSoul(cid, -50)
    else
        doTeleportThing(cid, frompos)
    end
    return true
end

I'll try this, I was messing with the code when I put that, and I forgot to change it back before I copied xD

Edit : Still just lets you walk into the portal instead of teleporting you away and not letting you walk in if you're under 50
 
I'm going to experiment with it, and try it on a certain tile with the uniqueID now instead of teleporter, maybe thatll fix it
 
Seeing it this way, I think you guys misread what I asked for :X What this does now, on a tile with uniqueID, if I have 50 soul it will tp me to that XYZ thats in the code, and if I dont, itll just push me off it. What I wanted, was to only let you walk over uniqueID if you have MORE than 50 soul, and remove 50 soul, if you don't have 50 soul, just not let you walk on it

edit : just took out the tp thing in this one, so it works now, ill have to juse use it like this. Thanks for the help though, credit to you fellows.

@owned @ond
 
@Lifer420
I'm no expert with lua, but it really isn't much different from any other language.
I belive ond's script is exactly what you want.
Code:
function onStepIn(cid, item, topos, frompos)
    if isPlayer(cid) and getPlayerSoul(cid) >= 50 then    ----This is checking if player is in the spot and if the player's soul is 50 or more.
        doTeleportThing(cid, {x=32369, y=32241, z=7}, true)  ---if the condition is met then this will teleport the player to the x,y,z destination.
        doPlayerAddSoul(cid, -50)  --and will add -50 soul points to the player's soul points, or in other words; it will remove 50 soul points.
         ----Now, this is where I think you might have a problem, but since I'm no expert I'm not entirely sure, shouldnt you have an end here? meaning that the "true" block is just those two statements and not the entire script? Who knows though.
    else
        doTeleportThing(cid, frompos)
    end
    return true
end
 
@Lifer420
I'm no expert with lua, but it really isn't much different from any other language.
I belive ond's script is exactly what you want.
Code:
function onStepIn(cid, item, topos, frompos)
    if isPlayer(cid) and getPlayerSoul(cid) >= 50 then    ----This is checking if player is in the spot and if the player's soul is 50 or more.
        doTeleportThing(cid, {x=32369, y=32241, z=7}, true)  ---if the condition is met then this will teleport the player to the x,y,z destination.
        doPlayerAddSoul(cid, -50)  --and will add -50 soul points to the player's soul points, or in other words; it will remove 50 soul points.
         ----Now, this is where I think you might have a problem, but since I'm no expert I'm not entirely sure, shouldnt you have an end here? meaning that the "true" block is just those two statements and not the entire script? Who knows though.
    else
        doTeleportThing(cid, frompos)
    end
    return true
end
You wouldn't have an end there simply because the if statement isn't finished. It is continued with the "else" meaning if not isPlayer or getPlayerSoul not greater than or equal to 50 then teleport back.
 
See, I confused them with what I was asking for. The reason I wanted it to teleport you to XYZ was simply to take you to a spawn, but I figured i'd use a portal with a uniqueID instead so it can all work via 1 script. The way i'm using it now, is if you step over tile with XXXX uID, you lose 50 soul, and if you dont have enough it will just push you off of it. That works fine for what i'm using it for - so all is well :) Thanks though, everyone. I follow your NightShine project @owned and as you know, i'm interested in it. Your work is phenomenal and i'm looking forward to testing it when you're done. (I know there's no set date or anything, i'm not one of those guys that will bug you and ask when when when, why why) So keep up the good work, everyone :)
 
I use a unique system for my OT, because I hate teleport servers, but people like some teles on RL map. So, I made an island with houses/shops and a tp room thing, with 16 spawns (mostly, the main ones per creature) and I made it to where you need to use 50 soul to go to each spawn. I also made an "ancient rune" refill full soul and will be making an NPC sell them for X gold, or the donate shop for cheap, since idrc about money - I just didnt make donor items op like most :p But I think it's a nice use of soul/teles together, so, I thank you for helping me guys
 
See, I confused them with what I was asking for. The reason I wanted it to teleport you to XYZ was simply to take you to a spawn, but I figured i'd use a portal with a uniqueID instead so it can all work via 1 script. The way i'm using it now, is if you step over tile with XXXX uID, you lose 50 soul, and if you dont have enough it will just push you off of it. That works fine for what i'm using it for - so all is well :) Thanks though, everyone. I follow your NightShine project @owned and as you know, i'm interested in it. Your work is phenomenal and i'm looking forward to testing it when you're done. (I know there's no set date or anything, i'm not one of those guys that will bug you and ask when when when, why why) So keep up the good work, everyone :)
Thanks, much appreciated. I've made some amazing additions that maybe you'll enjoy a bit more as well.

I see thanks. :)
Not a problem.
 
Back
Top Bottom