yrpen

Members
  • Content count

    193
  • Joined

  • Last visited

1 Follower

About yrpen

  • Rank
    Full Member

Profile Information

  • Gender
  1. Where are old lua scripts?
  2. .
  3. "otserv trunk" is on branch "legancy" or "legancy-dev" ?
  4. 1. In PyOT exist actionId, addEvent? 2. How put creature? (I'm not sure it's corect in my script) 3. I commented part with action id 4. Feel free to correct me 5. Based on OTServ script OPENED_HOLE = {294, 383, 392, 469, 470, 482, 484, 485, 489, 7933, 7938, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8323, 8380, 8567, 8585, 8972} CLOSED_HOLE = {468, 481, 483, 7932, 8579} shovels = 2554, 5710 TILE_SAND = 9059 ITEM_SCARAB_COIN = 2159 TUMB_ENTRANCE = 1345 SCARAB_TILE = 101 MUD_HOLE = 489 SCARAB_COIN_TILE = 102 duration = 5*60000 #5 minutes @register("useWith", shovels) def useShovel(creature, position, onThing, onPosition, **k): if onThing.itemId in CLOSED_HOLE: if onThing.itemId == 8579: onThing.transform(8585, onPosition) else: onThing.transform(onThing.itemId +1, onPosition) elif onThing.itemId == TILE_SAND: #there is actionId? pass ''' if onThing.actionId == TUMB_ENTRANCE: if random.randint(1, 5) == 1: onThing.transform(MUD_HOLE, onPosition) #addEvent - > transform back after 5 min if onThing.actionId != 0: #set actionId onThing.actionId = TUMB_ENTRANCE elif onThing.actionId == SCARAB_TILE: if random.randint(1, 20) == 1: #correct? placeCreature(Creature("Scarab", onPosition), onPosition) onThing.actionId = SCARAB_TILE + 2 elif onThing.actionId == SCARAB_COIN_TILE: if random.randint(1, 20) == 1: placeItem(Item(ITEM_SCARAB_COIN, 1), onPosition) onThing.actionId = SCARAB_COIN_TILE + 2 elif onThing.actionId == SCARAB_TILE + 2: if random.randint(1, 40) == 1: onThing.actionId = SCARAB_TILE elif onThing.actionId == SCARAB_COIN_TILE + 2: if random.randint(1, 40) == 1: onThing.actionId = SCARAB_COIN_TILE ''' else: return False onThing.decay(onPosition) return True
  5. rope.py if onThing in ropeSpots: #it should be onThing.itemId ?
  6. It's correct? If no, then I'll be greatfull for suggestions ITEM_PRE_WHEAT = 2739 ITEM_WHEAT = 2737 ITEM_BUNCH_WHEAT = 2694 ITEM_PRE_SUGAR_CANE = 5471 ITEM_SUGAR_CANE = 5463 ITEM_BUNCH_SUGAR_CANE = 5467 def onUse(creature, thing, position, onThing, onPosition, **k): if onPosition == 0xFFFF: creature.notPossible() return if onThing.itemId == ITEM_PRE_WHEAT: onThing.transform(ITEM_WHEAT) placeItem(Item(ITEM_BUNCH_WHEAT, 1), onPosition) elif onThing.itemId == ITEM_PRE_SUGAR_CANE: onThing.transform(ITEM_SUGAR_CANE) placeItem(Item(ITEM_BUNCH_SUGAR_CANE, 1), onPosition) else: return onThing.decay(onPosition) I'm beginner in python PS: File: "fishing.py" don't have line "@register" it's correct?
  7. Thanks a lot. Now I'll try learn meta tables using and editing your class. #EDIT# BTW it should be there: http://otfans.net/forums/349-Useful-Lua-Functions
  8. It isn't possible using lua. You need C++ code.
  9. Try this local rebirthConfig = { [27] = {1, 2, 5, 6, 9, 10, 13, 14, 22, 23}, -- mage [28] = {3, 7, 11, 15, 16, 21}, -- paladin [29] = {4, 8, 12, 17, 18, 19, 20, 24, 25, 26}, -- knight and otherJobs rebirthTxt = "You have now been reborn.", maxLvl = 100000, --the level when the player gets rebirthed rebirthLevel = 8 -- the level you become after you rebirth } function onSay(cid, words, param) local lvl = getPlayerLevel(cid) --the current player level local health = getCreatureMaxHealth(cid) local mana = getCreatureMaxMana(cid) local job = getPlayerVocation(cid) local reborn = false if lvl >= rebirthConfig.maxLvl then -- if current level is greater than or equal to required level to rebirth doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are now rebirthed!") -- sends message to player doPlayerAddLevel(cid, -(lvl - rebirthConfig.rebirthLevel), true) -- resets level to rebirth level setCreatureMaxHealth(cid, health) -- set hp to what it was before rebirth setCreatureMaxMana(cid, mana) -- set mp to what it was before rebirth for newVocation, vocationTable in ipairs(rebirthConfig) do if isInArray(vocationTable, job) then doPlayerSetVocation(cid, newVocation) -- rebirth mage doPlayerSendTextMessage(cid, 22, rebirthConfig.rebirthTxt) reborn = true break end end if not reborn then doPlayerSetVocation(cid, getPlayerVocation(cid)+4) -- rebirth again end else doPlayerSendTextMessage(cid, 22, "You require level " .. rebirthConfig.maxLvl .. " to be rebirth.") doSendMagicEffect(getPlayerPosition(cid),2) end return true end BTW: If any value is constans, then don't declare it inside function
  10. Look inside sources. Sth like movement.cpp