• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Rollercoaster System [8.x]

Status
Zamknięty.

Ernie

New User
Dołączył
Sierpień 8, 2008
Posty
5
Liczba reakcji
2
Witam.
Znalaz?em na otland.net ?wietny skrypt w wykonaniu Colex'a.
Jak niekt?rzy pami?taj? kiedy? zosta? stworzony skrypt na samochody w tibii, by? on naprawd? fajny i pomys?owo zrobiony, ten skrypt niby jest podobny, jednak to od tw?rcy OTSa zale?y gdzie zrobi takiego Rollercoastera, a gracze mog? si? na nim bawi?, mo?na by jeszcze zrobi?, ?e trzeba za niego zap?aci?, jednak jak kto chce Smile.

Do data/actions/actions.xml wklejacie t? oto linijk?:

Kod:
<action fromid="7131" toid="7132" script="RollerCoaster.lua"/>

Teraz w data/actions/scripts tworzycie plik o nazwie RollerCoaster.lua i w nim dajecie:

Kod:
dofile('data\\actions\\scripts\\RollerCoasterEvents.lua')

local TRAINS = {7131, 7132}
local all = {7121, 7122, 7123, 7124, 7125, 7126, 7133, 7134, 7135, 7136}

local ACTION_TRAIN = {1001, 1002}

local RAILS = {
{id = all[1], dirs = {{dir = SOUTH, out = 2},{dir = NORTH, out = 2}}},
{id = all[2], dirs = {{dir = EAST, out = 1},{dir = WEST, out = 1}}},
{id = all[3], dirs = {{dir = EAST, out = 1},{dir = SOUTH, out = 2}}},
{id = all[4], dirs = {{dir = WEST, out = 1},{dir = SOUTH, out = 2}}},
{id = all[5], dirs = {{dir = EAST, out = 1},{dir = NORTH, out = 2}}},
{id = all[6], dirs = {{dir = WEST, out = 1},{dir = NORTH, out = 2}}},
{id = all[7], stop = 1},
{id = all[8], stop = 1},
{id = all[9], stop = 1},
{id = all[10], stop = 1},
}

local SLOW = 500
local FAST = 200
local INCREASE = 50
local DECREASE = 50
local DOWN_INCREASE = 450
local UP_DECREASE = 155

local INFOS = {}

TRUE = 1
FALSE = 0


function getRail(pos)
local stack = 1
local found = 0
repeat
pos.stackpos = stack
rail = getThingfromPos(pos)
if (rail.itemid == 0) then break end
for i, r in ipairs(RAILS) do
if (rail.itemid == r.id) then
found = 1
break
end
end
stack = stack + 1
until (found == 1)
return rail
end

function moveTrain(cid)
params = INFOS[cid]
pos = getCreaturePosition(cid)
rail = getRail(pos)
dir = -1
for i,r in ipairs(RAILS) do
if (rail.itemid == r.id) then
if (RollerCoaster:onMove(cid, rail, r, pos) == FALSE) then table.remove(INFOS, cid) return 1 end
if (r.stop ~= nil) then
if (r.stop == 1) then
RollerCoaster:onExitQuery(cid)
addEvent(exitTrain, 2000, cid)
return 1
end
end
change = rail.actionid - 1000
power = 0
power = change

doChangeType(cid, r.id, INFOS[cid].beforeid)
info = r.dirs[INFOS[cid].type]
dir = info.dir
if ((power == 1) or (power == 2)) then
if (RollerCoaster:onChangeSpeed(cid, power) == TRUE) then
if (power == 2) then
INFOS[cid].speed = INFOS[cid].speed - INCREASE
elseif (power == 1) then
INFOS[cid].speed = INFOS[cid].speed + DECREASE
end
end
end
if (INFOS[cid].currZ ~= pos.z) then
if (RollerCoaster:onChangeLevel(cid, INFOS[cid].currZ, pos.z) == TRUE) then
if (INFOS[cid].currZ > pos.z) then
INFOS[cid].speed = INFOS[cid].speed + UP_DECREASE
elseif (params.currZ < pos.z) then
params.speed = params.speed - DOWN_INCREASE
end
end
end
if (params.speed < 1) then params.speed = 1 end
params.currZ = pos.z
newid = TRAINS[info.out]
INFOS[cid].beforeid = r.id
break
end
end
if (dir ~= -1) then
doSetItemOutfit(cid, newid, -1)
doMoveCreature(cid, dir)
addEvent(moveTrain,params.speed,cid)
else
RollerCoaster:onExitQuery(cid)
addEvent(exitTrain, 2000, cid)
end
end

function exitTrain(cid)
table.remove(INFOS, cid)
RollerCoaster:onExit(cid)
doSetItemOutfit(cid, TRAINS[1], 0)
pos = getCreaturePosition(cid)
pos.y = pos.y - 1
doTeleportThing(cid, pos, 1)
mayNotMove(cid, 0)
end

function enterTrain(params)
if (RollerCoaster:onEnter(cid, params[2]) == TRUE) then
doSetItemOutfit(params[1], params[2], -1)
pos = getCreaturePosition(params[1])
table.insert(INFOS, params[1],{type = params.type, speed = SLOW, currZ = pos.z})
addEvent(moveTrain,1000,params[1])
end
end

function getSpeed(cid)
if (INFOS[cid].speed ~= nil) then return INFOS[cid].speed end
return FALSE
end

function setSpeed(cid, speed)
if (INFOS[cid].speed ~= nil) then INFOS[cid].speed = speed return TRUE end
return FALSE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
if (isInArray(ACTION_TRAIN, item.actionid) == TRUE) then
if (RollerCoaster:onEnterQuery(cid, item) == TRUE) then
doTeleportThing(cid, toPosition, 1)
mayNotMove(cid, 1)
addEvent(enterTrain,500,{cid, item.itemid, type=(item.actionid-1000)})
end
end
return TRUE
end


----"No Scripting Needed" System-----
local change = {}
change[all[1]] = {all[3], all[4]}
change[all[2]] = {all[4], all[6]}
change[all[3]] = {all[1], all[4], all[6]}
change[all[4]] = {all[1], all[2], all[3], all[5], all[6]}
change[all[5]] = {all[4]}
change[all[6]] = {all[2], all[3], all[4]}
change[all[7]] = {}
change[all[8]] = {}
change[all[9]] = {}
change[all[10]] = {}

function doChangeType(cid, id, beforeID)
if (table.getn(change[id]) > 0) then
if (isInArray(change[id],beforeID) == TRUE) then
if (INFOS[cid].type == 1) then INFOS[cid].type = 2 else INFOS[cid].type = 1 end
end
end
end

Teraz w data/actions/scripts tworzycie plik o nazwie RollerCoasterEvents.lua i w nim dajecie:

Kod:
RollerCoaster = {}

function RollerCoaster:onChangeLevel(cid, fromZ, toZ)
return TRUE
end

function RollerCoaster:onMove(cid, rail, railInfo, pos)
return TRUE
end

function RollerCoaster:onChangeSpeed(cid, power)
if (power == 2) then
doSendAnimatedText(getCreaturePosition(cid),"TROC TROC",210)
else
doSendAnimatedText(getCreaturePosition(cid),"TSSSIIIIII",210)
end
return TRUE
end

function RollerCoaster:onTypeChange(cid, fromType, toType)
return TRUE
end

function RollerCoaster:onExitQuery(cid)
return TRUE
end

function RollerCoaster:onExit(cid)
return TRUE
end

function RollerCoaster:onEnterQuery(cid, cart)
return TRUE
end

function RollerCoaster:onEnter(cid, cartID)
return TRUE
end


Readme:

Kod:
Script Developed by Colex

[actions.xml]
<action fromid="7131" toid="7132" script="RollerCoaster.lua"/>
[/actions.xml]

[ActionIDs no Trem]
1001 e 1002 -> Train's Actionid, 1001 starts to one side and 1002 starts to the other

[Train Tracks' ActionIDs]
1001 -> Brakes (Decreases the speed)
1002 -> Impeller (Increases the speed)

[Additional Functions That You Can Use in RollerCoasterEvents.lua]
getSpeed(cid)
setSpeed(cid, newSpeed)

[Extra Information]
The RollerCoaster script was developed in a OTServer 8.1
but it's easy to update the IDs to any version just by editing 2 variables:

local TRAINS = {7131, 7132}
local all = {7121, 7122, 7123, 7124, 7125, 7126, 7133, 7134, 7135, 7136}


"local TRAINS" saves the 2 train's id, I think there's no problem on updating that...
"local all" saves the tracks' id, you just have to update it matching those ids with the ids of the version you are using.

Pozdrawiam Ernie

@down
Nie mam 30 post?w

/
zamieniono na
Kod:
[/color][/b]
 
Ostatnio edytowane przez moderatora:
@up
Po:
1. Trzeba by?o zamie?ci? link do tego filmiku z roller coasterem.

2. Jak pisa?e? posta mog?e? wy??czy? emotikony :|.
3. Mog?e? napisa? ,?e chodzi o wagonik i tory, no i ,?e trzeba wpisa? w wagonik action id. i chyba w t? zapore.
4. Mog?e? co? te? wi?cej napisa? ,a nie tylko ctrl + c, ctrl v.

Popraw jak mo?esz bo nie do?wiadczeni u?ytkownicy nie b?d? wiedzie? jak to dzia?a itd...

@topic
Raczej ten roller coaster sys. nie dzia?a na silnikach xml. Testowa?em go na Devland-xml ,ale nie dzia?a;/...
No cu?...
Za sam skrypt dla autora daje 10/10 bo musia? si? ?adnie napracowa?
przy nim.
 
Mateusz7125 ty tylko pisales "Mogles napisac" a moze ty mogles nie napisac tego samego po 2 razy.... :/

BTW dobrze ze chlopak umiescil temat bo moglby ktos to sobie wziac.... a filmik nie jest potrzebny.. wwystarczy ze na skrypt sie popatrzy.... :/Pozatym dal readme.... mozna przeczytac i to sugeruje juz o co chodzi ^^
Jesli chodzi o emotki nie musi wylaczac.... i tak przeciez jak ktos bedzie kopiowal to skopiuje bez emotek wiec problemu nie ma.... :/Gdyby to jeszcze byly rozne emotikonki a sa ciagle te same wiec kazdy moze sie domyslic o co chodzi ;]

#topiczek
Fajny system mialem go troche wczesniej ale jak wczesniej wspomnialem good ze go postnales tutaj ;p Trzeba teraz u mnie odpowiednia mapke zrobic i rollercaster juz jest ^^

#edit
//Down
BTW umiej?* :]
 
Ostatnia edycja:
ivelios nie ka?dy by si? skapczy? o co chodzi ,a filmik jest przydatny.
Angielskiego chyba wszyscy nie umi??? Bo nie kt?rzy nie umi? i przez to mog? by? nie potrzebne posty, takie jak: "Gdzie trzeba wkleji? to, a gdzie to?"
itd...

A jak Ernie zamie?ci? ten skrypt tu na forum to m?g? chocia? napisa? wi?cej szczeg???w a nie tylko ctrl + c, ctrl + v.



ps. Na b-fox te? nie dzia?a... Czemu? ;(

@edit
//2x Down
Raczej tak.
 
Ostatnia edycja:
je?eli dzia?a to ?wietny skrypt! Kiedy? jak by? opublikowany tutaj film wiele os?b chcia?o mie? ten skrypt m.in. ja. Zaraz pobior? i przetestuje. Ju? mam wiele ciekawych pomys??w z nim zwi?zanych :) extra 10/10
 
Bardzo fajnie ?e go tu umie?ci?e? szuka?em tego skryptu.
Mam co do niego pytanko czy b?dzie dzia?a? na TFS-ie????
 
Pozwolenie

Pozwolenie

Super wcze?niej go znalaz?em ale nie wa?ne. Mam pytanie czy dosta?e? pozwolenie od colexa ?e mo?esz go na innym forum wystawia??? W jego regulaminie pisze ?e, wystawienie go na innym forum to przest?pstwo, i trzeba to zg?osi?. Je?li nie dosta?e? pozwolenia nie zostawiasz mi wyboru. :/ Taka jest prawda ja si? przynajmniej zapyta?em. Je?li dosta?e? to spoko i przepraszam.
 
Mam pytanie te actionID 1001 i 1002 to gdzie da?? Z tego co czyata?em to chyba 1001 na wagonik a 1002 na t? zapor? na ko?cu? Prosz? o pomoc
 
Wow :)

Wow :)

W sumie co bardziej pomys?owi wykorzystaj? ten skrypt m.in do questu np.: Dwarfs Mine (Kopalnia Krasnali), gdzie to trzeba b?dzie pokona? labirynt w takiej kolejce ;)
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

Tw?rca m?g? chocia? dorobi? now? grafik? dla tych co by chcieli czyli 2 wersje z now? i normaln?..
Chocia? moim staniem skrypt niepotrzebny na ?adnym ots! chyba tylko dla tych fantastycznych i noobowskich..
Ocena: 7/10.
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

a ten kod z Readme: to gdze to trzeba wkleic??
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

Kurde, musze to za?o?y?! Skrypt 10/10, zrobie kolejke dla PACC, kt?r? mo?na podr??owa? z jednego ko?ca miasta do drugiego lub z miasta do miasta.

@down
Tak,bo na skryptach te? si? znam od 5 miesi?cy.
 
Ostatnia edycja:
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

tom dziala ci ten skrypt??
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

A pod jaka to tibie ??
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

ja pod 8.1 silnik z mapka evolution
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

Ten skrypt jest ?wietny ale strasznie muli ots u mnie zu?ycie procesora wzros?o o ~20% a to wiele. Wystarczy ?e 5 os?b b?dzie jecha?o na raz XD i co wtedy? :D
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

Zapowiada si? ciekawie xD
A czy dzia?? na Stigma ots xml ??
Czekam na odp ;]
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

Skrypt wyj*biaszczy ocenka= 7/10 :) powiesz na jakim silniku to testowa?e? i czy na 7.92 tez zadzia?a ? ? ?
 
Odp: [8.x] Rollercoaster System

Odp: [8.x] Rollercoaster System

:p jak to ma dzia?a?? Zrobi?em all i nic nie da si? wej?? na wagonik. M?g?by kto? poprawi? b??dy i napisa? to porz?dnie? Testowa?em to na dw?ch tfs`ach pod 8.22 i 8.31 i lipa tak samo jak z samochodem w tibi xd
 
Status
Zamknięty.
Do góry