What's new

Skrypty & Kody Przerobienie na RP Ek

Status
Not open for further replies.

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Witam przerobi? by mi kto? ten skrypt na rp ?eby pot dawa? mane oraz hp albo jak kto ma taki script to bym prosil do actions

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local heal_minimum = (level * 3.3) + (mlevel * 4) - 0
local heal_maximum = (level * 3.3) + (mlevel * 4)
local heal_add = math.random(heal_minimum, heal_maximum)
doCreatureAddHealth(cid, heal_add)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(cid, "Aaaa...", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "Tylko dla EK", TALKTYPE_ORANGE_1)
end
return TRUE
end
 

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

Pod jakim klientem Tibii pracujesz?

PHP:
	<action itemid="7588-7591;8472-8473;7618;7620;8704" event="script" value="potions.lua"/>

PHP:
local config = {
	removeOnUse = "no",
	splashable = "no",
	realAnimation = "no", -- make text effect visible only for players in range 1x1
	healthMultiplier = 1.5,
	manaMultiplier = 1.5
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
	[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
	[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 12, 11}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
	[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
	[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
		return true
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	doTransformItem(item.uid, potion.empty)
	return true
end

U?yj po prostu tego skryptu. S? w nim wszystkie potiony, ?atwa konfiguracja.
 

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Odp: Przerobienie na RP Ek

ale potrzebuje takiego skryptu ktory bedzie dawal coraz wiecej many na danym lvlu a tu jest od ilosci do ilosci musi byc taki zeby na malym lvl np dawal 200 a na duzym po 4k ten skrypt jest dobry ale daje tylko mane a potrzebuje na palka na sprit great potiona na hp i mane

PHP:
        local exhaust = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
     
    function onUse(cid, item, fromPosition, itemEx, toPosition)
     
    if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6  then
     
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mana_minimum = (level * 3.3) + (mlevel * 4) - 0
    local mana_maximum = (level * 3.3) + (mlevel * 4)
    local mana_add = math.random(mana_minimum, mana_maximum)
    doPlayerAddMana(cid, mana_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(cid, "Aaaa...", TALKTYPE_ORANGE_1)
    else
    doCreatureSay(cid, "Tylko dla MS lub ED", TALKTYPE_ORANGE_1)
    end
    return TRUE
    end
 
Last edited:

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

PHP:
        local exhaust = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
    function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6  then
 
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mana_minimum = (level * 3.3) + (mlevel * 4) - 0
    local mana_maximum = (level * 3.3) + (mlevel * 4)
    local mana_add = math.random(mana_minimum, mana_maximum)
    local heal_minimum = (level * 3.3) + (mlevel * 4) - 0
    local heal_maximum = (level * 3.3) + (mlevel * 4)
    local heal_add = math.random(heal_minimum, heal_maximum)
    doPlayerAddMana(cid, mana_add)
    doPlayerAddHealth(cid, heal_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(cid, "Aaaa...", TALKTYPE_ORANGE_1)
    else
    doCreatureSay(cid, "Tylko dla royal palladyna.", TALKTYPE_ORANGE_1)
    end
    return TRUE
    end

Spr?buj taki prosty spos?b. Nie jestem skrypterem, ale staram si? jako? pom?c. Pozdrawiam :D
 
Last edited:

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Odp: Przerobienie na RP Ek

testowa?em i daje tylko mane daje pr?bowa?em ju? troch? tez przerabia? ale nie potrafi? prosz? o pomoc o to blad z konsoli
51831022498059495055.png
[/URL][/IMG]
 
Last edited:

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

Naprawd? nie potrafisz poradzi? sobie z tak prostym b??dem? Je?eli poddajesz si? przy takim czym?, daruj sobie. Wystarczy zmieni? funkcj? doPlayerAddHealth na doCreatureAddHealth.


PHP:
doPlayerAddHealth(cid, heal_add)

na

doCreatureAddHealth(cid, heal_add)

n6ught.jpg

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uid ~= cid or itemEx.itemid ~= 1 then
		return TRUE
	end
 
	if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 6 then
 
     local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mana_minimum = (level * 2.3) + (mlevel * 4) - 2
    local mana_maximum = (level * 3.3) + (mlevel * 4)
    local mana_add = math.random(mana_minimum, mana_maximum)
    local heal_minimum = (level * 2.3) + (mlevel * 4) - 2
    local heal_maximum = (level * 3.3) + (mlevel * 4)
    local heal_add = math.random(heal_minimum, heal_maximum)
	
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, heal_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(cid, "Aaaa...", TALKTYPE_ORANGE_1)
    else
		doCreatureSay(cid, "This potion can only be consumed by paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
    end
    return TRUE
    end

PS. nie potrzebujesz w sumie funkcji exhaused, w TFS'ie w config.lua masz ustawienia odno?ne odst?p?w wykonywanych akcji 'in game'. :)
_/Regards.
 
Last edited:

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Odp: Przerobienie na RP Ek

skrypt dzi?a elegancko ale uzywam pontiona to pokazuje ze daje tylko np ilosc hp a many juz nie pokazuje ile dalo a u cb pokazuje od czego to zalezy posiadam silnik TFS 0.4 dev (8.6) donate z otlandu
 
Last edited:

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

Dodaj:

pod

PHP:
doCreatureSay(cid, "Aaaa...", TALKTYPE_ORANGE_1)

to

PHP:
doSendAnimatedText(getPlayerPosition(cid), '+' ..mana_add, TEXTCOLOR_TEAL)

> TEXTCOLOR_TEAL tutaj musisz sobie kolor ustawi?.

M?j silnik nie ma ShowDamageHealing, nie wiem dlaczego u Ciebie nie pokazuje - widocznie nie dzia?a przy tej funkcji.
 

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Odp: Przerobienie na RP Ek

po dodaniu tego to teraz widac jak dodaje tylko mane ;/
 

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

doSendAnimatedText(getPlayerPosition(cid), '+' ..heal_add, TEXTCOLOR_TEAL)

To teraz to pod tamtym co wcze?niej kaza?em doda?. Ogarnij sobie jakiego? skryptera, jak nie potrafisz przerobi? nawet skryptu.
 

wacha121

User
Joined
Nov 8, 2009
Messages
37
Reaction score
0
Odp: Przerobienie na RP Ek

przerabia?em i to nie dzia?a pokazuje albo hp albo mane a chce ?eby na raz pokazywa?o to i to
 

Dark Magican

Senior User
Joined
Apr 13, 2009
Messages
677
Reaction score
42
Odp: Przerobienie na RP Ek

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uid ~= cid or itemEx.itemid ~= 1 then
		return TRUE
	end
 
		if (not(isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
 
     local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local mana_minimum = (level * 2.3) + (mlevel * 4) - 2
    local mana_maximum = (level * 3.3) + (mlevel * 4)
    local mana_add = math.random(mana_minimum, mana_maximum)
    local heal_minimum = (level * 2.3) + (mlevel * 4) - 2
    local heal_maximum = (level * 3.3) + (mlevel * 4)
    local heal_add = math.random(heal_minimum, heal_maximum)
	
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, heal_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doSendAnimatedText(getPlayerPosition(cid), '+' ..mana_add, TEXTCOLOR_TEAL)
	doSendAnimatedText(getPlayerPosition(cid), '+' ..heal_add, TEXTCOLOR_YELLOW)
    else
		doCreatureSay(cid, "This potion can only be consumed by paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
    end
    return TRUE
    end


U mnie to dzia?a. _/Regards.
 
Status
Not open for further replies.
Top