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

Action script. (do remove item?)

GhostX

Mapping Board Moderator
Joined
Nov 2, 2011
Messages
6,051
Reaction score
1,817
Location
UK
Twitch
ghostxpr0
Basically the idea is, I'll have a donations room on my server, where the player can go in, click use on an item and it appears in backpack, that player can then use that item for 1 hit and then it disapears!

For example: Item is on a table; AID 1001, player right clicks + use on said item and it appears in bp or in hand (if empty) with action/unique id 1002 (if needed to make it disappear)
They then can use it to attack once, to test it. Item then disappears!

Now the script i need requires the following:
XML:
Item disappears if player uses a teleport with (for example unique/action id 1000)
Can only get item if there no same item with that UID/AID are in bp or on the person (yet can get again once it is gone)
Player must be level 20+

I will be extremely greatful for any attempt at a script whether it be successful or not, and will rep the attempted help if not (but no "ayayaya i get free rep by posting obvious bad code" please)

In the meantime i will attempt this, and post results as an edit.
MY ATTEMPT

XML:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.aid == 1001 and getPlayerLevel(cid) >= 20 then
doPlayerSendTextMessage(cid,21,"Here is your test donation!")
doPlayerAddItem(uid, itemid[8925, count/subtype[1, canDropOnMap = false]])
elseif getPlayerLevel(cid) <= 20 then
doPlayerSendTextMessage(cid,21,"You are not experienced enough!")
else
doPlayerSendCancel(cid,"You don't have the required level to use this.")
end
return true
end
I don't know how to do teleport thing or anything ahaha first script attempt ever :/
 
Last edited:
Don't really understand what you want. The item a person clicks on, it will stay or disappear? And for the item that goes in the bp, what is it supposed to do besided from disappearing. Also why does it have to remove when a person uses a teleport? Maybe you can give an example with items and function so I can understand what I have to make.
 
Ok i thought i made it clear enough :/

What i want: EXAMPLE

Player clicks solar axe with AID1001, the script checks if player is level 20 and if player has this item in bp already.
If player if not level 20 then it wont let him/her have it. And send message your not experienced enough
If has it already - "you already have this item"
It can then be used once only. So the player attacks a training monk, axe then disappears.

If player goes into a teleport with AID 1000, the axe disappears, to stop players taking donated items for free into normal area.

Hope this makes it clearer
 
So you have a place, where people can only go with a teleport. Then click on an axe, get it for free (if they are lvl 20+), use it 1x on a training monk and it disappears. Then if people want to go back in the teleport while having the axe in their backpack, it will disappear.
And when they throw it away (like on the ground) they can take it again because its not in their backpack.

Not sure what if this is what you mean, but can't you better use an unique id? And what is the use of using a weapon only 1x on a training monk.
 
Last edited:
Like i said, it allows players to test donation items before actually donating and see what they hit with them,
all you said is correct and it doesn't matter if player throws on floor since if the axe goes through the teleport it disapears.
it would probably be good that if player logs out, axe disappears also.
 
You could also use an unique id, because if people already know what they hit they don't need to test it again, and this way it also will give a funtion to the lvl 20+ what will be useless if people can trow it on the ground. And for the axe, you could make an identical weapon like an ice rapier for people to test. This way people can't use it as their own weapon, and it wouldn't be this bad to hit players a few times if the weapon isn't extreemly overpowerd. Also this maybe can be a reason for people to donate because then they know how much it hits on players.

I could make the script like you want, but it will take some time, because I probable need to make like 4 different scripts and will take some time to test.
 
Ok but the since skills change, attacks differ, but yh sure

Regarding the ice rapier, surely there is no point since pvp is half than that on monsters and i don't want people taking them to the normal area, since like you said, they can drop and pick up again. Then there will be plenty of people selling donation items in normal area, which are 1 hit only and i wont see an end to the "plx gm was scammed" etc haha

Also i intend to have multiple weapons with this script so ice rapier isn't an option, i'll just edit the script accordingly for each weapon.

and i'll give you as much time as you'll need, i just thank you for your time!

:)
 
Last edited:
You can call it: Test (name of the weapon), so people know its not a real one. If you use an unique id, they only can take it once. And magic is half, weapons depense on eq of people what they hit, so they don't know what they hit on people. Also you can make it not 1 but for example let it hit 5x.
Personaly I think its about the same and an easy solution without spending 15 hours on scripts with the possibility that is still have bugs afterwards.
 
Yh but if i do unique id and they take it, hit with it, decide they don't want it yet, go get 50 skills come back they can't test again...

And 5 hits is fine, just nothing too much..

Also this will be used for wand and a pally wep so the same applies..
Instead of training area i can just do a pvp area with these weapons then. But it is 5 weapons that will be removed from game since only tests, which then limits the amount of weapons. I understand this script will be hard, but i find it would be cleanier as a script. And more efficient too!

I am not necessarily looking for a "quick-fix"..
 
I think I have another easy solution for the teleport, you could also use a NPC that teleports you back, this NPC can check if someone has one of the weapons and refuse to teleport if someone has the weapons.
 
LOL that isn't easy.. An action script for that is easier.. Just If item.id xxxx in inventory, do remove.. something like that. Whereas an npc is like lots of coding since i would need to list 5 items seperately plus all the npc functions necessary..
 
Here you are.

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

      local telPos = {x=1000, y=1000, z=7}
	if(msgcontains(msg, 'travel') or msgcontains(msg, 'back')) then
		selfSay('Do you want to go back?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
            if getPlayerItemCount(cid, 1000) >= 1 or getPlayerItemCount(cid, 2000) >= 1 then
                npcHandler:say("Sorry, you are not allowed to go back with donation weapons.", cid)
		else
		    doTeleportThing(cid, telPos)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('hm.. then stay!', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Tested and works perfect.
 
Thanks man, :) rep'd

Also what are the ids?

Like i mean, is it just 1 id i set all donation items to test with, or do i have to add each?
And which one is the id number? :P 1000?
 
The ids are examples, getPlayerItemCount(cid, 1000) <- Post the id of the donation item there . I did 2 items as example, if you want more just add another or getPlayerItemCount(cid, 1000) >= 1.
>= 1 means: if someone has 1 or more of that item. Don't forget to let then at the end.
 
Back
Top