Skrypty & Kody Spell ?aduj?cy

Status
Zamknięty.

zeferu

Active User
Zarejestrowany
Dołączył
Sierpień 14, 2009
Posty
77
Liczba reakcji
1
Witam potrzebuje spella kt?ry mia?by nast?puj?ce funkcje.
  • ?aduje mane 10many*lvl gracza ?aduje mane do pe?na i gdy ma sie 100% spell ko?czy si?.
    [*]Nie mozna miec pz gdy sie wpisuje spell i przerywa sie gdy pz b?dzie.
    [*]Gdy spell jest w??czony i ?aduje mane i ponownie sie wypowie jego nazwe to przerywa ?adowanie.
    [*]Nie mo?na si? rusza? gdy spell jest w??czony.
    [*]?adowanie many i hp co 1sec z powtarzalnym magic effectem.
Spell jest jak charge albo power up z ots?w dragon ball
Tibia 8.54
TFS 0.3.6
 
Odp: Spell ?aduj?cy

Witam.
W data/spells/script utw?rz plik o nazwie charge.lua i wklej do niego to:
PHP:
function onCastSpell(cid, var) 
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
local pos = getCreaturePosition(cid)
local effect = CONST_ME_POFF
	if getPlayerStorageValue(cid, CHARGE) == 1 then
		setPlayerStorageValue(cid, CHARGE, 0)
	elseif getPlayerStorageValue(cid, CHARGE) == 0 and
	(fight == false) then
		setPlayerStorageValue(cid, CHARGE, 1)
		doCreatureSetNoMove(cid, true)
	else
		doPlayerSendCancel(cid, "Sorry, you are in fight.")
		doSendMagicEffect(pos, effect)
	end
end
Potem w data/spells/spells.xml dopisz:
PHP:
<instant name="Charge" words="charge" lvl="1" mana="0" prem="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="charge.lua">
	</instant>
Nast?pnie w data/creaturescript/creaturescript.xml dopisz:
PHP:
<event type="think" name="Charge" event="script" value="charge.lua"/>
W data/creaturescript/scripts utw?rz plik o nazwie charge.lua i wklej do niego to:
PHP:
function onThink(cid, interval) 
local effect = X --za X podaj id efektu
local manamax = getPlayerMaxMana(cid)
local mana = getPlayerMana(cid)
local lvl = getPlayerLevel(cid)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
local pos = getCreaturePosition(cid)
	if isPlayer(cid) == true then
		if getPlayerStorageValue(cid, CHARGE) == 1 then
			if(manamax == mana)or(fight == true)then
			setPlayerStorageValue(cid, CHARGE, 0)
			doCreatureSetNoMove(cid, false)
			else
			doPlayerAddMana(cid, 10*lvl, false)
			doSendMagicEffect(pos, effect)
			end
		end
	end
end
Potem w data/creaturescript/scripts/login.lua zadeklaruj event:
PHP:
registerCreatureEvent(cid, "Charge")
I na koniec w data/lib/000-constant.lua utw?rz nowa zmienn? globalna:
PHP:
CHARGE = 20000
Pozdro
 
Odp: Spell ?aduj?cy

Nie dzia?a, ca?y czas gdy nie mam max many i pz nie mam napisane "Sorry, you are in fight"
 
Odp: Spell ?aduj?cy

PHP:
function onCastSpell(cid, var) 
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
local pos = getCreaturePosition(cid)
local effect = CONST_ME_POFF
    if getPlayerStorageValue(cid, CHARGE) == 1 then
        setPlayerStorageValue(cid, CHARGE, 0)
    elseif (fight == true)then
	    doPlayerSendCancel(cid, "Sorry, you are in fight.")
        doSendMagicEffect(pos, effect)
    else
        setPlayerStorageValue(cid, CHARGE, 1)
        doCreatureSetNoMove(cid, true)
    end
end
Teraz powinno dzia?a? :D
 
Odp: Spell ?aduj?cy

A mo?esz jeszcze zrobi? ?e jedno ?adowanie co 1 sec czyli na 10sec ?aduje 10x
 
Odp: Spell ?aduj?cy

Hmm nic innego nie przychodzi mi do g?owy...
Wklej do data/creaturescript/scripts/charge.lua
PHP:
local function ManaCheck(cid)
local manamax = getPlayerMaxMana(cid)
local mana = getPlayerMana(cid)
local lvl = getPlayerLevel(cid)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
	if(manamax == mana)or(fight == true)then
		setPlayerStorageValue(cid, CHARGE, 0)
		doCreatureSetNoMove(cid, false)
	else
		doPlayerAddMana(cid, 10*lvl, false)
		doSendMagicEffect(getCreaturePosition(cid), 6)
	end
end
function onThink(cid, interval) 
	if isPlayer(cid) == true then
		if getPlayerStorageValue(cid, CHARGE) == 1 then
			addEvent(ManaCheck, 800, cid)
		end
	end
Nie wiem czy takie co? Cie zadowoli :p
 
Odp: Spell ?aduj?cy

Nie dzia?a, zrobi?e? ?e op??nia tylko dodawanie many i potem leci jak lecia?o czyli bardzo szybko dodaje man?. A to ma wygl?da? tak
Legenda:
%Da mane
#wait 1sec i sprawdza czy jest pz i mana full i wraca do %
%da mane i znowu idzie do
#wait
 
Odp: Spell ?aduj?cy

PHP:
function onCastSpell(cid, var)  
local storage = 20000
    if getPlayerStorageValue(cid, storage) == 1 then 
        setPlayerStorageValue(cid, storage, 0) 
        return true
    elseif (getCreatureCondition(cid, CONDITION_INFIGHT)  == true) then 
        doPlayerSendCancel(cid, "Sorry, you are in fight.") 
        doSendMagicEffect(getCreaturePosition(cid) , CONST_ME_POFF) 
    else 
        setPlayerStorageValue(cid, storage, 1) 
        doCreatureSetNoMove(cid, true) 
        addEvent(dajmane, 1000, cid)
    end 
    return true
end  

function dajmane(cid)
  if (getPlayerMana(cid) < getPlayerMaxMana(cid)) and (getCreatureCondition(cid, CONDITION_INFIGHT) == false) and (getPlayerStorageValue(cid, storage) == 1) then 
    doPlayerAddMana(cid, getPlayerLevel(cid) * 10)
    addEvent(dajmane, 1000, cid)
  end
  return true
end
Here u are.
 
Odp: Spell ?aduj?cy

Lipton, tylko nie mo?na si? rusza? a many nie daje.
 
Odp: Spell ?aduj?cy

PHP:
function onCastSpell(cid, var) 
local pos = getCreaturePosition(cid)
local effect = CONST_ME_POFF
    if getPlayerStorageValue(cid, CHARGE) == 1 then
        setPlayerStorageValue(cid, CHARGE, 0)
    elseif (getCreatureCondition(cid, CONDITION_INFIGHT) == true)then
        doPlayerSendCancel(cid, "Sorry, you are in fight.")
        doSendMagicEffect(pos, CONST_ME_POFF)
    elseif (getPlayerMana(cid) == getPlayerMaxMana(cid))then
		doPlayerSendCancel(cid, "Sorry, you are full.")
		doSendMagicEffect(pos, CONST_ME_POFF)
	else
        setPlayerStorageValue(cid, CHARGE, 1)
		doCreatureSetNoMove(cid, true)
		addEvent(dajmane, 0, cid)
    end
end   
function dajmane(cid)
local lvl = getPlayerLevel(cid)
local effect = X 
  if (getPlayerMana(cid) < getPlayerMaxMana(cid) and getCreatureCondition(cid, CONDITION_INFIGHT) == false and getPlayerStorageValue(cid, CHARGE) == 1) then 
	doPlayerAddMana(cid, lvl * 10)
	addEvent(dajmane, 1000, cid) 
    doSendMagicEffect(getCreaturePosition(cid), effect) 
	else stopEvent(dajmane, true)
	doCreatureSetNoMove(cid, false)
	setPlayerStorageValue(cid, CHARGE, 0)
  end
end
 
Ostatnia edycja:
Odp: Spell ?aduj?cy

Cortez czy m?g?by? zrobi? co? ?eby po wylogowaniu si? nie wychodzi?y b??dy w konsoli ?
 
Odp: Spell ?aduj?cy

Dodaj warunek 'isPlayer(cid)'. Gdzie? Sam si? domy?l. Wtedy po wylogowaniu, gdy skrypt b?dzie chcia? doda? many, a warunek nie b?dzie spe?niony skrypt nie p?jdzie dalej.
Czego wynikiem b?dzie 0 b??d?w w consoli.
Notka moderatorska:
OT Expert +1
 
Ostatnio edytowane przez moderatora:
Status
Zamknięty.
Back
Do góry