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

Need simple script

leileililasian

New Member
Joined
Sep 27, 2009
Messages
50
Reaction score
0
To get me started, for some reason i keep messing up the simple scripts. I need a simple script to just remove a pink stone for 60 seconds and then have it reset. Also i need another script as a quest with an npc to give the player experience when they kill a certain number of creatures (example 50 rotworms they get 10,000 experience). Thank you.
 
ohh crap, lol i had it in there then erased it to start over, ill restart

I need a simple lever script that when used it will reset after 60 seconds of being pulled. thank you
 
didnt try but here
Lua:
local t = {
timer = 60,
rockid = XXXX, -- rock id
rockpos = {x= ,y= ,z= }, -- rock position
storage = 60050,
}

local function addRock(cid)
	setGlobalStorageValue(cid, t.storage, -1)
	doCreateItem(t.rockid, 1, t.rockpos)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getGlobalStorageValue(cid, t.storage) < 0 then
		doRemoveItem(t.rockpos, t.rockid, 1)
		setGlobalStorageValue(cid, t.storage, os.time() + t.timer * 1000)
		addEvent(addRock, t.timer * 1000, cid)
	else
		doPlayerSendTextMessage(cid, 19, "The rock has already been removed.")
	end
return true
end
 
Last edited:
so if have this correctly, i would change the position, set the rock id, and put this into action scripts.lua/xml and set the unique id
i jsut havent gotten the hang of what all i have to change in the scripts yet. and where all the scripts go

- - - Updated - - -

i just need to know if i have to put in the unique id at this point >>.uid)<< on line 15, and then use that same unique id in the action.xml. thank you

- - - Updated - - -

This script is not working for me, im not sure what im doing wrong with it.
 
so if have this correctly, i would change the position, set the rock id, and put this into action scripts.lua/xml and set the unique id
i jsut havent gotten the hang of what all i have to change in the scripts yet. and where all the scripts go

- - - Updated - - -

i just need to know if i have to put in the unique id at this point >>.uid)<< on line 15, and then use that same unique id in the action.xml. thank you

yes all you need to change is rockpos and rockid.
in actions.xml
Code:
<action uniqueid="50040" event="script" value="other/SCRIPTNAME.lua"/>
-- change script name
then in your map set the unique id of the lever to 50040
and no dont change the .uid on line 15
 
ok i did what you told me to and only changed those, i put the rock id(item id), coordinates, and used the unique id on the lever in the map editor and in the actions.xml, the lever still is not working. i do not get a message nor does the rock disapear

- - - Updated - - -

now to clarify the rock id is the item id correct? if so then i have all of my information correctly plugged in and the script is not working
 
The script is still not working

- - - Updated - - -

I know im being a pain, but ive looked at 5 other scripts that are somewhat similar but they have a lot of extra scripting that i do not need, and when i try to get rid of it i get errors, but what i did notice was that they always had the lever location in their scripts, and to reset between the 1445 and the 1446 lever.
 
Shouldn't
Code:
rockpos = {x= ,y= ,z= }
be
Code:
rockpos = {x= ,y= ,z= , stackpos=255}
Of course, this is providing the rock is the uppermost object.

Cheers.
 
The script is still not working

- - - Updated - - -

I know im being a pain, but ive looked at 5 other scripts that are somewhat similar but they have a lot of extra scripting that i do not need, and when i try to get rid of it i get errors, but what i did notice was that they always had the lever location in their scripts, and to reset between the 1445 and the 1446 lever.

edited script again, it will work this time lol i was dumb and forgot something

- - - Updated - - -

Shouldn't
Code:
rockpos = {x= ,y= ,z= }
be
Code:
rockpos = {x= ,y= ,z= , stackpos=255}
Of course, this is providing the rock is the uppermost object.

Cheers.

not necessary
 
the script did not work again, what should i put down for the event=script< in the action.xml file, does it matter what i put there cause i have the rest of it just fine i wasnt sure what to put at that part so i just put the name, which seems to happen a lot with those
 
nothing?
should look like this
Code:
<action uniqueid="50040" event="script" value="other/SCRIPTNAME.lua"/>
make sure you place the script in other, name it whatever you want and put the name where it says SCRIPTNAME
then make sure the uniqueid of the lever is 50040
 
<action uniqueid="50040" event="script" value="quest/lever.lua"/> <<< i changed it back to this and it wont even read the script now, so i had to change it back to <action uniqueid="50040" event="lever" value="other/lever.lua"/> for it to not give me a warning could not read error
 
<action uniqueid="50040" event="script" value="quest/lever.lua"/> <<< i changed it back to this and it wont even read the script now, so i had to change it back to <action uniqueid="50040" event="lever" value="other/lever.lua"/> for it to not give me a warning could not read error

you cant use event="lever".. the other way is the proper format. post the error you get when using this one:
Code:
<action uniqueid="50040" event="script" value="quest/lever.lua"/>

I noticed that one of them you are specifiying to other and one to quests... which folder did you place the script it?
post error haha
 
i figured out what was wrong, sorry lol, but i have a new problem, ok the script is somewhat working but its saying ive already removed the stone, but the stone is still there, and the lever will not move, this is how the lever starts out without moving to begin with.
 
Try this code instead. I'm kinda sure stackpos does matter somewhat.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	rockPos = {x = XXX, y = YYY, z = ZZZZ, stackpos=1}
	rockThing = getThingFromPos(rockPos)
	if rockThing.itemid == AAAA then
		doRemoveItem(rockThing.uid)
		doSendMagicEffect(toPosition, 12)
		addEvent(remakeRock, 60000)
	end
	return true
end

function remakeRock()
	rockPos = {x = XXX, y = YYY, z = ZZZZ}
	doCreateItem(AAAA, rockPos)
	return true
end

Of course, AAAA is the itemId of your rock.

Cheers.
 
03:38 You see a stone.
ItemID: [1355].
Position: [X: 1697] [Y: 1219] [Z: 8].
03:40 You see a stone.
ItemID: [1355].
Position: [X: 1697] [Y: 1219] [Z: 8].
03:40 You see a switch.
ItemID: [1945], UniqueID: [50040].
Position: [X: 1719] [Y: 1218] [Z: 8].
these are the coord im using for the stone, and the rock id
 
okay, well the lever wont move unless i make a part in the script to make it move which i can if you want.
Im not sure as to why its not working, this isnt my computer so i cant actually test it
 
Back
Top