What's new

Creaturescripts Blessy

Status
Not open for further replies.

Matt

Banned
Joined
May 9, 2013
Messages
595
Reaction score
46
Cze??.
Mia?em chwilk? to napisa?em skrypt dot. bless?w.


Dzia?anie: Kupujesz pvp blessa lub pvm blessa za pomoc? komendy i zale?nie czy jak padasz od gracza czy od potwora i masz blessa to przenosi Ci? do temple, dodaje hp do pe?nego, nic nie tracisz, ani lvl ani itemk?w + dodatkowo jest komunikat.
Skrypt:

W data/creaturescripts/scripts stw?rz plik test1.lua i dodaj do niego:
[LUA]pvp_storage = 159357
pvm_storage = 371928

function onStatsChange(cid, attacker, type, combat, value)

if (getPlayerStorageValue(cid, pvp_storage) and isPlayer(attacker) and value >= getCreatureHealth(cid)) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSetPzLocked(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
setPlayerStorageValue(cid, pvp_storage, getPlayerStorageValue(cid, pvp_storage)-1)
if(getPlayerStorageValue(cid, pvp_storage) > 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Pozostalo Ci " ..getPlayerStorageValue(cid, pvp_storage).. " PVP Bless?w.")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Nie posiadasz juz " ..getPlayerStorageValue(cid, pvp_storage).. " PVP Bless?w.")
end
return false
elseif (getPlayerStorageValue(cid, pvm_storage) and isMonster(attacker) and value >= getCreatureHealth(cid)) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSetPzLocked(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
setPlayerStorageValue(cid, pvm_storage, getPlayerStorageValue(cid, pvp_storage)-1)
if(getPlayerStorageValue(cid, pvm_storage) > 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Pozostalo Ci " ..getPlayerStorageValue(cid, pvm_storage).. " PVE Bless?w.")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Nie posiadasz juz " ..getPlayerStorageValue(cid, pvm_storage).. " PVE Bless?w.")
end
return false
end
return true
end[/LUA]

i do creaturescripts.xml dodaj tak? linijk?:
[XML]<event type="statschange" name="test1" script="test1.lua"/>[/XML]

Dobra zosta?a nam jeszcze komenda.

W data/talkactions/script stw?rz plik bless.lua i dodaj do niego:
[LUA]pvp_storage = 159357
pvm_storage = 371928
price = 100 -- cena bless?w
count = 5 -- po ile bless?w ma dodawa??
function onSay(cid, words, param)

if (param == "pvp") then

if (doPlayerRemoveMoney(cid, price)) then
setPlayerStorageValue(cid, pvp_storage, getPlayerStorageValue(cid, pvp_storage)+count)
doPlayerSendCancel(cid, 'Dodano ' ..count.. ' PVP Bless?w.')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
else
doPlayerSendCancel(cid, 'Nie masz tyle pieniedzy.')
return false
end

elseif (param == "pve") then

if (doPlayerRemoveMoney(cid, price)) then
setPlayerStorageValue(cid, pvm_storage, getPlayerStorageValue(cid, pvm_storage)+count)
doPlayerSendCancel(cid, 'Dodano ' ..count.. ' PVE Bless?w.')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
else
doPlayerSendCancel(cid, 'Nie masz tyle pieniedzy.')
return false
end

else
doPlayerSendCancel(cid, 'Wpisz !bless pvp lub !bless pve.')
return false
end


return true
end[/LUA]

i do talkactions.xml dodaj:
[XML]<talkaction words="!bless" hide="yes" event="script" value="bless.lua"/>[/XML]

Zosta?a ostatnia rzecz, czyli zarejestrowanie eventu.

Dodajemy do data/creaturescripts/scripts/login.lua tak? linijk? pomi?dzy inne:
[LUA]registerCreatureEvent(cid, "test1")[/LUA]


Dantez - dzi?ki za ma?? odpowied? dot. mojego pytania. : D

To tyle filozofii w tym skrypcie, teraz pozdrawiam i dzi?kuje za uwag?.
 

diegos

Banned
Joined
Dec 5, 2010
Messages
195
Reaction score
7
Age
33
Odp: Blessy

Nie ogarniam po co pisa?e? pvp i pvm bless, skoro mog?e? doda?, ?e tylko zwyk?y bless masz to przenosi do temple itd.

@@ juz wiem
 
Last edited:
Status
Not open for further replies.
Top