Action [RELEASE] The Boomerang (like in the Zelda series)

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
I got inspired by the hookshot-script by Molinero, and since I love the Zelda-series I decided to make a Boomerang script, almost a pure copy of the one in the Zelda-games.

How it works:
You use the boomerang like a rune. When you use it on an area, a boomerang-effect will appear. Then, if there is a player in that area, he will lose health. Else, if there is an item there, your boomerang will pick up the item and fly it back to you! The boomerang will of course fly back to you too!
Video from Zelda:Ocarina of Time: http://www.youtube.com/watch?v=rqJmK4mpXRk



Of course, I fixed so you cannot use the boomerang in PZ, and you can also not pick up items from houses and such!

The script:
[tools/boomerang.lua]

PHP:
--100 PERCENT CREDITS TO PENIS PUMPE-- 
        --1337.hopto.org-- 
  --Please keep credits if used-- 

function target (stuff) 
local cid = stuff.cid     
local thing = getThingfromPos(stuff.toPosition) 
     
    if (stuff.counter == 2) then 
        if getTileHouseInfo(stuff.toPosition) > 0 then 
                warnPlayer(cid, "You cannot teleport items out of a house.") 
        elseif isCreature(thing.uid) == FALSE then 
                doTeleportThing(thing.uid, getCreaturePosition(stuff.cid)) 
        end 
        return TRUE 
    end     
        doSendDistanceShoot(stuff.toPosition, getCreaturePosition(stuff.cid), CONST_ANI_WHIRLWINDAXE) 
        doAreaCombatHealth(0, COMBAT_HOLYDAMAGE, stuff.toPosition, 0, -100, -200, CONST_ME_HOLYDAMAGE) 
        stuff.counter = stuff.counter + 1 
        addEvent(target, 200, stuff) 
end 

function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if getTilePzInfo(getCreaturePosition(cid)) == TRUE or getTilePzInfo(toPosition) == TRUE then 
        warnPlayer(cid, "You cannot use this weapon in a protection zone.") 
    else 
        doSendDistanceShoot(getCreaturePosition(cid), toPosition, CONST_ANI_WHIRLWINDAXE) 
        local stuff = {cid = cid, toPosition = toPosition, counter = 1}         
        addEvent(target, 300, stuff) 
    end 
    return TRUE 
end
actions.xml:
PHP:
	<action itemid="7423" allowfaruse="1" script="tools/boomerang.lua"/>

If you dont have the warnPlayer function, add this to your global.lua:
PHP:
function warnPlayer(cid, msg) 
    -- Function by Colandus 
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
    return doPlayerSendCancel(cid, msg) 
end

All credits to the 1337 server, made by Penis Pumpe!

Please keep credits if used. Thanks to Molinero for the inspiration!

Hope you like it!

Ps: This is my first released script, and I would appriciate constructive critics. Feel free to post configurations, since im not a pro scripter.
 
Last edited:

Darkshadows

Lua Scripter
Joined
Sep 15, 2007
Messages
137
Best answers
0
Reaction score
1
looks like a nice script lol but, it would be bad in some circumstances such as showing off some things and you boomerang it to you o.0

i have a muesuem like thing in mine which would be robbed like none other lol but nice script :)
 

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
add a check is the target pos inside depo, else players can grab items from depots or hit them in depo.
 

Jerry

I've Been Permanently Ban
Joined
Aug 17, 2008
Messages
1,697
Best answers
0
Reaction score
1
Location
Panama
Wow, Great scrip. I love it.
 
OP
Tufte

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
add a check is the target pos inside depo, else players can grab items from depots or hit them in depo.
Ok, I will add it... but is there any way to check if the boomerang is flying over a non-moveable item? Because now you can for instance teleport annihilator reward and such :p

edit: fixed so you cant throw the boomerang from pvp area to pz zones, so the depot problem should be solved.
 
Last edited:

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
Code:
isMoveable(item)
 
OP
Tufte

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
yeah, but the problem isnt that it teleport non-movable items, the problem is that it will "fly" over non-moveable items... how to I fix a check for that? Loop all things from creaturepos to topos?
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,874
Best answers
61
Reaction score
390
Location
Germany
isSightClear(fromPos, toPos, floorCheck)
 
OP
Tufte

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
PHP:
    elseif isSightClear(getCreaturePosition(cid), toPosition, nil) == FALSE then
		warnPlayer(cid, "You cannot throw the boomerang over this item.")
	else
dosent work, can still shoot it over non moveable items, water tiles etc
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
In the zelda video it locks on, and follows the target.
Does that happen here?

Because if it does, you can make sprites for missiles...etc.
 
OP
Tufte

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
it does, but the effect happens so quick it can barely be seen :(
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
Anyway to slow it?
That would be cool, to be able to run away from an "attack"
 
OP
Tufte

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
well, the only way to take items from a depot, is if you have depot outside PZ, which i've never seen in my whole life...
 

Tachi

New Member
Joined
Aug 4, 2007
Messages
376
Best answers
0
Reaction score
2
Location
USA, Missouri
@ up
he wrote that he fixed the depot problem a few posts down on the first page..

@ topic
Nice idea.. might try it and use it on my server for a quest or reward for something..
Makes a nice gift xD
 

NOOBLAND

Banned User
Joined
Feb 8, 2009
Messages
93
Best answers
0
Reaction score
0
thanks really nice one tufte!! i love your server too :p

roxor is best!!!
 

RLA24

New Member
Joined
Feb 15, 2009
Messages
66
Best answers
0
Reaction score
0
I added this to my server it works and everything but i get this error in my server window. can you help me out.

untitled.JPG
 
Top