TalkAction Find Target Hunting Area

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
Well, I was browsing thru the Lua Functions and found this
Code:
getCreatureTarget(cid) //TODO
And then i figured hey! lets try and make a really gross version of that! xD So what i've done is got the script checking around the player(Param) for a Monster. Another player can use the Command to perhaps find out where this player is hunting, or what not. But it costs Money to do (configurable in the script). Enjoy and please post comments.

I also wouldn't mind people re-writing the script cause I did this very quickly and its pretty sloppy. Here it is!

Code:
Credits: Shawak (Thx for the Check Area for Monster code.)
         Sync
Lua:
function getMonstersFromArena(pos, radiusx, radiusy, stack)
        local monsters = {}
        local starting = {x = (pos.x - radiusx), y = (pos.y - radiusy), z = pos.z}  
        local ending = {x = (pos.x + radiusx), y = (pos.y + radiusy), z = pos.z}
        for x = starting.x, ending.x do
                for y = starting.y, ending.y do
                        for z = starting.z, ending.z do
                                local pos = {x=x, y=y, z=z,stackpos = stack}
                                local thing = getThingfromPos(pos)
                                if thing.itemid > 0 then
                                        if isMonster(thing.uid) == TRUE then 
                                                table.insert (monsters, thing.uid)
                                               break 
                                        end
                                end                       
                        end
                end
        end
        return monsters
end

function onSay(cid, words, param, channel)
local pos = getCreaturePosition(cid)
local config = {
monsters = getMonstersFromArena({x = pos.x,y = pos.y,z = pos.z}, 2, 2, 253),
target = getPlayerByNameWildcard(param),
price = 10, -- Ammount in Gold Coins
letter = doPlayerAddItem(cid, 2598)   -- 2589 is a Letter
}

if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires a players name.") 
                return TRUE
        end     
        for i = 1, #config.monsters do   
    if(doPlayerRemoveMoney(cid, config.price) == TRUE) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "New mail has Arrived.")
    doSetItemText(config.letter, "Dear Player, I have searched feircely to find "..getCreatureName(config.target)..", Luckily i am a great spy and have found his current enemy that surrounded him! The target he was surrounded by was a "..getCreatureName(config.monsters[i]).."!")                 
           else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..config.price.." gold in order to use this command.")  
    end        
                return TRUE
        end   
          end
Code:
/find Chris
 

Thuggeh

New Member
Joined
Jul 10, 2007
Messages
201
Best answers
0
Reaction score
0
This is an awesome idea! I will probably use this it. Thanks.

+Rep

P.S. What happens when the player (param) has no creature near it?
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
851
Location
Caribbean Sea
huh? just knowing who a player's target is?
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
I did some script few days ago:
Code:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getPlayersOnline()) do
		if (doConvertIntegerToIp(getPlayerIp(cid)) == "0.0.0.0" and getCreatureName(getCreatureTarget(cid)) == "Training Monk") then
			doRemoveCreature(cid)
		end
	end
	return true
end
And getCreatureTarget(cid) works :)
 

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
lol, gesior had posted something like this months ago, u only added it that it takes money/writes in letter. o_O
 
OP
Sync

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
lol, gesior had posted something like this months ago, u only added it that it takes money/writes in letter. o_O
I didn't know that. And for anyone that cares I'm done posting scripts on otland all you get is fags critizing everytime. Enjoy shitty otland.
 

Thuggeh

New Member
Joined
Jul 10, 2007
Messages
201
Best answers
0
Reaction score
0
Well, letting them get to you is letting them win. So just ignore them and continue to help the part of the community that is actually grateful?

Thanks again for the nice script.
 

kn4tseb

New Member
Joined
Feb 8, 2009
Messages
83
Best answers
0
Reaction score
0
are you sure is working ??? dont you need to set the param for target :S?
 
Last edited:
OP
Sync

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
The param is set for the target
 

OsoSangre

UmbyOTs Developer
Joined
Nov 10, 2007
Messages
44
Best answers
0
Reaction score
9
Location
Texas, USA
Haha!

Good Script.
I would never have thought of that.

Keep them coming!
 

Cotizado

Member
Joined
May 12, 2008
Messages
321
Best answers
0
Reaction score
6
nice :D you can put some delay on the mail if there isnt havent tested it yet
 

cesar10

Active Member
Joined
Aug 4, 2009
Messages
425
Best answers
0
Reaction score
35
what on talkactions xlm?
i will try
<talkaction words="/find" event="script" value="exivam.lua"/>
xd
 

OZiRY

ONLiNE
Joined
Mar 11, 2010
Messages
280
Best answers
0
Reaction score
5
It would be cool if you could make it NPC based.. like:

(blabla random rpg text)
You: Hi
NPC: Hello, I have lost my eye in a bet with the devil, I can now overlook Tibia from the suns angle.. Do you need any information about any player?
You: Find Chris
NPC: It will cost you 1000 gold to look into the eye of the black sun, are you willing to pay that price?
You: Yes
*Glitter Effect*
Text: You see Chris in a battle between an Orshabaal.
 

Trader

New Member
Joined
Aug 12, 2009
Messages
219
Best answers
0
Reaction score
1
This doesn't work, I get a letter, but nothing is written inside of it and It doesn't say "New Mail has Arrived" and it doesn't take away your money
What's wrong?
 
Top