What's new

Skrypty & Kody Sample

Status
Not open for further replies.

buuuszek

Active User
Joined
Aug 27, 2012
Messages
71
Reaction score
0
Witam, mam taki problem, ?e nowe postacie wzoruj? sw?j looktype itp. na swoich SAMPLE odpowiednikach ( np. nowo zrobiony knight wzoruje si? na postaci Knight Sample ) i chcia?bym to zmieni?, aby nie by?y one zale?ny od postacie SAMPLE, poniewa? kiedy u?ywam skryptu transform i m?j voc zmienia si? na voc kt?ry nie posiada odpowiednika SAMPLE to po ?mierci nasze hp jest r?wne 0, wi?c od razu po respawnie giniemy.
Z g?ry bardzo dzi?kuje :D
 

Trison

Active User
Joined
Feb 25, 2014
Messages
78
Reaction score
12
Odp: Sample

Ale to dzia?a tylko przy tworzeniu postaci, jak masz ustawione w vocations.xml? I sprawd? w creaturescripts czy nie masz jakich? niechcianych funkcji onDeath.
 

DanJ93

ElfBot Helper
Joined
Jan 18, 2009
Messages
2,631
Reaction score
200
Odp: Sample

Sample jest wczytywany tylko podczas zak?adania postaci. To nie wina sample.
Pewnie wina skryptu transformu z odejmowaniem hp po ?mierci
 

buuuszek

Active User
Joined
Aug 27, 2012
Messages
71
Reaction score
0
Odp: Sample

VOCATIONS

<?xml version="1.0" encoding="UTF-8"?>
<vocations>
<vocation id="0" name="RowereLee" description="Rockrwerree. You are genin in konoha-gakure." needpremium="0" gaincap="5" gainhp="20" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="1000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.2" defense="1.0" magDefense="1.0" armor="3.0"/>
<skill fist="9.5" club="9.0" sword="9.0" axe="0.5" distance="9.0" shielding="9.5" fishing="9.1" experience="1.0"/>
</vocation>


Czy co? tutaj jest ?le ?
 

Trison

Active User
Joined
Feb 25, 2014
Messages
78
Reaction score
12
Odp: Sample

Nie, tutaj jest w porz?dku. Poka? nam skrypt na ten transform i sprawd? creaturescripts.
 

buuuszek

Active User
Joined
Aug 27, 2012
Messages
71
Reaction score
0
Odp: Sample

transform skrypt :

Code:
local transforms = 
    {
	
		-- 1-357
		[4] = {outfit = {lookType=6}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 15, oldvoc = 4, effect = 21},
		[1] = {outfit = {lookType=155}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 16, oldvoc = 1, effect = 21},
		[2] = {outfit = {lookType=132}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 17, oldvoc = 2, effect = 21},
		[3] = {outfit = {lookType=7}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 18, oldvoc = 3, effect = 21},
		[7] = {outfit = {lookType=25}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 19, oldvoc = 7, effect = 21},
		
		
	 
    }
	
	----------------------------------
	---SKRYPT TRANSFORM BY MIKASCHI---
	----------------------------------
function onSay(cid, words, param, channel)
	if(getPlayerVocation(cid) == 38) then
		trans_staly(cid)
	
	else
		trans_okresowy(cid)
	
	return true
	end
end

	
function trans_staly(cid)
transform = transforms[getPlayerVocation(cid)]

    if(transform) then
       if getPlayerMana(cid) >= transform.level then
			if getPlayerMana(cid) >= transform.manacost then
			
					doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are transofrmed!")
					doPlayerAddMana(cid, transform.manacost)
					setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
					setCreatureMaxMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
					doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
					doPlayerAddMana(cid, getPlayerMaxMana(cid))
					doSetCreatureOutfit(cid, transform.outfit, -1)
					doPlayerSetVocation(cid, transform.newvoc)
			else
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are manacost")
				return true
			end
		else
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are level!")
			return true
		end 
	else
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are voc!")
		return true
	end 
end					
		
	
function trans_okresowy(cid)
transform = transforms[getPlayerVocation(cid)]
	if(transform) then
		if getPlayerMana(cid) >= transform.level then
			if getPlayerMana(cid) >= transform.manacost then			
					doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are transofrmed!")
					doPlayerAddMana(cid, transform.manacost)
					setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
					setCreatureMaxMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
					doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
					doPlayerAddMana(cid, getPlayerMaxMana(cid))
					doSetCreatureOutfit(cid, transform.outfit, -1)
					doPlayerSetVocation(cid, transform.newvoc)
			else
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are manacost")
				return true
			end
		else
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are level!")
			return true
		end 
	else
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are voc!")
		return true
	end 
end



Je?eli chodzi o creaturescripts to mam takie pliki :
-advancesave
-golgordan
-guildmotd
-idle
-login
-logout
-mail
-nifra
-outfits
-reportbug
-reputation from monsters
-skullcheck
-Vampire Bride

Wydaje mi si? ?e ?aden nie ma funcji odDeath...

Nie wiem czy si? przyda ale dodaj? jeszcz? login.lua

local VOCATION_STORAGE = 10000
function onLogin(cid)
if(getPlayerStorageValue(cid, VOCATION_STORAGE) > 0) then
doPlayerSetVocation(cid, getPlayerStorageValue(cid, VOCATION_STORAGE))
setPlayerStorageValue(cid, VOCATION_STORAGE, 0)
end
return TRUE
end
 
Last edited by a moderator:

misztrz440

Banned
Joined
Dec 15, 2012
Messages
1,032
Reaction score
39
Odp: Sample

transform skrypt :

local transforms =
{

-- 1-357
[4] = {outfit = {lookType=6}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 15, oldvoc = 4, effect = 21},
[1] = {outfit = {lookType=155}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 16, oldvoc = 1, effect = 21},
[2] = {outfit = {lookType=132}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 17, oldvoc = 2, effect = 21},
[3] = {outfit = {lookType=7}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 18, oldvoc = 3, effect = 21},
[7] = {outfit = {lookType=25}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 19, oldvoc = 7, effect = 21},

Tutaj masz "dodajHp=0", wi?c mo?e to zmienia hp na 0. Zmie? na 100 i zobacz.
 

Trison

Active User
Joined
Feb 25, 2014
Messages
78
Reaction score
12
Odp: Sample

[LUA]local transforms =
{

-- 1-357
[4] = {outfit = {lookType=6}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 15, oldvoc = 4, effect = 21},
[1] = {outfit = {lookType=155}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 16, oldvoc = 1, effect = 21},
[2] = {outfit = {lookType=132}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 17, oldvoc = 2, effect = 21},
[3] = {outfit = {lookType=7}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 18, oldvoc = 3, effect = 21},
[7] = {outfit = {lookType=25}, manacost = -100, dodajHp = 0, dodajMane = 0, czas = -1, level = 25, newvoc = 19, oldvoc = 7, effect = 21},



}

----------------------------------
---SKRYPT TRANSFORM BY MIKASCHI---
----------------------------------
function onSay(cid, words, param, channel)
if(getPlayerVocation(cid) == 38) then
trans_staly(cid)

else
trans_okresowy(cid)

return true
end
end


function trans_staly(cid)
transform = transforms[getPlayerVocation(cid)]

if getPlayerVocation(cid) == transform then
if getPlayerMana(cid) >= transform.level then -- mana sprawdza level?
if getPlayerMana(cid) >= transform.manacos=t then

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are transofrmed!")
doPlayerAddMana(cid, transform.manacost)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
doPlayerAddMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
doSetCreatureOutfit(cid, transform.outfit, -1)
doPlayerSetVocation(cid, transform.newvoc)
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are manacost")
return true
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are level!")
return true
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are voc!")
return true
end
end


function trans_okresowy(cid)
transform = transforms[getPlayerVocation(cid)]
if getPlayerVocation(cid) == transform then
if getPlayerMana(cid) >= transform.level then -- mana sprawdza level?
if getPlayerMana(cid) >= transform.manacost then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are transofrmed!")
doPlayerAddMana(cid, transform.manacost)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) + transform.dodajHp)
doPlayerAddMana(cid, getPlayerMaxMana(cid) + transform.dodajMane)
doSetCreatureOutfit(cid, transform.outfit, -1)
doPlayerSetVocation(cid, transform.newvoc)
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are manacost")
return true
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are level!")
return true
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You are voc!")
return true
end
end[/LUA]

Zobacz teraz, tak na szybko ale chyba pomo?e, nie jestem na 100% pewny. I doko?cz skrypt bo s? niedopracowania.
 

DanJ93

ElfBot Helper
Joined
Jan 18, 2009
Messages
2,631
Reaction score
200
Odp: Sample

Je?li nie pomo?e, to wklej jeszcze nam ca?y "logout.lua" i "login.lua"
 

buuuszek

Active User
Joined
Aug 27, 2012
Messages
71
Reaction score
0
Odp: Sample

Hmmm... ten skrypt nie dzia?a nawet :p a je?eli chodzi o ca?y login i logout to ...

Login.lua :
local VOCATION_STORAGE = 10000
function onLogin(cid)
if(getPlayerStorageValue(cid, VOCATION_STORAGE) > 0) then
doPlayerSetVocation(cid, getPlayerStorageValue(cid, VOCATION_STORAGE))
setPlayerStorageValue(cid, VOCATION_STORAGE, 0)
end
return TRUE
end


logout.lua :

function onLogout(cid)
if (getPlayerVocation(cid) == 1) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 300)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 300)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 1)
elseif (getPlayerVocation(cid) == 2) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 250)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 250)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 2)
elseif (getPlayerVocation(cid) == 3) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 200)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 200)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 3)
elseif (getPlayerVocation(cid) == 4) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 250)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 250)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 4)
elseif (getPlayerVocation(cid) == 11) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 11)
elseif (getPlayerVocation(cid) == 11)
or (getPlayerVocation(cid) == 1)
or (getPlayerVocation(cid) == 2)
or (getPlayerVocation(cid) == 3)
or (getPlayerVocation(cid) == 4) then
return true
end
end

Hmmm... teraz tak my?l?, ?e mo?e co? z tym logout.lua mo?e jest nie tak ?
Prosz? o pomoc ;P
 
Status
Not open for further replies.
Top