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

Simple script help

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,018
Solutions
1
Reaction score
1,040
Location
United States
I'm trying to figure out how to remove an onStepIn object.
What I mean by that, if you step on this object, it will be removed.
Since the object could be placed anywhere, I don't exactly know how to determine which object it is.

So, lets use the farting pillow for example:
LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreatureSay(cid, "Faaart!", TALKTYPE_MONSTER)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	return true
end

After I step on that, how do I make it disappear?

It could be something simple that I can't think of at the top of my head, so don't call me noob.
 
I'm trying to figure out how to remove an onStepIn object.
What I mean by that, if you step on this object, it will be removed.
Since the object could be placed anywhere, I don't exactly know how to determine which object it is.

So, lets use the farting pillow for example:
LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreatureSay(cid, "Faaart!", TALKTYPE_MONSTER)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	return true
end

After I step on that, how do I make it disappear?

It could be something simple that I can't think of at the top of my head, so don't call me noob.

LUA:
doRemoveItem(item.uid)

^^
 
Yup, works, now let me test it on an unmovable object.


EDIT: okay, yeah it does not work.
using ID:6299 which is just a crack.
Stepping in it, nothing happens
 
Yup, works, now let me test it on an unmovable object.

It should work on an immovable object. The item object that is passed with the execution of the onStepIn function is basically an object that stores values such as itemid, uid, position(?), etc...

It should be the same with every item object for other functions such as onUse, but I could be wrong ^_^

Edit: but of course you can`t ''stepIn'' to an immovable object :P
 
So, there's no possibility of removing an unmovable (eg; crack)?
How about if it has an actionID?
 
Stepping on it, it's gonna be a trap mine.
When you step on it, it will do an explosion area.
 
Well currently the only way to step onto it in the first place would be to change it from un-walkable to walkable through the otb / dat file, which would require a custom client for all your users.
EDIT: I just realized you`re not using the unwalkable cracks, my bad ^^


I`m not 100% sure how movement works but I`m pretty sure it`s more complicated and `deeper-down` than through Lua checks. :/

Also, what distro are you using?
 
Last edited by a moderator:
No reason why it shouldn't work..
@icy
you cannot change item attributes by source editing. A dat/otb edit is needed.
XML:
<movevent type="StepIn" itemid="6299" event="script" value="file.lua"/>

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreatureSay(cid, "Faaart!", TALKTYPE_MONSTER)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	doRemoveItem(item.uid)
	return true
end
 
@up

Yeah, that's what I have after Icy told me to add the doRemoveItem function.
It does not do anything.
 
Are the items set in map editor? Try to create a item ingame with /i and walk in then. Does it work this way?
 
fail.jpg



Okay, I failed.
I have 2 servers and I edited the wrong movements.xml.

Tested it now, and works like a charm.
 
No reason why it shouldn't work..
@icy
you cannot change item attributes by source editing. A dat/otb edit is needed.
XML:
<movevent type="StepIn" itemid="6299" event="script" value="file.lua"/>

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreatureSay(cid, "Faaart!", TALKTYPE_MONSTER)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	doRemoveItem(item.uid)
	return true
end

Oh derp, my bad ^^
 

Similar threads

Back
Top