• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Game] Scripters Battle

Dont let this post die x.x Lets start a new one.. someone spit ball an idea.. il run with it.

Code:
local text ="The Gates of Hell have been opened."

function onUse(cid, item, frompos, item2, topos)

     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
     return TRUE
end
 
I'll try to jump in later if it ever goes back to 1.0+ because I don't know the older functions like that, and I don't have much time right now....
 
If someone could post a link or post the TFS 1.0 functions I could just convert them before I post them :))

Heres this.. ran a macro in my luascript
Code:
getOTSYSTime()
getConfigValue(key)
getPlayerFood(cid)
getPlayerMana(cid)
getPlayerMaxMana(cid)
getPlayerLevel(cid)
getPlayerMagLevel(cid)
getPlayerAccess(cid)
getPlayerSkill(cid, skillid)
getPlayerMasterPos(cid)
getPlayerTown(cid)
getPlayerVocation(cid)
getPlayerItemCount(cid, itemid, subtype)
getPlayerSoul(cid)
getPlayerFreeCap(cid)
getPlayerIp()
getCreatureLight(cid)
getCreatureLookDir(cid)
getPlayerSlotItem(cid, slot)
getPlayerItemById(cid, deepSearch, itemId, <optional> subType)
getPlayerDepotItems(cid, depotid)
getPlayerGuildId(cid)
getPlayerGuildName(cid)
getPlayerGuildRank(cid)
getPlayerGuildNick(cid)
getPlayerGuildLevel(cid)
getPlayerSex(cid)
getPlayerGUID(cid)
getPlayerNameByGUID(guid)
getPlayerFlagValue(cid, flag)
getPlayerLossPercent(cid, lossType)
getPlayerPremiumDays(cid)
getPlayerSkullType(cid, <optional> viewer)
setPlayerSkullType(cid, skull_type)
getPlayerSkullEndTime(cid)
getPlayerUnjustKills(cid)
getPlayerAccountBalance(cid)
getPlayerByNameWildcard(name)
playerLearnInstantSpell(cid, name)
canPlayerLearnInstantSpell(cid, name)
getPlayerLearnedInstantSpell(cid, name)
getPlayerInstantSpellInfo(cid, index)
getPlayerInstantSpellCount(cid)
getInstantSpellInfoByName(cid, name)
getInstantSpellWords(name)
getPlayerStorageValue(cid, valueid)
setPlayerStorageValue(cid, valueid, newvalue)
doErasePlayerStorageValue(cid, valueid)
isPremium(cid)
getPlayerLastLogin(cid)
getGlobalStorageValue(valueid)
setGlobalStorageValue(valueid, newvalue)
doEraseGlobalStorageValue(valueid)
doErasePlayerStorageValueByName(name, key)
setPlayerStorageValueByName(name, key, newValue)
getPlayerStorageValueByName(name, key)
getTilePzInfo(pos)
getItemRWInfo(uid)
getThingDefaultDescription(uid, lookDistance, <optional> canSeeXRay)
getItemTypeDefaultDescription(itemid, <optional> count)
getItemSpecialDescription(uid)
getThingFromPos(pos)
getThing(uid)
queryTileAddThing(uid, pos, <optional> flags)
getThingPos(uid)
getTileStackItemsSize(pos)
getTileItemById(pos, itemId, <optional> subType)
getTileItemByType(pos, type)
getTileThingByPos(pos)
getTileThingByTopOrder(pos, topOrder)
getTopCreature(pos)
getAllCreatures(pos, <optional> flag)
getWaypointPositionByName(name)
doRemoveItem(uid, <optional> count)
doPlayerFeed(cid, food)
doPlayerSendCancel(cid, text)
doPlayerSendDefaultCancel(cid, ReturnValue)
doPlayerSetIdleTime(cid, time, warned)
doTeleportThing(uid, newpos)
doTransformItem(uid, toitemid, <optional> count/subtype)
doCreatureSay(cid, text, type)
doSendMagicEffect(pos, type[, player])
doSendDistanceShoot(frompos, topos, type)
doChangeTypeItem(uid, newtype)
doSetItemActionId(uid, actionid)
doSetItemText(uid, text)
doSetItemSpecialDescription(uid, desc)
doSendAnimatedText(pos, text, color)
doPlayerAddInFightTicks(cid, ticks, <optional: default: 0> pzLock)
doPlayerAddSkillTry(cid, skillid, n, <optional: default: 0> useMultiplier)
doPlayerAddManaSpent(cid, mana, <optional: default: 0> useMultiplier)
doCreatureAddHealth(cid, health, <optional: default: 1> filter))
doPlayerAddMana(cid, mana, <optional: default: 1> withoutAnimation)
doPlayerAddSoul(cid, soul)
doPlayerAddItem(uid, itemid, <optional: default: 1> count/subtype)
oPlayerAddItem(cid, itemid, <optional: default: 1> count, <optional: default: 1> canDropOnMap, <optional: default: 1>subtype)
eturns uid of the created item
doPlayerAddItemEx(cid, uid, <optional: default: 0> canDropOnMap, <optional> slot)
doPlayerSendTextMessage(cid, MessageClasses, message)
doPlayerRemoveMoney(cid, money)
doPlayerAddMoney(cid, money)
doPlayerWithdrawMoney(cid, money)
doPlayerDepositMoney(cid, money)
doPlayerTransferMoneyTo(cid, target, money)
doShowTextWindow(cid, maxlen, canWrite)
doShowTextDialog(cid, itemid, text)
getTownIdByName(townName)
getTownNameById(townId)
getTownTemplePosition(townId)
doDecayItem(uid)
doCreateItem(itemid, <optional> type/count, pos)
eturns uid of the created item, only works on tiles.
doCreateItemEx(itemid, <optional> count/subtype)
doTileAddItemEx(pos, uid)
doAddContainerItemEx(uid, virtuid)
doRelocate(pos, posTo, <optional: default: false> moveUnmoveable, <optional: default: 0> maxAmount)
doCreateTeleport(teleportID, positionToGo, createPosition)
doSummonCreature(name, pos, <optional> extendedPosition, <optional> forceSpawn)
doPlayerSummonCreature(cid, name, pos, <optional> extendedPosition, <optional> forceSpawn)
doRemoveCreature(cid)
doMoveCreature(cid, direction, <optional>flags)
doSetCreatureDirection(cid, direction)
doPlayerSetMasterPos(cid, pos)
doPlayerSetTown(cid, townid)
doPlayerSetVocation(cid, voc)
doPlayerSetSex(cid, sex)
doPlayerRemoveItem(cid, itemid, count, <optional> subtype, <optional> ignoreEquipped)
doPlayerAddExp(cid, exp, <optional: default: 0> useRate, <optional: default: 0> useMultiplier)
doPlayerRemoveExp(cid, exp, <optional: default: 0> useRate, <optional: default: 0> useMultiplier)
getPlayerExperience(cid)
doPlayerSetGuildRank(cid, rank)
doPlayerSetGuildNick(cid, nick)
doSetCreatureLight(cid, lightLevel, lightColor, time)
doPlayerSetLossPercent(cid, lossType, newPercent)
doSetCreatureDropLoot(cid, doDrop)
isValidUID(uid)
isCreatureImmuneToCondition(cid, conditionType)
isCreature(cid)
isItemTwoHandedByUID(uid)
isItemTwoHanded(uid)
isContainer(uid)
isCorpse(uid)
isMoveable(uid)
getPlayerGUIDByName(name)
registerCreatureEvent(uid, eventName)
getContainerSize(uid)
getContainerCap(uid)
getContainerItem(uid, slot)
doAddContainerItem(uid, itemid, <optional> count/subtype)
getDepotId(uid)
getHouseOwner(houseid)
getHouseName(houseid)
getHouseEntry(houseid)
getHouseRent(houseid)
getHouseTown(houseid)
getHouseAccessList(houseid, listid)
getHouseByPlayerGUID(playerGUID)
getHouseTilesSize(houseid)
getHouseDoorCount(houseid)
getHouseBedCount(houseid)
isHouseGuildHall(houseid)
setHouseAccessList(houseid, listid, listtext)
setHouseOwner(houseid, ownerGUID)
getHouseList(townid)
cleanHouse(houseid)
getWorldType()
getWorldTime()
getWorldLight()
getWorldCreatures(type)
getWorldUpTime()
getPlayersOnlineList()
doPlayerBroadcastMessage(cid, message)
getGuildId(guild_name)
createCombatArea( {area}, <optional> {extArea} )
createConditionObject(type)
setCombatArea(combat, area)
setCombatCondition(combat, condition)
setCombatParam(combat, key, value)
setConditionParam(condition, key, value)
addDamageCondition(condition, rounds, time, value)
addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
setCombatCallBack(combat, key, function_name)
setCombatFormula(combat, type, mina, minb, maxa, maxb)
setConditionFormula(combat, mina, minb, maxa, maxb)
doCombat(cid, combat, param)
createCombatObject()
doAreaCombatHealth(cid, type, pos, area, min, max, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
doAreaCombatMana(cid, pos, area, min, max, effect)
doTargetCombatMana(cid, target, min, max, effect)
doAreaCombatCondition(cid, pos, area, condition, effect)
doTargetCombatCondition(cid, target, condition, effect)
doAreaCombatDispel(cid, pos, area, type, effect)
doTargetCombatDispel(cid, target, type, effect)
doChallengeCreature(cid, target)
doConvinceCreature(cid, target)
getMonsterTargetList(cid)
getMonsterFriendList(cid)
doSetMonsterTarget(cid, target)
doMonsterChangeTarget(cid)
doAddCondition(cid, condition)
doRemoveCondition(cid, type, <optional> subId)
numberToVariant(number)
stringToVariant(string)
positionToVariant(pos)
targetPositionToVariant(pos)
variantToNumber(var)
variantToString(var)
variantToPosition(var)
doChangeSpeed(cid, delta)
doCreatureChangeOutfit(cid, outfit)
doSetMonsterOutfit(cid, name, time)
doSetItemOutfit(cid, item, time)
doSetCreatureOutfit(cid, outfit, time)
getCreatureOutfit(cid)
getCreaturePosition(cid)
getCreatureName(cid)
getCreatureSpeed(cid)
getCreatureBaseSpeed(cid)
getCreatureTarget(cid)
getCreatureHealth(cid)
getCreatureMaxHealth(cid)
getCreatureByName(name)
getCreatureMaster(cid)
getCreatureSummons(cid)
getSpectators(centerPos, rangex, rangey, multifloor)
getPartyMembers(cid)
hasCondition(cid, conditionid)
hasProperty(uid)
isItemStackable(itemid)
isItemRune(itemid)
isItemDoor(itemid)
isItemContainer(itemid)
isItemFluidContainer(itemid)
isItemMoveable(itemid)
getItemName(itemid)
getItemDescriptions(itemid)
getItemWeight(uid)
getItemIdByName(name)
isSightClear(fromPos, toPos, floorCheck)
getFluidSourceType(type)
isIntegerInArray(array, value)
addEvent(callback, delay, ...)
stopEvent(eventid)
getPlayerByAccountNumber(account)
getPlayerAccountId(cid)
getAccountNumberByPlayerName(name)
getIPByPlayerName(name)
getPlayersByIPNumber(ip)
getDataDir()
doPlayerSetRate(cid, type, value)
doPlayerSetVipLimit(cid, quantity)
doPlayerSetDepotLimit(cid, quantity)
isPzLocked(cid)
doSaveServer(payHouses)
doSetGameState(gameState)
doReloadInfo(info)
doRefreshMap()
debugPrint(text)
isMonsterName(name)
isValidItemId(itemid)
isNpcName(name)
getMonsterParameter(name, key)
getNpcParameterByName(name, key)
getItemWeaponType(itemid)
getItemAttack(itemid)
getItemDefense(itemid)
getItemExtraDef(itemid)
getItemArmor(itemid)
getItemWeaponTypeByUID(uid)
getItemAttackByUID(uid)
getItemDefenseByUID(uid)
getItemExtraDefByUID(uid)
getItemArmor(uid)
db table
result table
isGmInvisible(cid)
doPlayerToogleGmInvisible(cid)
doPlayerAddPremiumDays(cid, days)
doPlayerRemovePremiumDays(cid, days)
getFirstItemFromInventory(cid, id/name, <optional> reportError)
getCreatureConditionInfo(cid, conditionType, <optional: default: 0> subId, <optional: default: CONDITIONID_DEFAULT> conditionId)
getCreatureCondition(cid, conditionType, <optional: default: 0> subId, <optional: default: CONDITIONID_DEFAULT> conditionId)
getPlayerModes(cid)
doSavePlayer(cid)
 
Wiki for TFS 1.0+, check the menus to the right:
https://github.com/otland/forgottenserver/wiki

Code:
function Player:onGainExperience(source, exp, rawExp)
    local bonusExpConfig = {
        bonus = 1.5,
        chance = 10
    }

    if math.random(100) <= bonusExpConfig.chance then
        self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You gained another " .. exp * bonusExpConfig.bonus - exp .. " bonus experience points!")
        return exp * bonusExpConfig.bonus
    end

    return exp
end
 
The only reason this thread isn't super-active is the TFS 1.0 vs older distro scripting issues.

Which is kind of sad :( its a great idea for a forum game.
 
Do you guys accept npcs scripts? :p
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local config = {
    Storage = 1858,

}
local MSGS = {
    [0] = {
            Gmsg = "Hi there, are you the one who will {improve} this script?",
            Nmsg = "Oh did you improve this?",
    },
    [1] = {
            Gmsg = "OH the script got improved!",
            Nmsg = "Well someone else gotta continue!",
    },
}
local function greetCallback(cid)
    local player = Player(cid)
    local x = player:getStorageValue(Config.Storage)

        npcHandler:setMessage(MESSAGE_GREET, MSGS[x].Gmsg)
    end
    return true
end


local function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
    local x = player:getStorageValue(Config.Storage)

    if not npcHandler:isFocused(cid) then
        return false
    elseif(msgcontains(msg, "improve") and x == 0 and npcHandler.topic[cid] == 0) then
        npcHandler:say(MSGS[x].Nmsg , cid)
        npcHandler.topic[cid] = 1
    elseif(msgcontains(msg, "yes") and x == 0 and npcHandler.topic[cid] == 1) then   
        npcHandler:say(MSGS[x].Nmsg, cid)
        player:setStorageValue(config.Storage, x+1)
    elseif(msgcontains(msg, "no") and x == 0 and npcHandler.topic[cid] == 1) then               
        npcHandler:say("To bad.", cid)       
    end
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Here are the 'rules':
Someone must start from the simplest script possible, like sending an animated text for example.
Then we try to add or improve the script, until we eventually get something amazing.
We can repeat this process as many times as we can, so it can't get boring!
If you think that a script is good enough you can just write stop, and then begin another or let someone begin another.
But anyone can continue even after the stop, until someone posts another 'simple' script.
 
Code:
function Player:onGainExperience(source, exp, rawExp)
    local bonusExpConfig = {
        vip=1000,
        bonus = 1.5,
        chance = 10
    }
if player:getStorageValue(bonusExpConfig.vip)==1 then -- if player is vip
    if math.random(100) <= bonusExpConfig.chance then
        self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You gained another " .. exp * bonusExpConfig.bonus - exp .. " bonus experience points!")

        return exp * bonusExpConfig.bonus
         end
    end

    return exp
end
 
Why not create another thread, one for older style scripters and one for new.
 
Back
Top