Transform

Status
Zamknięty.

Ghalla

Active User
Zarejestrowany
Dołączył
Sierpień 24, 2010
Posty
88
Liczba reakcji
11
Wiek
32
Jako, ?e Rahim'a na tym ju? nie przebywa, a liczba temat?w na temat tranform nie maleje wychodz? z inicjatyw? do u?ytkownik?w. Jest to prosty skrypt transform z konfiguracj? dla wielu profesji itd
Kod:
local configs = 
{
	[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22, addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}


function onSay(cid, words, param)
	local informations = {voc = getPlayerVocation(cid), outfit = getCreatureOutfit(cid), mana = getCreatureMaxMana(cid), health = getCreatureMaxHealth(cid)}
	local config = configs[voc]
	if(config ~= nil) then
		if(getCreatureMana(cid) >= config.needMana) then
			if(getPlayerLevel(cid) >= config.needLevel) then
				setPlayerVocation(cid, config.transformVocation)
				setCreatureMaxMana(cid, config.addMaxMana)
				setCreatureMaxHealth(cid, config.addMaxHealth)
				setCreatureOutfit(cid, config.newOutfit)
				doCreatureAddMana(cid, -config.needMana)
				sendEventEffect(cid, config.transEffect, config.removingMana, config.transformVocation, informations, config.delay)
				return true
			end
		end
	end	
	doPlayerSendTextMessage(cid, 22 ,"You cannot transform")
	return true
end

function sendEventEffect(cid, effect, removeMana, voc, informations, delay)
	if(getPlayerVocation(cid) == voc) then
		if(getCreatureMana(cid) >= removeMana) then
			doSendMagicEffect(getPlayerPosition(cid), effect)
			doCreatureAddMana(cid, -removeMana)
			addEvent(sendEventEffect, 1000 * delay, {cid, effect, removeMana, voc, informations, delay})
		else
			setPlayerVocation(cid, informations.voc)
			setCreatureMaxMana(cid, informations.mana)
			setCreatureMaxHealth(cid, informations.health)
			setCreatureOutfit(cid, informations.outfit)
		end
	end
	return true
end

U?ytkownik?w interesuje ta cz???
Kod:
local configs = 
{
	[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22,  addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}

Tutaj zawarte jest konfiguracja, ja wrzuci?em przyk?adow?. Teraz t?umacz? jak to dzia?a:
Kod:
[1] - Mi?dzy nawiasami wpisujemy numery profesji jaka mo?e transformowa?
needMana - to warto?? many jak? potrzebujemy na transformacj?
needLevel - to level jaki potrzebujemy
transformVocation - numer profesji w jak? tranformuje
newOutfit - jest to nowy wygl?d, wype?niamy warto?ci mi?dzy klamrami
transEffect - efekt jaki b?dzie na postaci
addMaxMana - ile ma dodawa? maksymalnej many po transie
addMaxHealth - ile ma dodawa? maksymalnego ?ycia po transie
effectDelay - czas mi?dzy pokazywaniem efektu i zabieraniem many
removingMana -ile many po by? zabieranem podczas transu

Kod:
[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22,  addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
[2] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22,  addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}

Je?eli macie jakie? pomys? do ulepszenia skryptu lub dodania czego? ciekawego do niego, piszcie, komentujcie na pewno dodam.
 
Odp: Transform

Tylko ?e to nie dzia?a wywala b??dy w silniku tak jak napisa? kolega wy?ej.
 
Odp: Transform

wsz?dzie po "getach" gdzie s? puste nawiasy pozamienia? na (cid), np:
Kod:
getPlayerVocation()

Kod:
getPlayerVocation(cid)
 
Odp: Transform

Przepraszam, ?e od?wie?am ale mam pewien problem.
Ot?? niewa?ne jakie parametry wpisze tutaj:
Kod:
local configs = 
{
	[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22,  addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
to i tak mi pokazuje si? napis "You cannot transform".
Pozdrawiam.
 
Odp: Transform

Sorry ze od?wiezam ale skrypt nie dzia?a.
Jak kolega up napisa? co kolwiek nie zrobi? to nie da sie zrobic transform.
 
Odp: Transform

PHP:
if(config ~= nil) then
usuncie to oraz jednego
PHP:
end
 
Odp: Transform

Arkam to wyzuci bl?d w konsoli gdy nie b?dzie transa dla danego gracza. Skrypt troch? nie dopracowany, gdy? np dla Druida i Elder Druida trzeba osobny trans ;/
 
Ostatnia edycja:
Odp: Transform

Sorry,
PHP:
if(config ~= nil) then
na
PHP:
if config then
:D wtedy spradzi czy cos w configu jest tzn jak tak to return true a jak nie to nic
 
Odp: Transform

Nadal pokazuje si? You cannot transform :/ wszystko dobrze uzupe?niam i nic. Zmieni?em tak jak Arkam napisa?e? ale nadal to samo.
?eby nie by?o u?ywam Tfs pod 8.54 0.3.6pl1 wi?c powinno dzia?a?.
Prosz? o pomoc :)
 
Odp: Transform

PHP:
--Transform by Arkam-
function onSay(cid, words, param)
local cfg = {
		oldVoc = 1,
		level = 8,
		effect = 21,
		newVoc = 2,
		newOutfit = 201,
		longEffect = 22,
		newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
		}
    if getPlayerVocation(cid) == cfg.oldVoc then
    if getPlayerLevel(cid) >= cfg.level then
    doSendMagicEffect(getCreaturePosition(cid), cfg.effect, true)
    doPlayerSetVocation(cid, cfg.newVoc)
	setCreatureOutfit(cid, cfg.newOutfit)
    function eventtrans(cid)
    if isPlayer(cid) then
    doSendMagicEffect(getPlayerPosition(cid), cfg.longEffect)
        addEvent(eventtrans, 1000, cid)
        end
    vc = addEvent(eventtrans, 1000, cid)
    doSendAnimatedText(getCreaturePosition(cid), "Transform", COLOR_WHITE)
    return true
end
end
end
end

Tylko dodaj sobie zabezpieczenia w logout/login.
 
Odp: Transform

Ok dzia?a mam jeszcze pytanie jak edytowa? ten skrypt u g?ry aby mo?na w nim by?o zapisa? wiele profesji ?
 
Odp: Transform

W skrypcie Galla trzeba zmienic:
PHP:
local config = configs[voc]
na
PHP:
local config = configs[informations.voc]
a dodatkowo zawiera ten skrypt kilka funkcji kt?re ju? s? przestarza?e, lub w og?le s? z?e. Np: SetPlayerVocation -> doPlayerSetVocation ...
 
Status
Zamknięty.
Back
Do góry