maciek123 |
Wysłany: Sob 15:25, 05 Sty 2008 Temat postu: Skrypty do 7.92 Evolutions i Gotowy Server |
|
Witam zaprezentuje kilka skryptów i gotowy ots evolution ściągany z tibia.org.pl i bardzo dobrze przerobiony. To nie wirus możecie skanować do woli A więc...
- System najazdow (Dwarves, orcs, minotaurs, and elves fight each other)
- System areny (Mozna zedytowac w creature.cpp (Creature::die))
- Premium teleport gdy pacc się skończy przenosi na facc area. (Configurable in config.lua)
- Balansacja profesji
- Działające soft boots
- Ponad 50 questow
- Potwory bardziej podobne do tych z rl tibi(loot, hity).
- Teleport Potworów (Niektóre potwory na 1/3rd hp lub mniej teleportują się o 3 kratki, zostawiając uryne().)
- Highscores w grze (użyj !score <skill name>)
- Poprawiono wiele bugów
- 4.2 MB mapa posiada 1100 spawnów, stworzona przez Simen (Akkar on otfans)
- 41 domkow
- ,,Zbalansowane Czary"
- Queasty na addony działają.
- Questy przez actionid (Więcej w mapedytorze)
- Niewidzialny GM (/invisible)
- Calkiem stablny
- Zapisywanie charów(automatyczne)
- Raporty (reportaccess = 1 w config.lua)
- Duzo ,,Talkakcji"
- PowerRaft
- Rook Teleports (Kiedy masz 8 lvl możesz wybrać profesje przez wejście w odpowiedni teleport "vocation teleports")
doCreateTeleport+Gem system
IO-czytanie/zapis plików
przykład:
Cytat: | file = io.open("data/bank/"..name..".dat", "r")//open file(read)
line={}
line[1] = file:read("*line")//read line 1
line[2] = file:read("*line")//read line 2
line[3] = file:read("*line")//read line 3
file:close()//close file
file = io.open("data/bank/"..name..".dat", "w")//open file(write)
file:write(""..line[1].."\n")//write line 1
file:write(""..line[2].."\n")//write line 2
file:write(""..line[3].."\n")//write line 3
file:close()//close file |
doCreateTeleport-tworzy teleport do teleportPos w createPos
przykład
Cytat: | doCreateTeleport(1387, teleportPos, createPos) |
Gem System-buffy do broni zapisywane w graczach(ala diablo gem system)-wyciągnięty z Fra Diavolo (Killavus)+mój system odczytu i zapisu w xml
Cytat: | getGemAttackSpeed(item.uid)
setGemAttackSpeed(item.uid, speed)
getGemDefense(item.uid)
setGemDefense(item.uid, defense)
getGemAttack(item.uid)
setGemAttack(item.uid, attack) |
1.Edycja data/actions/lib/actions.lua
na końcu skryptu dodajemy:
Cytat: | -- Azi's Quest system[by Azeroth#24] 1.7 --
function Quest(puid, item, unique, itemid, count, actionid, desc)
if count < 1 then
count = count+1
end
if (item.uid == unique) then
if(getPlayerStorageValue(puid, unique) == -1) then
local prize = doPlayerAddItem(puid, itemid, count)
if(desc ~= "") then
doSetItemSpecialDescription(prize, desc)
end
if(actionid > 0) then
doSetItemActionId(prize, actionid)
end
setPlayerStorageValue(puid, unique, 1)
if(count== 1) then
doPlayerSendTextMessage(puid, 19, 'You have found '.. getItemName(itemid)..'.')
else
doPlayerSendTextMessage(puid, 19, 'You have found ' .. count .. ' '.. getItemName(itemid) .. '\'s.')
end
else
doPlayerSendTextMessage(puid, 19, "It\'s empty.")
end
end
return unique
end
function containerQuest(puid, item, uniq, contid, items, counts)
if(table.getn(items) == table.getn(counts)) then
if(item.uid == uniq) then
if(getPlayerStorageValue(puid, uniq) == -1) then
cont = doPlayerAddItem(puid, contid, 1)
doPlayerSendTextMessage(puid,19,'You have found a ' .. getItemName(contid) .. '.')
x = 1
y = table.getn(items)
for n= x, y do
if counts[n] == 0 then
counts = 1
end
doAddContainerItem(cont, items[n], counts[n])
setPlayerStorageValue(puid,uniq,1)
end
else
doPlayerSendTextMessage(puid,19,'It\'s empty.')
end
end
else
print ":: ERROR! #bugged Quest!\nOne of your Container Quest\'s is bugged, please repair it!\nYou\'r Azi\'s Quest System."
end
return uniq
end
function randomQuest(puid, item, uniq, itemid, count)
if(table.getn(itemid)==table.getn(count))then
if(getPlayerStorageValue(puid, uniq) == -1) then
r=math.random(1, table.getn(itemid))
doPlayerAddItem(puid, itemid[r], count[r])
setPlayerStorageValue(puid, uniq, 1)
if(count[r] > 1)then
doPlayerSendTextMessage(puid, 19, 'You have found ' .. count[r] ..' ' .. getItemName(itemid[r]) .. '\'s.')
else
doPlayerSendTextMessage(puid, 19, 'You have found ' .. getItemName(itemid[r]) .. '.')
end
else
doPlayerSendTextMessage(puid, 19, 'It\'s empty.')
end
else
write "One of your Random Quests is bugged."
end
return unique
end
function keyQuest(puid, item, item_id, key_id, uniq)
if(item.uid==uniq)then
if(getPlayerStorageValue(puid, uniq)==-1)then
add_key = doPlayerAddItem(puid, item_id, 1)
doSetItemActionId(add_key, key_id)
setPlayerStorageValue(puid, uniq, 1)
doPlayerSendTextMessage(cid, 19, 'You have found ' .. getItemName(item_id) .. '(ID: ' .. key_id .. ').')
else
doPlayerSendTextMessage(puid, 19, 'It\'s empty.')
end
end
return key_id, item_id
end
function escapingQuest(puid, item, maxescape, uniqueid, prize, count)
if(item.uid==uniqueid)then
local escape=math.random(1, maxescape)
local randpos=math.random(1,4)
if(randpos==1)then
local pos = {x=topos.x, y=topos.y-escape, z=topos.z}
elseif(randpos==2)then
local pos = {x=topos.x, y=topos.y+escape, z=topos.z}
elseif(randpos==3)then
local pos = {x=topos.x-escape, y=topos.y, z=topos.z}
elseif(randpos==4)then
local pos = {x=topos.x+escape, y=topos.y, z=topos.z}
end
local dotp = {x=pos.x, y=pos.y, z=pos.z, stackpos=1}
local empty=getThingfromPos(dotp)
if(empty.itemid>0)then
local tp = false
else
local tp = true
end
if(tp==true)then
doTeleportThing(item.uid, pos)
doSendAnimatedText(pos, "HAHAHAHA!", math.random(1,255))
else
doPlayerAddItem(puid, prize, count)
end
end
return escape, randpos
end
-- end of Azi's quest system[by Azeroth#24] -- |
2. data/actions/scripts/quest.lua
Cytat: | function onUse(cid, item, frompos, item2, topos) |
-- normalny quest --
Quest(cid, item, UNIQUE ID SKRZYNKI, ITEM ID NAGRODY, ILOŚĆ NAGRODY, ACTION ID NAGRODY, "SpECjalny opis")
-- quest z itemami w bp --
ZMIENNA TABELI Z ITEMID(NP. itemy) = {ITEMID nAGRODY 1, ITEMID nAGRODY 2, ITEMID nAGRODY 3}
ZMIENNA TABELI Z ILOSCIA(NP. count) = {ILOSC NAGRODY 1, ILOSC NAGRODY 2, ILOSC NAGRODY 3}
addQuestContainer(cid, item, UNIque ID SKRZYNKI, ID BP(albo innego kontenera), Zmienna tabeli z itemid, zmienna tabeli z count)
-- Random Quest --
losowe_itemy={2472, 2466, 2160} -- losowe itemy(ID) - jeden po drugim
losowa_ilosc={1, 1, 54} -- ilosc itemow losowych(uklad taki jak w item id losowych)
addQuestRandom(cid, item, UNIQUE ID, losowe_itemy, losowa_ilosc)
-- Key Quest
keyQuest(cid, item, ITEMID KLUCZA, Action ID KLUCZA, Unique ID Skrzynki)
-- Escape Quest
escapingQuest(cid, item, NA ILE KRATEK MOZE ODSKOCZYC SKRzynka, UNIQUEID SKRZYNKI, ITEMID NAGRODY, COUNT NAGRODY)
return 1
end
przykładowy quest.lua w którym są 3 questy
function onUse(cid, item, frompos, item2, topos)
Quest(cid, item, 1001, 2160, 5, 0, "")
Quest(cid, item, 1002, 2407, 1, 0, "jakis tam opis")
Quest(cid, item, 1003, 2171, 1, 852, "Quest zrobiony przy pomocy quest systemu by Azeroth#24.")
-- QUEST Z ITEMAMI W BP --
itemy1 = {2472, 2160, 2152, 2148, 2123}
count1 = {1, 60, 52, 48, 1}
containerQuest(cid, item, 2001, 2001, itemy1, count1)
-- Random Quest --
itemy={2472, 2466, 2160}
ilosc={1, 1, 54}
randomQuest(cid, item, 8889, itemy, ilosc)
-- Key Quest
keyQuest(cid, item, 2169, 666, 2626)
-- Escape Quest
escapingQuest(cid, item, 3, 6767, 2472, 1)
eturn 1
end
jak chcemy dodać quest dodajemy linijke do quest.lua i dajemy skrzynce unique id podane w linijce.
jedna linijka
Quest(cid,item, ...)
Inventory item odbija obrażenia
W pliku items.h w strukturze Abilities:
Pod:
Cytat: | absorbPercentDrown = 0; |
Dodajemy:
Kod:
I pod:
Kod:
Cytat: | uint8_t absorbPercentDrown; |
Dodajemy:
Kod:
Cytat: | uint32_t returnDamage; |
W pliku items.cpp:
Pod:
Kod:
Cytat: | else if(strcasecmp(strValue.c_str(), "runeSpellName") == 0){
if(readXMLString(itemAttributesNode, "value", strValue)){
it.runeSpellName = strValue;
}
} |
Dodajemy:
Kod:
Cytat: | else if(strcasecmp(strValue.c_str(), "returnDamage") == 0){
if(readXMLInteger(itemAttributesNode, "value", intValue)){
it.abilities.returnDamage = intValue;
}
} |
W pliku game.cpp:
Pod:
Kod:
Cytat: | bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target,
int32_t healthChange, bool checkDefense /* = false */, bool checkArmor /* = false */)
{
const Position& targetPos = target->getPosition();
bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target,
int32_t healthChange, bool checkDefense /* = false */, bool checkArmor /* = false */)
{
const Position& targetPos = target->getPosition();
const Position& attackerPos = attacker->getPosition();
double returnDamage = 0; |
Pod:
Kod:
Cytat: | damage = std::min(target->getHealth(), damage);
if(damage > 0){ |
Dodajemy:
Kod:
Cytat: | if(target->getPlayer()){
Player *player = target->getPlayer();
Item* item = player->getInventoryItem(SLOT_HEAD);
if(item){
const ItemType& head = Item::items[item->getID()];
if(head.abilities.returnDamage != 0){
returnDamage += head.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_NECKLACE);
if(item){
const ItemType& neck = Item::items[item->getID()];
if(neck.abilities.returnDamage != 0){
returnDamage += neck.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_ARMOR);
if(item){
const ItemType& armor = Item::items[item->getID()];
if(armor.abilities.returnDamage != 0){
returnDamage += armor.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_LEGS);
if(item){
const ItemType& legs = Item::items[item->getID()];
if(legs.abilities.returnDamage != 0){
returnDamage += legs.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_FEET);
if(item){
const ItemType& feet = Item::items[item->getID()];
if(feet.abilities.returnDamage != 0){
returnDamage += feet.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_RING);
if(item){
const ItemType& ring = Item::items[item->getID()];
if(ring.abilities.returnDamage != 0){
returnDamage += ring.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_LEFT);
if(item){
const ItemType& left = Item::items[item->getID()];
if(ring.abilities.returnDamage != 0){
returnDamage += left.abilities.returnDamage;
}
}
item = player->getInventoryItem(SLOT_RIGHT);
if(item){
const ItemType& right = Item::items[item->getID()];
if(right.abilities.returnDamage != 0){
returnDamage += ring.abilities.returnDamage;
}
}
returnDamage /= 100;
}
if(!(int)(returnDamage*damage) == 0)
attacker->drainHealth(target, combatType, (int)(returnDamage*damage)); |
I pod:
Kod:
Cytat: | std::stringstream ss;
ss << damage;
addMagicEffect(list, targetPos, hitEffect);
addAnimatedText(list, targetPos, textColor, ss.str()); |
Dodajemy:
Kod:
Cytat: | ss.str("");
if(!(int)(returnDamage*damage) == 0){
ss << (int)(returnDamage*damage);
addMagicEffect(list, attackerPos, NM_ME_DRAW_BLOOD);
addAnimatedText(list, attackerPos, TEXTCOLOR_ORANGE,"-" + ss.str()); |
Teraz aby item miał właściwość returnDamage należy dodać w pliku items.xml pod nazwą itemu;
<attribute key="returnDamage" value = "XX"/>
Gdzie XX to procent obrażeń jaki ma odbijać przedmiot w atakującego.
Przykładowe działanie"
<attribute key="returnDamage" value = "50"/>
Gracz atakuje drugiego, który nosi ten item za 10 pkt obrażeń i sam otrzymuje 50% z tego.
A i mam dla was skrypt npc który spszedaje runy w bp w wersji polskiej...(niewidziałem takiego skryptu na forum)
no to zaczynamy :
Tworzymy plik Meler.lua w data/npc
i wpisujemy tu
Cytat: | <?xml version="1.0"?>
<npc name="Meler" script="data/npc/scripts/bp_run.lua" access="3" lookdir="2" autowalk="1">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="134" head="114" body="113" legs="113" feet="113"/>
</npc> |
Następnie tworzymy plik bp_run.lua w data/npc/scripts
i wpisujemy tu
Cytat: | local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Siema ' .. creatureGetName(cid) .. '! Selluje bp run (bp runes).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! czekaj minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'backpacks') or msgcontains(msg, 'bp runes') then
selfSay('Selluje bp hmm (20k), bp uh (20k), bp gfb (20k), bp explosion (20k), bp sd (20k), bp mwall(20k).')
elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,100,20000)
elseif msgcontains(msg, 'bp hmm') then
buyContainer(cid,1998,2311,100,20000)
elseif msgcontains(msg, 'bp uh') then
buyContainer(cid,2002,2273,100,20000)
elseif msgcontains(msg, 'bp gfb') then
buyContainer(cid,2000,2304,100,20000)
elseif msgcontains(msg, 'bp explosion') or msgcontains(msg, 'bp explo') then
buyContainer(cid,2001,2313,100,20000)
elseif msgcontains(msg, 'bp mwall') then
buyContainer(cid,1999,2293,100,20000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end |
Gotowy OTS do pobrania:
Mirror1:
http://rapidshare.com/files/81439421/Evolutions_0.7.6_XML.rar |
|