What's new

Creaturescripts Dzia?aj?ce INQ.

Status
Not open for further replies.

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Najpierw kierujemy si? do folderu creaturescripts/scripts i tworzymy tam plik o nazwie inquisitionPortals.lua po czym wklejamy:
PHP:
--Script by Oskar for tibia.net.pl
function onDeath(cid, corpse, killer)
ogolem = {
              ["ushuriel"] = {pos_gdzie_sie_pojawi = {x=1900, y=1875, z=12, stackpos=1}, aid_tp = 3200},
              ["zugurosh"] = {pos_gdzie_sie_pojawi = {x=1932, y=1874, z=12, stackpos=1}, aid_tp = 3201},
              ["madareth"] = {pos_gdzie_sie_pojawi = {x=1915, y=1915, z=12, stackpos=1}, aid_tp = 3202},
              ["latrivan"] = {pos_gdzie_sie_pojawi = {x=1950, y=1915, z=12, stackpos=1}, aid_tp = 3203},
              ["golgordan"] = {pos_gdzie_sie_pojawi = {x=1950, y=1915, z=12, stackpos=1}, aid_tp = 3203},
              ["annihilon"] = {pos_gdzie_sie_pojawi = {x=1990, y=1875, z=12, stackpos=1}, aid_tp = 3204},
              ["hellgorak"] = {pos_gdzie_sie_pojawi = {x=1995, y=1917, z=12, stackpos=1}, aid_tp = 3205}
             }
time_to_end = 180
message = "Posiadasz 3 minuty na opuszczenie pokoju."
inq = ogolem[getCreatureName(cid)]
	if getCreatureName(cid) == "golgordan" or getCreatureName(cid) == "latrivan" then
		brat_1 = getCreatureByName("golgordan")
		brat_2 = getCreatureByName("latrivan")
			if brat_1 == nil or brat_2 == nil then
				doItemSetAttribute(getThingFromPos(inq.pos_gdzie_sie_pojawi).uid, "aid", inq.aid_tp)
				doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
				addEvent(usun_aid, time_to_end * 1000, inq.aid_tp)
			else
				doCreatureSay(cid, "M?j bracie ide odpoczac.", TALKTYPE_ORANGE_1)
			end
	else
		doItemSetAttribute(getThingFromPos(inq.pos_gdzie_sie_pojawi).uid, "aid", inq.aid_tp)
		doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
		addEvent(usun_aid, time_to_end * 1000, inq.aid_tp)
	end
return true
end
function usun_aid(itemus)
doItemSetAttribute(getThingFromPos(inq.pos_gdzie_sie_pojawi).uid, "aid", 3210)
return true
end
Nast?pnie otwieramy plik o nazwie creaturescripts.xml znajduj?cy si? w folderze creaturescripts i wklejamy tam:
PHP:
<event type="death" name="Inq" event="script" value="inquisitionPortals.lua"/>
Nast?pnie przenosimy si? do folderu monsters i do ka?dego z siedmiu boss?w pod </flags> doklejamy:
PHP:
	<script>
<event name="Inq"/> 
</script>


Przechodzimy teraz do folderu movements/scripts i tworzymy tam dwa pliki, pierwszy to inq_tp.lua drugi za? to inq_tp_in.lua i wklejamy kolejno,
Do inq_tp.lua:
PHP:
--Script by Oskar for tibia.net.pl
function onStepOut(cid, item, pos)
local teleporty = {
					[3200] = {pos_gdzie_tp = {x=1831,y=1967,z=12}}, --pozycja gdzie ma tp po zabiciu ushuriela
					[3201] = {pos_gdzie_tp = {x=1862,y=1919,z=12}}, --pozycja gdzie ma tp po zabiciu zugurosha
					[3202] = {pos_gdzie_tp = {x=1815,y=1871,z=12}}, --pozycja gdzie ma tp po zabiciu madaretha
					[3203] = {pos_gdzie_tp = {x=1823,y=1780,z=12}}, --pozycja gdzie ma tp po zabiciu golgordana/latrivana
					[3204] = {pos_gdzie_tp = {x=2046,y=1958,z=12}}, --pozycja gdzie ma tp po zabiciu annihilona
					[3205] = {pos_gdzie_tp = {x=1867,y=1779,z=14}}, --pozycja gdzie ma tp po zabiciu hellgoraka
					[3210] = {pos_gdzie_tp = {x=1863,y=1742,z=14}} --pozycja komnaty z teleportami
					}
local tp = teleporty[item.actionid]
if isInArray({3200,3201,3202,3203,3204,3205}, item.actionid) then
	doTeleportThing(cid, tp.pos_gdzie_tp)
	if getPlayerStorageValue(cid, item.actionid) == -1 then
		doCreatureSay(cid, "Gratulacje kolejny demon ukorzyl sie przed toba", TALKTYPE_ORANGE_1)
		doPlayerSetStorageValue(cid, item.actionid, 1)
	end
elseif item.actionid == 3210 then
	doTeleportThing(cid, tp.pos_gdzie_tp)
end
return true
end
Za? do inq_tp_in.lua:
PHP:
--Script by Oskar for tibia.net.pl
function onStepOut(cid, item, position, fromPosition)
local tabeleczka = {
				[3200] = "Nie mozesz wejsc do 'Crystal Caves' dopoki nie pokonasz jednego z pomocnikow Ruthless Seven.",
				[3201] = "Nie mozesz wejsc do 'Blood Halls' dopoki nie pokonasz jednego z pomocnikow Ruthless Seven.",
				[3202] = "Nie mozesz wejsc do 'Vats' dopoki nie pokonasz jednego z pomocnikow Ruthless Seven.",
				[3203] = "Nie mozesz wejsc do 'Arcanum' dopoki nie pokonasz jednego z pomocnikow Ruthless Seven.",
				[3204] = "Nie mozesz wejsc do 'Hive' dopoki nie pokonasz jednego z pomocnikow Ruthless Seven."}                           
if getPlayerStorageValue(cid, item.uid) < 1 then
		if item.uid == 3200 then
			local tp_dol = {x=fromPosition.x, y=fromPosition.y+3, z=fromPosition.z}
			doTeleportThing(cid, tp_dol)
		elseif isInArray({3201,3202}, item.uid) then
			local tp_lewo = {x=fromPosition.x-3, y=fromPosition.y, z=fromPosition.z}
			doTeleportThing(cid, tp_lewo)
		elseif isInArray({3203,3204}, item.uid) then
			local tp_gora = {x=fromPosition.x, y=fromPosition.y-3, z=fromPosition.z}
			doTeleportThing(cid, tp_gora)
		end
	doCreatureSay(cid, tabeleczka[item.uid], TALKTYPE_ORANGE_1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, tabeleczka[item.uid])
end
return true
end
Do movements.xml wklejamy:
PHP:
<movevent type="StepOut" fromaid="3200" toaid="3205" event="script" value="inq_tp.lua" />
<movevent type="StepOut" fromuid="3200" touid="3205" event="script" value="inq_tp_in.lua" />


Mo?e ma?e wyja?nienia.
W pliku inquisitionPortals.lua wsp??rz?dne oznaczaj? miejsce gdzie znajduje si? CZYSTY teleport posiadaj?cy actionid = 3210
Tak ma wygl?da? sala z bossem. Wsp??rz?dne ustawione w skrypcie odpowiadaj? pozycji teleportu:
1z14uon.png
 
T

Tairens

Guest
Odp: Dzia?aj?ce INQ.

No to tak. P?tla zupe?nie jest niepotrzebna w tym kodzie. Zmie? indeksowanie tablic na nazwy potwor?w, a usprawni to znacznie kod. Do tego:
Code:
if (getCreatureName(cid) == "golgordan") or (getCreatureName(cid) == "latrivan") then
				brat_1 = getCreatureByName("golgordan")
				brat_2 = getCreatureByName("latrivan")
				if (brat_1 == nil) or (brat_2 == nil) then
					doItemSetAttribute(doCreateTeleport(tp_itemid, tp_to, tp_in[i]), "aid", tp_id[i])
					doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
					addEvent(usun_tp, time_to_end * 1000, tp_in[i])
				else
					doCreatureSay(cid, "M?j bracie ide odpoczac", TALKTYPE_ORANGE_1)
				end
Mo?na tak usprawni?:
Code:
if (getCreatureName(cid) == "golgordan") or (getCreatureName(cid) == "latrivan") then
	brat_1 = getCreatureByName("golgordan")
	brat_2 = getCreatureByName("latrivan")
	if (brat_1 ~= nil) or (brat_2 ~= nil) then
		doCreatureSay(cid, "M?j bracie ide odpoczac", TALKTYPE_ORANGE_1)
	end
Ale to nie jest jaki? najlepszy spos?b. Do tego wy?wietlanie czasu we wiadomo?ci powinno by? czytane ze zmiennej. Zmienne brat powinny by? lokalne.Sporo b??d?w.
 

DanJ93

ElfBot Helper
Joined
Jan 18, 2009
Messages
2,631
Reaction score
200
Odp: Dzia?aj?ce INQ.

Jedyne co mi si? przyda?o to:
PHP:
local Nagrody = {x=1867, y=1779, z=14}
function onStepOut(cid, item, pos)
doPlayerSetStorageValue(cid, item.actionid, 1)
local quest_1 = getPlayerStorageValue(cid, 3200)
local quest_2 = getPlayerStorageValue(cid, 3201)
local quest_3 = getPlayerStorageValue(cid, 3202)
local quest_4 = getPlayerStorageValue(cid, 3203)
local quest_5 = getPlayerStorageValue(cid, 3204)
local quest_6 = getPlayerStorageValue(cid, 3205)
if (quest_1 == 1) and (quest_2 == 1) and (quest_3 == 1) and (quest_4 == 1) and (quest_5 == 1) and (quest_6 == 1) and (item.actionid == 3205 )then
doTeleportThing(cid, Nagrody)
else
doPlayerSendTextMessage(cid, 19, "Gratulacje kolejny demon ukorzyl sie przed toba")
end
return 1
end

A to:
PHP:
<movevent type="StepOut" fromaid="3200" toaid="3205" event="script" value="inq_tp.lua" />
<movevent type="StepOut" fromuid="3200" touid="3205" event="script" value="inq_tp_in.lua" />
Chyba mo?e by? te? tak:
PHP:
<movevent type="StepOut" uniqueid="3200;3205" script="inq_tp.lua" />
<movevent type="StepOut" uniqueid="3200;3205" script="inq_tp_in.lua" />
Og?lnie skrypt bardzo d?ugi, ja mam o wiele, wiele kt?rzy w MODS i troch? moveevents
 

kurski

Advanced User
Joined
May 11, 2010
Messages
186
Reaction score
3
Age
30
Odp: Dzia?aj?ce INQ.

Brawo ch?opaki najbardziej tobie gz Oskar :] ja mia?em tw?j kodzik predzej ni? by? on wydany no no :D
Wszystko dzia?a :) hm zastanawiam si? jak zmieni? wygl?d efekt jak si? wejdzie w tp ten ktory jest postawiony jak bos padnie :p
 

Optii

New User
Joined
Jun 4, 2010
Messages
9
Reaction score
0
Odp: Dzia?aj?ce INQ.

Dzi?kuje bardzo za skrypt bardzo mi si? przyda do mojego OTSA !!

Da?bym reputa ale nie mog? . _/ Hail .
 

Seminari Master Kaga

Advanced User
Joined
Jun 16, 2009
Messages
181
Reaction score
6
Odp: Dzia?aj?ce INQ.

No najs, ale s? lepsze scripty ju? w niekt?rych silnikach, ale Tw?j widz? prawie dor?wnuje sasirowskiemu :D

Btw why nie funkcja function onKill(cid, target, lastHit)?
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dzia?aj?ce INQ.

#Tairens
Jak zapewne pami?tasz nie jestem jakim? super skrypterem, ale czytanie z tablic mija si? z celem, chyba, ?e chcesz sztucznie przed?u?y? kod.
Ten skrypt uwa?am za dobrze napisany, ale oczywi?cie mog? si? myli?, Ty tu jeste? najlepszy z nas wszystkich :)

#topic
Wszelkie b??dy, sugestie, propozycje prosz? pisa? do mnie drog? prywatn? b?d? w tym temacie.
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dzia?aj?ce INQ.

Wiem, ?e to odkopanie starego tematu, ale nie warto by?o zak?ada? nowego.
Skrypt zosta? napisany od nowa. Ten dzia?a doskonale.
Wszelkie problemy zg?asza? do mnie.

#edit
Znalaz?em w?a?nie kilka g?upich b??d?w. Poprawi? je po po?udniu. P?ki co nie korzystajcie z tego skryptu.

#edit2
Skrypt poprawiony. Dzia?a bez zarzut?w.
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dzia?aj?ce INQ.

Czy skrypt nikomu si? ju? nie przyda?
Od?wie?am.

#down
Zer?ni?ty z otlandu. Dzi? widzia?em ten skrypt...
 
Last edited:

Ten Typ Mes

New User
Joined
Aug 1, 2010
Messages
1
Reaction score
0
Odp: Dzia?aj?ce INQ.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Inquisition"
version="1.0" author="Tommy" contact="tommycrusher@gmail.com" enabled="yes">
        <event type="login" name="inquisitionRegister" event="script"><![CDATA[
        function onLogin(cid)
    registerCreatureEvent(cid, "Inquisition")
        return true
end]]></event>
    <event type="kill" name="Inquisition" event="script"><![CDATA[
local config = {
    message = "Go into the teleporter in 3 minutes, else it will disappear.",
    timeToRemove = 180, -- seconds
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position
  ["Ushuriel"] = { { x=1173, y=1138, z=12}, { x=1097, y=1214, z=12, stackpos=1 } },
  ["Annihilon"] = { { x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12, stackpos=1 } },
  ["Hellgorak"] = { { x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12, stackpos=1 } },
  ["Madareth"] = { { x=1045, y=1204, z=13}, { x=1111, y=1240, z=12, stackpos=1 } },
  ["Zugurosh"] = { { x=1126, y=1151, z=12 }, { x=1149, y=1213, z=12, stackpos=1 } },
  ["Latrivan"] = { { x=1153, y=1195, z=13}, { x=1147, y=1244, z=12, stackpos=1 } } 
    }
}
local function removal(position)
    if getThingfromPos(position).itemid == config.teleportId then
        doRemoveItem(getThingfromPos(position).uid)
    end
    return TRUE
end
function onKill(cid, target, lastHit)
if lastHit == true then
    local position = getCreaturePosition(target)
    for name, pos in pairs(config.bosses) do
        if name == getCreatureName(target) then
            teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
            doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
            addEvent(removal, config.timeToRemove * 1000, pos[2])
            doSendMagicEffect(pos[2], 10)
        end
    end
end
    return TRUE
end]]></event>
         <action fromuid="1300" touid="1308" event="script"><![CDATA[
       if item.uid == 1300 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found robe of the underworld.")
               doPlayerAddItem(cid,8890,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
       elseif item.uid == 1301 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a  Spellbook of Dark Mysteries.")
               doPlayerAddItem(cid,8918,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
       elseif item.uid == 1302 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Fireborn Giant Armor.")
               doPlayerAddItem(cid,8881,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
        end
       elseif item.uid == 1303 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Master Archer's Armor.")
               doPlayerAddItem(cid,8888,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
      elseif item.uid == 1304 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Royal Crossbow.")
               doPlayerAddItem(cid,8851,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 1305 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Executioner.")
               doPlayerAddItem(cid,7435,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 1306 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a The Stomper.")
               doPlayerAddItem(cid,8929,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 1307 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Runed Sword.")
               doPlayerAddItem(cid,7417,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 1308 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Warsinger Bow.")
               doPlayerAddItem(cid,8854,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 1309 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a spellbook of Lost Souls.")
               doPlayerAddItem(cid,8903,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 13010 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Mystical Armor.")
               doPlayerAddItem(cid,2508,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    elseif item.uid == 13011 then
        queststatus = getPlayerStorageValue(cid,50301)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a Rainbow Shield.")
               doPlayerAddItem(cid,8905,1)
               setPlayerStorageValue(cid,50301,1)
           else
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
           end
    end
       return TRUE]]></action>
</mod>

1 mod i w dodatku dzialajacy lepiej.
 

Scootyy

Senior User
Joined
Jul 26, 2009
Messages
564
Reaction score
12
Age
34
Odp: Dzia?aj?ce INQ.

Mam problem z tym skryptem ;/ mo?e dlatego ?e pr?bowa?em doda? tak, ?eby by? tylko na jednego potwora? M?g?by kto? to obczai?:

set.lua(odpowiednik inquisitionPortals.lua)



creaturescripts.xml
PHP:
	<event type="death" name="Inq" event="script" value="set.lua"/>

fragment potwora o nazwie RA-01 Berderk Faello:

PHP:
...
</flags>
    <script>
<event name="Inq"/> 
</script>  
  <attacks>
...

inq_tp.lua



inq_tp_in.lua



movements.xml

PHP:
	<movevent type="StepOut" fromaid="3200" toaid="3205" event="script" value="inq_tp.lua" />
	<movevent type="StepOut" fromuid="3200" touid="3205" event="script" value="inq_tp_in.lua" />


B??d w konsoli :(

PHP:
[04/08/2010 22:17:02] [Error - CreatureScript Interface] 
[04/08/2010 22:17:02] In a timer event called from: 
[04/08/2010 22:17:02] data/creaturescripts/scripts/set.lua:onDeath
[04/08/2010 22:17:02] Description: 
[04/08/2010 22:17:02] (luaDoItemSetAttribute) Item not found
 

Scootyy

Senior User
Joined
Jul 26, 2009
Messages
564
Reaction score
12
Age
34
Odp: Dzia?aj?ce INQ.

od?wie?am. bardzo prosz? o pomoc
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: Dzia?aj?ce INQ.

Zamiast od?wie?a? i spamowa? napisa?by? na GG, tam wyja?ni? Ci gdzie robisz b??d, a raczej b??dy bo jest ich od groma.
 
Status
Not open for further replies.
Top