• 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 help in some scripts!!!! PLX HELP!

Luciano

Member
Joined
Feb 18, 2010
Messages
998
Reaction score
24
Mana Ring i have add 25% more mana)
but health ring dont work ;/ why?
i put on equip and deequip, look items.xml
[.lua][./lua]<item id="2123" article="a" name="Health Ring">
<attribute key="weight" value="40"/>
<attribute key="description" value="This ring add you 25% more life!!"/>
<attribute key="maxHealthPointsPercent" value="125"/>
<attribute key="slotType" value="ring"/>
[./lua]

------
I need some other scripts too ;)

i have mana boster (add 150k mana only 1 time use and need 30k lv)
dont work... dont ADD the mana... (like ... player lv 30k, have x mana, after use he should have x+ 150k mana but he dont get the 150k mana lol)

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) < 30000 then
doCreatureSay(cid, "Only players with level 30k can use it.", TALKTYPE_ORANGE_1)
return true
end
if getPlayerStorageValue(cid,99112) == 2 then
doPlayerSendCancel(cid, "You can use this item once.")
return true
end
setCreatureMaxMana(cid,(getCreatureMaxMana(cid))+150000)
setPlayerStorageValue(cid,99112,2)

doCreatureSay(cid, "You have gained 150k mana!!", TALKTYPE_ORANGE_1)
return true
end

<action itemid="7440" event="script" value="manabooster.lua"/>

and health...
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) < 30000 then
doCreatureSay(cid, "Only players with level 30k can use it.", TALKTYPE_ORANGE_1)
return true
end
if getPlayerStorageValue(cid,99114) == 2 then
doPlayerSendCancel(cid, "You can use this item once.")
return true
end
setCreatureMaxHealth(cid,(getCreatureMaxHealth(cid))+150000)
setPlayerStorageValue(cid,99114,2)

doCreatureSay(cid, "You have gained 150k health!!", TALKTYPE_ORANGE_1)
return true
end


----------------------
ok,
now the requests:

a broadcast thing.

Exemple:
Some scroll, the player use he get 8 broadcasts.
What?
He say !broadcast Text here.
He can only !broadcast if he have "charges" of broadcast.
If no have any, then just dont do !broadcast (lol?)
Btw: When use !broadcast, say whow many broadcasts left, example
the player got 8 bc now.
he use !broadcast Hi im a player \o/
Now you have 7 broadcasts lefts.

------
item "transform"
use on X item transform to Y
(like rich armor to upgraded rich armor (diferent ID's)

------

forever aol > what is it > id 2196 > works like a normal aol, infinite.... but IF THE PLAYER HAVE RED SKULL AND DIE, he dont lost anything.... also dont lost the aol too :P - aol its infinite now, but rs still lose itens ;/

------
exp potion > increase the exp rate by 2x of player - one time per day and it have duration = 1 hour

Lotery Bird > golden falcon. 9003 > Its like a lotery, when u use it u can win ONE item.
example (noob items)
using u can win:
k armor
g armor
mpa
k legs
g legs
... but like : u have 50 chance drop k armor, 40 g armor, 10 mpa....

I think its all for now :P


Thanks, and yeah,
im kind noob, im entering world of script, but it is fuc**** hard lol
 
Last edited:
code tag it please man [.lua][./lua]
Code:
<item id="2123" article="a" name="Health Ring">
     <attribute key="weight" value="40"/>
     <attribute key="description" value="This ring add you 25% more life!!"/>
     <attribute key="maxHealthPointsPercent" value="125"/>
     <attribute key="slotType" value="ring"/>
</item>
try ^
EDIT: without the dots [.lua][./lua]
 
Last edited:
for the health one try this:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) < 30000 and getPlayerStorageValue(cid, 53114) == -1 then
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + 150000)
			setPlayerStorageValue(cid, 53114, 1)
			doCreatureSay(cid, "You have gained 150k health!", TALKTYPE_ORANGE_1)
	else
			doPlayerSendCancel(cid, "You either not higher than level 30000 or you already used this item once.")
	end
return true
end
 
It didnt work ;/
EDIT:
I made a lv 30k char, and it say "You either not higher than level 30000 or you already used this item once."
lol.
 
works but no add the health and mana rofl. - It look like it HEAL life or mana, dont ADD

hey do you have a script like !myinfo - give the player whow much mana and health he have
 
Made this one to make it easy for you to add more items if you want to.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local ITEMS = {
                [HEALTH_ITEM_ID_HERE] = {LEVEL_REQ = 30000, STORAGE = 51511, HEALTH = getCreatureMaxHealth(cid)+150000, MANA = getCreatureMaxMana(cid)},
                [MANA_ITEM_ID_HERE] = {LEVEL_REQ = 30000, STORAGE = 51512, HEALTH = getCreatureMaxHealth(cid), MANA = getCreatureMaxMana(cid)+150000}
                }
        if getPlayerLevel(cid) >= ITEMS[item.itemid].LEVEL_REQ then
                if getPlayerStorageValue(cid, ITEMS[item.itemid].STORAGE) <= 0 then
                        setCreatureMaxHealth(cid, ITEMS[item.itemid].HEALTH)
                        setCreatureMaxMana(cid, ITEMS[item.itemid].MANA)
                        setPlayerStorageValue(cid, ITEMS[item.itemid].STORAGE, 1)
                        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
                else
                        doPlayerSendCancel(cid, "You have already used this item.")
                end
        else
                doPlayerSendCancel(cid, "You have to be level " .. ITEMS[item.itemid].LEVEL_REQ .. " or above to use this item.")
        end
return true
end

Not tested.
 
Damit! i change the storage and ONE player use, THEN other player cant, i have to change it a looot << - to sexydevil post :) ]ill test up script
 
For Sypher post - [14/03/2010 17:20:20] data/actions/scripts/mana booster.lua:4: '}' expected near 'REQ'
[14/03/2010 17:20:20] Reloaded actions.

(i put that script in mana booster .... but i should put that in actions or what?)
 
[14/03/2010 17:24:06] data/actions/scripts/mana booster.lua:4: '}' expected near 'REQ'
[14/03/2010 17:24:07] Reloaded actions.

still... i saw something "strange"
[7443] = {LEVEL_REQ = 30000, STORAGE = 51511, HEALTH = getCreatureMaxHealth(cid)+150000, MANA = getCreatureMaxMana(cid)},
[7439] = {LEVEL_REQ = 30000, STORAGE = 51512, HEALTH = getCreatureMaxHealth(cid), MANA = getCreatureMaxMana(cid)+150000}

idk, i dont understand a lot of these complicated scripts. lol
 
I can't see anything wrong but it might be the "_", so try this.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local ITEMS = {
                [HEALTH_ITEM_ID_HERE] = {LEVEL = 30000, STORAGE = 51511, HEALTH = getCreatureMaxHealth(cid)+150000, MANA = getCreatureMaxMana(cid)},
                [MANA_ITEM_ID_HERE] = {LEVEL = 30000, STORAGE = 51512, HEALTH = getCreatureMaxHealth(cid), MANA = getCreatureMaxMana(cid)+150000}
                }
        if getPlayerLevel(cid) >= ITEMS[item.itemid].LEVEL then
                if getPlayerStorageValue(cid, ITEMS[item.itemid].STORAGE) <= 0 then
                        setCreatureMaxHealth(cid, ITEMS[item.itemid].HEALTH)
                        setCreatureMaxMana(cid, ITEMS[item.itemid].MANA)
                        setPlayerStorageValue(cid, ITEMS[item.itemid].STORAGE, 1)
                        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
                else
                        doPlayerSendCancel(cid, "You have already used this item.")
                end
        else
                doPlayerSendCancel(cid, "You have to be level " .. ITEMS[item.itemid].LEVEL_REQ .. " or above to use this item.")
        end
return true
end

I'm way too tired to try to fix it again if you get more errors, sorry ^^

Also in actions.xml, something like this:
PHP:
<action itemid="10138;10140" event="script" value="items.lua"/>
 
Code:
<action itemid="10138-10140" event="script" value="items.lua"/>

try this
LUA:
function onUse(cid, item, fromPosition, item2, toPosition)
local t = {
	[10138] = {lvl = 30000, storage = 51511, health = 150000},
	[10140] = {lvl = 30000, storage = 51511, mana = 150000}
}
	local item = t[item.itemid]
	if item and getPlayerLevel(cid) >= t.lvl and getPlayerStorageValue(cid, t.storage) == -1 then
			doCreatureAddHealth(cid, t.health)
			doCreatureAddMana(cid, t.mana)
			doCreatureSay(cid, "You gained 150k health or mana", TALKTYPE_ORANGE_1)
	else
			doPlayerSendCancel(cid, "You either don\'t have enough levels or you cannot use this item more than once")
	end
return true
end
 
[14/03/2010 21:45:35] [Error - Action Interface]
[14/03/2010 21:45:35] data/actions/scripts/items.lua:onUse
[14/03/2010 21:45:35] Description:
[14/03/2010 21:45:35] data/actions/scripts/items.lua:7: attempt to compare nil with number
[14/03/2010 21:45:35] stack traceback:
[14/03/2010 21:45:35] data/actions/scripts/items.lua:7: in function <data/actions/scripts/items.lua:1>
 
Back
Top