Skrypty & Kody Transform - Pomocy :<

Status
Zamknięty.

Tasq

User
Zarejestrowany
Dołączył
Grudzień 23, 2010
Posty
45
Liczba reakcji
1
[8.54]
Witam, mam skrypt na transform w spells wszystko ?adnie git. Dodaje HP i MP.
Ale jest problem gdy na transie sie wyloguje zostaje HP i MP chodzi o to ze mozna bugowac.
O to moje starania w creaturescript.
Plik creaturescript>scripts>onLogout.lua

Kod:
local first = -500
local second = -1300
local third = -2300


function onLogout(cid)
   if getPlayerStorageVaule(cid, 1001) == 2
   doCreatureAddHealth(cid, first)
   doCreatureAddMana(cid, first)
   end
     if getPlayerStorageVaule(cid, 1001) == 3
   doCreatureAddHealth(cid, second)
   doCreatureAddMana(cid, second)
   end
    if getPlayerStorageVaule(cid, 1001) == 4
   doCreatureAddHealth(cid, third)
   doCreatureAddMana(cid, third)
   end
   
   
  end
    return true
  end

W Login.Lua doda?em linijk?:
Kod:
registerCreatureEvent(cid, "Wyloguj")

W creaturescript.xml:
Kod:
  <event type="logout" name="wyloguj" event="script" value="onLogout.lua"/>


I Nie dzia?a. Jestem s?aby w tych rzeczach. Prosze o pomoc.
 
Odp: Transform - Pomocy :<

Wrzu? cz??? kodu z transform odpowiedzialn? za zwi?kszanie HP/MP.
 
Odp: Transform - Pomocy :<

Tutaj z Lib prosze.
Kod:
function doTransform(cid, newvoc, newout, needlvl, bonus)
local out = {lookType=newout}
local bonusmp = (getCreatureMaxHealth(cid)+bonus)
local bonushp = (getPlayerMaxMana(cid)+bonus)
        if getPlayerLevel(cid) >= needlvl then
            setCreatureMaxHealth(cid, bonushp)
            setCreatureMaxMana(cid, bonusmp)
            doPlayerSetVocation(cid, newvoc)        
            doSetCreatureOutfit(cid, out, -1) 
end
end 
function doOutLogin(cid, out)
 local out3 = {lookType=out}
            doSetCreatureOutfit(cid, out3, -1)
end

A tu czesc z spells:
Kod:
function onCastSpell(cid, var)
if getPlayerVocation(cid) == 0 then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "Sorry, You can not henkan.")
end
if getPlayerVocation(cid) == 1 and 
getPlayerLevel(cid) < 30 then
        doPlayerSendCancel(cid, "Sorry, You need 30 level to henkan.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
if  getPlayerVocation(cid) == 1 then
            doTransform(cid, 11, 6, 30, 500)
			 setPlayerStorageValue(cid,1001,2)

end

if getPlayerVocation(cid) == 11 and 
getPlayerLevel(cid) < 80 then
        doPlayerSendCancel(cid, "Sorry, You need 80 level to henkan.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
if  getPlayerVocation(cid) == 11 then
            doTransform(cid, 12, 5, 80, 800)
						 setPlayerStorageValue(cid,1001,3)
end
if getPlayerVocation(cid) == 12 and 
getPlayerLevel(cid) < 150 then
        doPlayerSendCancel(cid, "Sorry, You need 150 level to henkan.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
if  getPlayerVocation(cid) == 12 then
            doTransform(cid, 13, 67, 150, 1000)
									 setPlayerStorageValue(cid,1001,4)

end
 
Odp: Transform - Pomocy :<

Zobacz : w funkcji transform masz linijke:
PHP:
local bonushp = (getPlayerMaxHealth(cid)+bonus)
            setCreatureMaxHealth(cid, bonushp)
To ona dodaje do twojego aktualnego hp jaki? bonus.
Musisz wykombinowa? tak, ?eby w pliku Logout podczas wylogowania zmieni? hp na takie, jakie mia?e? przed transem.
Co? a'la to :
PHP:
local bonushp = (getPlayerMaxHealth(cid)-bonus)
            setCreatureMaxHealth(cid, bonushp)
Najlepiej jakby? napisa? funkcj? doRevert kt?ra nie tylko zmienia ilo?? hp i mp, ale r?wnie? cofa profesj?, outfit. Wtedy warunkiem ( if'em) b?dzie profesja/vocation. Co? a'la to:
PHP:
if getPlayerVocation(cid) == 11 then
doRevert(cid, profesja, outfit, bonus)
end

Z twoim skryptem musisz po ka?dym transie ustawia? storageValue co jest niewygodne i og?lnie to je?li chcesz ?eby podczas wylogowania si? cofa?o hp/mp nie masz innego wyj?cia , jak napisa? revert w logout.
 
Odp: Transform - Pomocy :<

No to taki skrypt ci proponuje jak nie masz du?o tych trans?w:
PHP:
function onLogout(cid)
if (getPlayerVocation(cid) == x) then 
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - hp)
		setCreatureMaxMana(cid, getPlayerMaxMana(cid) - mana)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
		doPlayerAddMana(cid, getPlayerMaxMana(cid))
		doPlayerSetVocation(cid, y) 
elseif  (getPlayerVocation(cid) == 37) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - hp)
		setCreatureMaxMana(cid, getPlayerMaxMana(cid) - mana)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
		doPlayerAddMana(cid, getPlayerMaxMana(cid))
		doPlayerSetVocation(cid, 12)

x - vocation po transie ten przy wylogowaniu
y - vocation nadawany by wr?ci? do po przedniego przed transform

mana i hp chyba nie musz? m?wi? :p

Je?eli nie masz du?o trans?w to b?dzie ma?o roboty :p
 
Odp: Transform - Pomocy :<

zamiast hp i mana wpisz ilo?? odejmowania hp i many i musi dzia?a? raczej, bo umie dzia?a skrypt transform :D
 
Status
Zamknięty.
Back
Do góry