What's new

Welcome!

Some Scripts Suggestions

Zifoo

New member
Joined
Jan 7, 2011
Messages
620
Reaction score
162
Location
Brazil
Well, I was not me who made these scripts, I'm not sure if it works, but they seem very interesting for me and I think it would be nice in the game.

Nome: Advanced Auction House v1.0
designer: josejunior23

Comandos:
PHP:
!auction-sell itemname, ammount, price - to add an item on the list
!auction-buy OfferID - to buy an item by OfferID
!auction-find itemname - search for offers
!auction-del OfferID - to delete an offer
!auction-info OfferID - to show info about OfferID
!auction-list - show a ful
!auction-list PLAYER_NAME - mostra uma lista com os items de PLAYER_NAME
!auction-cmd - shows a list of all commands.
!auction-clean - delete all the offers of the same day who use (access 3+)
!auction-clean 01/01/11 - delete all offers with the date 01/01/11 that you can change(access 3+)
!auction-balance - see how much money you have in your Auction-house
!auction-withdraw - to get your money.
Info:
Informações:
- Items are stored in a file. Txt and not in a database.
- The items are stored like this:
01/01/11 3031 2000 10 2
data,item,price,amount,guid do player

1º - creates a file XML folder called mods ADVANCED-AUCTION-HOUSE, and puts it inside:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="ADVANCED AUCTION HOUSE" version="1.0" author="josejunior23" contact="x1zy@hotmail.com" enabled="yes">
    <talkaction words="!auction-sell;!auction-buy;!auction-list;!auction-info;!auction-del;!auction-cmd;!auction;!auction-find;!auction-clean;!auction-withdraw;!auction-balance" case-sensitive="yes" event="script" value="AAH.lua"/>
    <globalevent name="aution_check" time="00:01" event="script" value="AAH.lua"/>
</mod>
guarde e pronto.

2º - make a file .LUA on foler mods/scripts called AAH, and put it inside:
http://pastebin.com/17CGHTN3

3º - make a file .txt on the folde of your server(.exe), name it as houseItems, who had been -> houseItems.txt


only for the owner
4º -on folder htdocs of your site, make a file called auction-house.php and make it:
http://pastebin.com/tH7Z6KDT


5º On index.php under:
PHP:
case "latestnews":
                $topic = "Latest News";
                $subtopic = "latestnews";
                include("latestnews.php");
        break;
You Make
PHP:
  case "auctionhouse":
                $topic = "Auction-House";
                $subtopic = "auctionhouse";
                include("auction-house.php");
        break;

6º On htdocs/layouts/SEU TEMA/layout.php
You have to add an option of auction-house, exemple:
PHP:
<li class="level1 item7"><a href="?subtopic=highscores" class="level1 item7"><span>Highscores</span></a></li>
<li class="level1 item7"><a href="?subtopic=guilds" class="level1 item7"><span>Guilds</span></a></li>

<li class="level1 item7"><a href="?subtopic=auctionhouse" class="level1 item7"><span>Auction-House</span></a></li>
info1vs.png
info2r.png

listp.png
listyo.png

selll.png

auctionu.png


I'll post some more scripts in another post..
 

Zifoo

New member
Joined
Jan 7, 2011
Messages
620
Reaction score
162
Location
Brazil
Rain System
http://forums.otserv.com.br/showthread.php?138893-Rain-System

Script
PHP:
function onThink(interval, lastExecution)
	local minX = 0
	local minY = 0
	local maxX = 120
	local maxY = 150

	local frompos = {x=math.random(minX, maxX), y=math.random(minY, maxY), z=7}
	local topos = {x=math.random(frompos.x, maxX), y=math.random(frompos.y, maxY), z=7}

	local effects = {
		snow = {
			disteffect = CONST_ANI_SNOWBALL,
			effect = CONST_ME_ICETORNADO
		},
		rain = {
			disteffect = CONST_ANI_ICE,
			effect = CONST_ME_LOSEENERGY
		}
	}
	random = math.random(0, 10)
	if (random == 0) then
		rain.chance = math.random(10,50)
		rain:start({fromPos = frompos, toPos = topos}, effects.snow, 300, math.random(100, 500))
	else
		rain.chance = math.random(20,100)
		rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}
		rain:start({fromPos = frompos, toPos = topos}, effects.rain, math.random(100, 1000), math.random(100, 350))
	end
	return TRUE
end

Lib
PHP:
-- Features:
	-- chance = OBJECT.chance = INT
	-- createItem = OBJECT.createItem = {chance = INT, item = {itemid = INT, type = INT}}


Rain = {ignoreIds = {4526}}

function Rain:new()
    local obj = {}
    setmetatable(obj, self)
    self.__index = self
	return obj
end
function Rain:getPositionInArea(fromPos, toPos)
	self.positions = {}
	for Y = fromPos.y, toPos.y do
		for X = fromPos.x, toPos.x do
			if (getTileThingByPos({x=X, y=Y, z=7, stackpos=0}).itemid ~= 0) then
				if not (string.match(string.lower(getItemNameById(getTileThingByPos({x=X, y=Y, z=7, stackpos=0}).itemid)), "water")) then
					table.insert(self.positions, {x=X, y=Y, z=Z})
				end
			end
		end
	end
	return true
end

function Rain:doRain(position, disteffect, effect)
	if (self.duraction ~= self.executed) then
		local chance = self.chance or 100
		if (math.random(0, 1000) <= chance) then
			for Z = 0, 7 do
				if (getTileThingByPos(({x = position.x, y = position.y, z = Z})).itemid ~= 0) then
					doSendDistanceShoot({x = position.x - 7, y = position.y - 5, z = Z}, {x = position.x, y = position.y, z = Z}, disteffect)
					doSendMagicEffect({x = position.x, y = position.y, z = Z}, effect)
					if (self.createItem) then
						if (math.random(0, 1000) <= self.createItem.chance) then
							if (isInArray(self.ignoreIds, getTileThingByPos({x=X, y=Y, z=Z, stackpos=0}).itemid) == FALSE) then
								local item = doCreateItem(self.createItem.item.itemid, self.createItem.item.type, {x=position.x, y=position.y, z=Z})
								doDecayItem(item)
							end
						end
					end
					break
				end
			end
		end
		return true
	else
		return false
	end
end

function Rain:start(positions, effects, duraction, delay, var)
	self:getPositionInArea(positions.fromPos, positions.toPos)
	if not (self.positions[1]) then
		return false
	end
	self.delay = delay
	self.var = var or self
	self.effects = effects
	self.duraction = duraction
	self.executed = 0
	addEvent(doCallback, self.delay, {var=self.var})
	return true
end

function doCallback(p)
	for _, v in pairs(p.var.positions) do
		if not (p.var:doRain(v, p.var.effects.disteffect, p.var.effects.effect)) then
			return true
		end
	end
	addEvent(doCallback, p.var.delay, {var=p.var})
	p.var.executed = p.var.executed+1
end
installation: first, place the lib on the folder "data/globalevents/lib/" and save it as Rain.lua and put the script inside of "data/globalevents/script/", save it as rain.lua. You will need to add two tags for the script to work in a file"data/globalevents/lib/globalevents.lua" and another in the file "data/globalevents/globalevents.xml".

globalevents.lua
PHP:
dofile(getDataDir() .."globalevents/lib/Rain.lua")
globalevents.xml
PHP:
<globalevent name="rain" interval="200" event="script" value="rain.lua"/>

Setting:The script does not need many settings, just change the variables as you like:
PHP:
        local minX = 0
	local minY = 0
	local maxX = 120
	local maxY = 150

Well this setting changes only the position of the rains, if you want to change the density of rain change the line rain.chance = math.random(20,100)

Guide
PHP:
positions -> will be a table with two positions called fromPos e toPos. Exemplo : {fromPos = {x=10, y=10, z=7}, toPos={x=20, y=20, z=7}
effects -> will be a table with the effects on the ground and sending top-down. Exemplo: rain = {disteffect = CONST_ANI_ICE, effect = CONST_ME_LOSEENERGY }
duraction -> is the number of times that will "rain", or drop effects, thus the duration of the rain. Exemplo: 100
delay -> is the time difference of each raindrop influences the density of rain, remembering that also have the chance variable.

To make more intense rainfall and decrease the delay and increase the chance duraction, the weaker the reverse. To increase the rain delay last longer and duraction. It is also possible that the script create "pools of water" that is configured on the line: rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}.
For those who know how to use the script you can make it rain meteors changing effects and many other things to your imagination.
To change as long as the rain will change events should the tag of globalevents.xml part of the interval.


[img]http://img291.imageshack.us/img291/338/raind.jpg[/img]



EDITING..
 
Last edited:

Zifoo

New member
Joined
Jan 7, 2011
Messages
620
Reaction score
162
Location
Brazil
By Mock

Communication between two servers.
you need three things:
1- TFS 0.3.1+
2- Having two or more servers MySql they both do not need to be put on the same pc but they MUST be using the same server MySql.

1º perform the function setLibTables() so that all the necessary tables to work
2ºopen the 2 folders of your servers
on both folders globalevents and both global events add this tag:
PHP:
<globalevent name="start" interval="1" script="comunication.lua"/>

Make it Bluel as server 1, red as server 2 and pink both.
At server 1 go on globalevents at scripts make a comunication.lua, inside of it:
PHP:
function onThink(interval, lastExecution)
    local a,b = readBuffer(2)
    if a ~= "" then
    doBroadcastMessage('mensagem de '..b..' falando: '..a,11)
    clearBuffer(2)
    end
    return TRUE
end

Both, go on talkactions.xml make this tag:
PHP:
<talkaction log="yes" words="/bcall" access="3" script="send.lua"/>

creat the send.lua put this inside:
PHP:
function onSay(cid, words, param) 
         if getPlayerGroupId(cid) > 3 then
            if string.len(param) <= 255 then
               doPlayerSendTextMessage(cid,"Você mandou a mensagem "..param, 24)
               writeBuffer(1,param)
            end
         end
end

Save it, now you can open and close the server

At server 2 go on globalevents the diference of 1º to 2º are two numbers.
PHP:
function onThink(interval, lastExecution)
    local a,b = readBuffer(1)
    if a ~= "" then
    doBroadcastMessage('mensagem de '..b..' falando: '..a,11)
    clearBuffer(1)
    end
    return TRUE
end

Now your "talk" is:
PHP:
function onSay(cid, words, param) 
         if getPlayerGroupId(cid) > 3 then
            if string.len(param) <= 255 then
               doPlayerSendTextMessage(cid,"Você mandou a mensagem "..param, 24)
               writeBuffer(2,param)
            end
         end
end

done.



http://forums.otserv.com.br/newreply.php?do=postreply&t=80584
 
Last edited:

Zifoo

New member
Joined
Jan 7, 2011
Messages
620
Reaction score
162
Location
Brazil
Collision of Spells

From the perspective of the player:

The player uses a magic exori frigo. At the same time, the enemy uses a exori vis for example. The spells fly and collide in the air.

From the perspective of the scripter:
Every spell before being released, save a storage value, and checks if the enemy has the same storage. If so, instead of sending the magic, sends the effects to a calculated position between two points, and an effect of a collision. If the creator wants to further improve the function (to stay as in version 2.0) system, you can make a strength check to know which one 'wins', so that it reaches the opponent. For best results, using addEvent spells are used more, so I'll use an example of this form here in the tutorial.

installation:

On the folder Data, create a file called colisionLIB.lua. Within it, paste this:

PHP:
function checkColision(cid)   -- Function by Ramza (Ricardo Ianelli)
  if getCreatureTarget(cid) ~= 0 then
     setPlayerStorageValue(cid, 9001, 'casting')
     local ppos, enemy = getCreaturePosition(cid), getCreatureTarget(cid) 
     local epos = getCreaturePosition(enemy)

     if getPlayerStorageValue(enemy, 9001) == 'casting' and getCreatureTarget(enemy) == cid then
        setPlayerStorageValue(enemy, 9001, 'colision')
        setPlayerStorageValue(cid, 9001, 'colision')
        if ppos.x > epos.x and ppos.y > epos.y then
           cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
        elseif ppos.x > epos.x and ppos.y < epos.y then
           cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
        elseif ppos.x < epos.x and ppos.y < epos.y then
           cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
        elseif ppos.x < epos.x and ppos.y > epos.y then
           cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
        end
      
        doSendDistanceShoot(ppos, cpos, CONST_ANI_ENERGY)
        doSendDistanceShoot(epos, cpos, CONST_ANI_ENERGYBALL)
        
        local value = math.random(1, 3)
        doSendMagicEffect(cpos, 27+value)              
        return true
     else
        return false
     end
  end

end

Now let's take a spell as a very basic example for testing. Let's use the magic energy strike. Open the file of magic, is more or less like this:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Let's modify a little to our system. Let it like this:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

local function spell(cid, var)
  if getPlayerStorageValue(cid, 9001) ~= 'colision' then
     doCreatureSay(cid, 'Strike!', TALKTYPE_ORANGE_1)
     return doCombat(cid, combat, var)
  end
end

function onCastSpell(cid, var)
	checkColision(cid)
	doCreatureSay(cid, 'Energy...', TALKTYPE_ORANGE_1)
	addEvent(spell, 2000, cid, var) 
end

Done.

Comments:
Who ever is more experienced might have drawn as many possibilities this opens up, how to make spells more advanced compare the level of the pokemon, cause if a poke's lvl is higher than the other, it will quash the the enemy but it's still hit and many other things, only you use will depend on your creativity.



I can't finish translating it now.
brb

http://forums.otserv.com.br/showthread.php?189092-Colis%E3o-de-Magias
 
Last edited:

Moj mistrz

Well-known member
Joined
Mar 26, 2010
Messages
507
Reaction score
830
Location
Poland
For me good scripts from here are - the auction system and communication between servers. Just these are useful.
 

Darekpolak1

New member
Joined
Sep 22, 2011
Messages
182
Reaction score
42
I agree, it would be nice to implement those two scripts in game. Rain system looks nice, but its not necessary.
 

Monkey

New member
Joined
Dec 4, 2010
Messages
1,249
Reaction score
551
Excuse me the insult but josejunior is the retard that spams his credits in all scripts, even when players use his system ._.
I know him from OTLand, he once had a pet system spamming his name in all the script.

and this is my casino slot machine =D
 
Last edited:

Zifoo

New member
Joined
Jan 7, 2011
Messages
620
Reaction score
162
Location
Brazil
haha I do not know him, but the comments I've seen on that script, this very well done ... My intention is to help, they may not want to use, but have an idea and from the scripts that I posted, Jano and Koob can change it and do what they want, i just hope it's useful ..
 

Similar threads

Back
Top