• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Script MR, serio żaden nie działa -.-

Reins

Member
Joined
Apr 9, 2009
Messages
586
Reaction score
8
Pisanie scriptu na mr na pewno zajęło by mi kupę czasu, a na pewno także i kupę błędów, więc pomyślałem że poszukam go w sieci. Każdy script z sieci mi nie działa bo piszę :

Code:
ta rune mozesz uzywac tylko na graczach.

albo

Code:
You can use this rune only on players

Przykładowy scrypt

PHP:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --

local mana_add = math.random(mana_minimum, mana_maximum)

-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"Mana UUPP!!!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"GoGo Mana!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "Ta rune mozesz uzywac tylko na graczach.")
end
end
end

return 1
end

Piszę ,że tą runę można używać tylko na graczach, a na nich nie można jej używać -.- bezsens...
Proszę o pomoc silnik 0.3.4 TFS

Pozdrawiam
 
@kripic:
"Według aktualnie obowiązujących zasad języka polskiego forma "pisze" jest równie poprawna jak "jest napisane"."
 
łap manarunę w actions, która daje losową ilość many (ustawiasz min. i max. w skrypcie)

LUA:
local removed = false    -- czy się kończy

function onUse(cid, item)
    -- DON'T TOUCH THIS -------------------
    local min = 1600     -- ile minimalnie ma dodać many
    local max = 2300     -- ile maksymalnie ma dodać many
    local lv = getPlayerLevel(cid)
    -- OR VERY VERY DED -------------------
	
	if lv >= 1 then
		pct = math.random(min, max)
	end
	
	doCreatureAddMana(cid,pct)
	doCreatureSay(cid, "Manarune!", 19)
	if(removed == true) then
		if item.type > 1 then 
			doChangeTypeItem(item.uid, item.type - 1) 
		else 
			doRemoveItem(item.uid, 1) 
		end 
	end
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICETORNADO)

	return true
end
 
Shelock dzięki, ale znalazłem już ciekawy script że many daje zależnie od levela, ale runa się nie kończy, jak zrobić aby się kończyła?

PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local pos = getPlayerPosition(cid)
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 12.33) + (mlevel * 4) - 50
local mana_maximum = (level * 13.5) + (mlevel * 5) 
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
doPlayerAddMana(cid, mana_add)
doSendAnimatedText(pos, mana_add, TEXTCOLOR_PURPLE)
return doCombat(cid, combat, var)
end

I to się robi w spells bo manarunka to runka i runki dodaję się w spells a nie w actions -.- Chiba xd tak się doczytałem ...

może to w tym?

Code:
<rune name="Mana Rune" id="2270" allowfaruse="1" charges="2" lvl="15" maglv="0" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="custom/mr.lua"/>

ps : nie czepiać się tak słownictwa :D
 
Trzeba chyba dodać doRemoveItem(item.uid, 1)

Trzymaj, już dodałem.
LUA:
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local pos = getPlayerPosition(cid)
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 12.33) + (mlevel * 4) - 50
local mana_maximum = (level * 13.5) + (mlevel * 5) 
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
doPlayerAddMana(cid, mana_add)
doSendAnimatedText(pos, mana_add, TEXTCOLOR_PURPLE)
doRemoveItem(item.uid, 1)
return doCombat(cid, combat, var)
end
 
Nadal się nie kasują ;/
i gdy użyję mr to wyskakuje w konsoli

Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/custom/mr.lua:onCastSpell

data/spells/scripts/custom/mr.lua:16: attempt to index global 'item' (a nil valu
e)
stack traceback:
        data/spells/scripts/custom/mr.lua:16: in function <data/spells/scripts/c
ustom/mr.lua:4>
 
Nadal się nie kasują ;/
i gdy użyję mr to wyskakuje w konsoli

Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/custom/mr.lua:onCastSpell

data/spells/scripts/custom/mr.lua:16: attempt to index global 'item' (a nil valu
e)
stack traceback:
        data/spells/scripts/custom/mr.lua:16: in function <data/spells/scripts/c
ustom/mr.lua:4>

i co sie dziwisz? sherlok nie wie ze uzywanie runek nie przekazuje obiektu item
 
Więc to co dodał to usunąć?

I czymś zastąpić aby te runki się usuwały?
 
Nadal tak samo.

W consoli pokazuję się

Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/custom/mr.lua:onCastSpell

luaDoCombat(). Combat not found

Lua Script Error: [Spell Interface]
data/spells/scripts/custom/mr.lua:onCastSpell

luaDoCombat(). Combat not found

Nawet jak mam BP MR to mi się pokazuję using one of 0 manarune. ale many dodaje .

PS: spróbuję zaraz podmienić z np sd i tylko nazwy pozmieniam. Zobaczę czy dalej nie będzie usuwać.



To samo, nie kończy się i błędy w consoli są... Jednak coś w scrypcie trzeba kombinować -.-


EDIT: DODAŁEM PRZED SCRYPTEM

Code:
local combat = createCombatObject()

I JUZ NIE WYSKAKUJĄ BŁĘDY W CONSOLI, ALE RUNKI DALEJ SIĘ NIE KOŃCZĄ :(
 
Last edited:
Shakaal o to własnie chodziło :)

Dzięki rep +

@ave

Zamuliłem się i pisałem to w spells.xml a nie w items :D Też rep leci :)
 
Back
Top