warriorfrog
Active Member
- Joined
- Jul 29, 2015
- Messages
- 334
- Reaction score
- 35
I have a game of throne system, i found in other forum made by: Zipster98
But i need a help to change 2 things
I really need some help... Its much thing to me im trapped in it in 2 weeks, idk what to do now...
1- 1 guild per throne... 1 guild can get only 1 throne (max)...
I've tried:
Changes on movements (tile acess to start enter in castle)...
I added it
Full throne_capturing.lua:
But not work! i think i using worng values
2- A sign(ITEMID: 1429) in front the castles show which guild own the city
I've tried:
creaturescripts.xml
login.lua
GOT/placas.lua
Not work... Errors on console:
FULL Code:
===========================================================
LIBs
===========================================================
/lib/GOTlib.lua
http://hastebin.com/emavetagoc.lua
===========================================================
Monsters
===========================================================
chanceler carlin.xml
http://hastebin.com/piwobonawu.xml
===========================================================
Movemments
===========================================================
throne_capturing.lua
http://hastebin.com/atizibitim.lua
tile_acess_members_of_throne.lua
http://hastebin.com/icolesapel.lua
===========================================================
Creaturescripts
===========================================================
expbonus_got.lua
http://hastebin.com/ogabuyudid.lua
But i need a help to change 2 things
I really need some help... Its much thing to me im trapped in it in 2 weeks, idk what to do now...
1- 1 guild per throne... 1 guild can get only 1 throne (max)...
I've tried:
Changes on movements (tile acess to start enter in castle)...
I added it
Code:
for i=1,8,1 do
local guildId = getGlobalStorageValue(actionid + DEFAULT_STORAGE)
if getPlayerGuildId(cid) == guildId then
doPlayerSendCancel(cid, "Your guild already has a throne dominated! Only one per guild.")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doTeleportThing(cid, fromPosition, true)
return true
end
actionid = actionid + 1
end
Full throne_capturing.lua:
Code:
local config = {
level = 50,
count = 1,
messages = {
[12003] = "[GOT-Kazz]The guild %s is entering the castle.",
[12004] = "[GOT-Kazz]The guild %s is already inside the castle.",
[12005] = "[GOT-Kazz]The guild %s is close to conquer the castle.",
[12006] = "[GOT-Ab]The guild %s is entering the castle.",
[12007] = "[GOT-Ab]The guild %s is already inside the castle.",
[12008] = "[GOT-Ab]The guild %s is close to conquer the castle.",
[12009] = "[GOT-Edron]The guild %s is entering the castle.",
[12010] = "[GOT-Edron]The guild %s is already inside the castle.",
[12011] = "[GOT-Edron]The guild %s is close to conquer the castle.",
[12012] = "[GOT-Ankrahmun]The guild %s is entering the castle.",
[12013] = "[GOT-Ankrahmun]The guild %s is already inside the castle.",
[12014] = "[GOT-Ankrahmun]The guild %s is close to conquer the castle.",
[12015] = "[GOT-Tiquanda]The guild %s is entering the castle.",
[12016] = "[GOT-Tiquanda]The guild %s is already inside the castle.",
[12017] = "[GOT-Tiquanda]The guild %s is close to conquer the castle.",
[12018] = "[GOT-Rookgaard]The guild %s is entering the castle.",
[12019] = "[GOT-Rookgaard]The guild %s is already inside the castle.",
[12020] = "[GOT-Rookgaard]The guild %s is close to conquer the castle.",
[12021] = "[GOT-Okolnir]The guild %s is entering the castle.",
[12022] = "[GOT-Okolnir]The guild %s is already inside the castle.",
[12023] = "[GOT-Okolnir]The guild %s is close to conquer the castle.",
[12000] = "[GOT-Carlin]The guild %s is entering the castle.",
[12001] = "[GOT-Carlin]The guild %s is already inside the castle.",
[12002] = "[GOT-Carlin]The guild %s is close to conquer the castle."
},
actionId = {12000, 12023, 4819}
}
function tableInsert(table, value)
-- technically this doesn't need to be #table + 1, it can just be #table
table[#table + 1] = value
end
function onStepIn(cid, item, position, fromPosition)
local pid, ip = {}, {} -- now they will hold the values generated by get getGuildOnlineMembers
local function getGuildOnlineMembers(guildId)
for _, cid in pairs(getPlayersOnline()) do
if getPlayerGuildId(cid) == guildId and getPlayerLevel(cid) >= config.level and not isInArray(ip, getPlayerIp(cid)) then
tableInsert(pid, cid)
tableInsert(ip, getPlayerIp(cid))
end
end
return pid
end
if not isPlayer(cid) then
return true
end
if (item.actionid >= config.actionId[1] and item.actionid <= config.actionId[2]) then
-- check if have players online (necessary)
if getPlayerGuildId(cid) < 1 or #getGuildOnlineMembers(getPlayerGuildId(cid)) < config.count then
doPlayerSendCancel(cid, "You need to be on guild or your guild must have at least "..config.count.." players level "..config.level.." or more.")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doTeleportThing(cid, fromPosition, true)
return true
end
-- check if have a throne owned
actionid = 2391
default_storage = 49198
for i=1,8,1 do
local guildId = getGlobalStorageValue(actionid + DEFAULT_STORAGE)
if getPlayerGuildId(cid) == guildId then
doPlayerSendCancel(cid, "Your guild already has a throne dominated! Only one per guild.")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doTeleportThing(cid, fromPosition, true)
return true
end
actionid = actionid + 1
end
end
if getGlobalStorageValue(item.actionid + config.actionId[3]) < os.time() then
broadcastMessage(config.messages[item.actionid]:format(getPlayerGuildName(cid)))
setGlobalStorageValue(item.actionid + config.actionId[3], os.time() + 60)
end
doCreatureSetSkullType(cid, 3)
return true
end
But not work! i think i using worng values
2- A sign(ITEMID: 1429) in front the castles show which guild own the city
I've tried:
creaturescripts.xml
Code:
<event type="look" name="got_placas" event="script" value="GOT/placas.lua"/>
login.lua
Code:
registerCreatureEvent(cid, "got_placas")
GOT/placas.lua
Code:
function onLook(cid, thing, position, lookDistance)
if (item.actionid == 3391) then
local guildName = getGuildName(getGlobalStorageValue(2391 + DEFAULT_STORAGE))
doPlayerSetSpecialDescription(item.actionid, "Carlin throne dominated by guild: " .. guildName .. " .")
end
return true
end
Not work... Errors on console:
Code:
[4:30:59.534] [Error - CreatureScript Interface]
[4:30:59.534] data/creaturescripts/scripts/GOT/placas.lua:onLook
[4:30:59.534] Description:
[4:30:59.534] data/creaturescripts/scripts/GOT/placas.lua:2: attempt to index global 'item' (a nil value)
[4:30:59.534] stack traceback:
[4:30:59.534] data/creaturescripts/scripts/GOT/placas.lua:2: in function <data/creaturescripts/scripts/GOT/placas.lua:1>
FULL Code:
===========================================================
LIBs
===========================================================
/lib/GOTlib.lua
http://hastebin.com/emavetagoc.lua
===========================================================
Monsters
===========================================================
Code:
<monstername="Chanceler Carlin"file="GOT/chanceler carlin.xml"/>
chanceler carlin.xml
http://hastebin.com/piwobonawu.xml
===========================================================
Movemments
===========================================================
Code:
<movevent type="StepIn" actionid="12000-12100" event="script" value="GOT/throne_capturing.lua"/>
<movevent type="StepIn" actionid="2391-2398" event="script" value="GOT/tile_acess_members_of_throne.lua"/>
throne_capturing.lua
http://hastebin.com/atizibitim.lua
tile_acess_members_of_throne.lua
http://hastebin.com/icolesapel.lua
===========================================================
Creaturescripts
===========================================================
Code:
<!-- Guild own throne +25%de exp -->
<event type="death" name="mDeath" event="script" value="GOT/expbonus_got.lua"/>
<event type="statschange" name="mStatsChange" event="script" value="GOT/expbonus_got.lua"/>
<event type="target" name="mTarget" event="script" value="GOT/expbonus_got.lua"/>
<event type="login" name="mLogin" event="script" value="GOT/expbonus_got.lua"/>
expbonus_got.lua
http://hastebin.com/ogabuyudid.lua