What's new
  • logo_cipsoft
    Latest servers:
    New servers will open on: 19th Feb 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Talkactions Dodawanie hp/many kosztem soul - RPG.

Status
Not open for further replies.

3dzio

Active User
Joined
Jun 6, 2009
Messages
83
Reaction score
7
To m?j pierwszy skrypt wi?c prosz? o wyrozumia?o?? ;p Skrypt polega na losowym odnawianiu many z przedzia?u 10 do maxhp-currenthp (to samo z man?) kosztem souli. Ciekawe dla projekt?w RPG.
komendy: !heal / !mana

ScreenShot002.png

ScreenShot003.png


A tutaj efekt podczas u?ycia scrolla:
ScreenShot004.png


W talkactions/scripts dodaj healtandmana.lua:
PHP:
-- uh/mana with commands in-game
-- Created by Layflette/Fec/3dzio (Big thanks to Limos!)
function onSay(cid, words, param)
		local hpSoul, manaSoul = 9, 7
    	local playerInfo = {getCreatureHealth(cid), getCreatureMaxHealth(cid), getPlayerMana(cid), getPlayerMaxMana(cid), getPlayerSoul(cid)}
		if words == "!heal" then
			if playerInfo[1] < playerInfo[2] then
				if playerInfo[5] > hpSoul then
					doCreatureAddHealth(cid, math.random(10, playerInfo[2] - playerInfo[1]))
					doPlayerAddSoul(cid, -hpSoul)
					doCreatureSay(cid, "Sweet!", TALKTYPE_ORANGE_1) --works with tfs 0.2x mystic spirit
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need more soul to heal yourself!")
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your health is full!")
			end
		elseif words == "!mana" then
			if playerInfo[3] < playerInfo[4] then
				if playerInfo[5] > manaSoul then
					doPlayerAddMana(cid, math.random(7, playerInfo[2] - playerInfo[1]))
					doPlayerAddSoul(cid, -manaSoul)
					doCreatureSay(cid, "Glummp!", TALKTYPE_ORANGE_1) --works with tfs 0.2x mystic spirit
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need more soul to restore your mana!")
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your mana is full!")
			end
		end
		return TRUE
end
W talkactions.xml dodaj:
PHP:
<talkaction words="!heal" script="healtandmana.lua"/>
<talkaction words="!mana" script="healtandmana.lua"/>

Dodam tak?e scroll'a, kt?ry odnawia o 20 nasze punkty soul. Mo?na doda? do loota potwork?w.
W actions/scripts/tools dodaj soulscroll.lua:
PHP:
-- soul scroll
-- Created by Layflette/Fec/3dzio
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local addSoul = 20
	local soul = getPlayerSoul(cid)

	if item.itemid == 5956 then
		if getPlayerSoul(cid) < 100 then
			doPlayerAddSoul(cid, addSoul)
			doSendMagicEffect(getPlayerPosition(cid), 4)

			doPlayerRemoveItem(cid,5956,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You don't need more souls!")
		end

	end
	return TRUE
end

W actions.xml dodaj linijk?:
PHP:
<action itemid="5956" script="tools/soulscroll.lua"/>
 

TenTypSwir

NNSTORY.EU Developer
Joined
Jun 8, 2010
Messages
1,653
Reaction score
117
Odp: Dodawanie hp/many kosztem soul - RPG.

Hmm...
Code:
<talkaction words="!heal;!mana" script="healtandmana.lua"/>

+ nie ma exu... masz 100 soula --> ustawiasz na hota np .!mana --> idziesz na wara --> spam hotkiem :> + obciazenie dla servera
+ na ots rpg takie komendy? hmm... no nie jestem co do tego przekonany ~~ lepiej by to w spellu zrobic ;d
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dodawanie hp/many kosztem soul - RPG.

Oczywi?cie mo?na to napisa? lepiej jako?ciowo oraz wizualnie, ale jak na pocz?tkuj?cego to dobrze Ci idzie. Tylko tak dalej, a mo?esz zaj?? naprawd? daleko.
 

3dzio

Active User
Joined
Jun 6, 2009
Messages
83
Reaction score
7
Odp: Dodawanie hp/many kosztem soul - RPG.

Dzi?ki za komentarze :)
Fakt,exhausteda nie ma, poza tym jest lekkie op??nienie w tym, przynajmniej u mnie spamu nie ma. Poza tym mutuje n a 15~~ sec, gdy jest spam ;p
C??, jak dla mnie dla rpg mog?oby by?, w ko?cu mo?esz to u?y? ~~ 10 razy do wyczerpania souli a one tak szybko sie nie odnawiaj? ;p
 
Status
Not open for further replies.
Top