Jump to content

Recommended Posts

Hi everyone , my favorite item in the game is "boomerang"...

Because its effective on distance and not need to reload :) (realy  people i love boomerangs much im playing with them since i was a kid-i mean in real life)....

 

Here is the point:

 

 im realy get tired of try to catch it back because the boomerang is soo weak an i cant stand  anymore of  sound of " pushing the space button"....

                           

I wish: 

          1-) can anybody make someting (mod-tool etc.) to configure power,max distance, auto-catching etc. ?

          2-) please show my the way -how can i do all those  things with original game files ? 

 

thanks everyone who will reads this and gives me help in the future...

 

p.s: sorry about my bad english im tryn' to learn :))

 

  :wilson_cool:

 

Link to comment
https://forums.kleientertainment.com/forums/topic/29204-help-the-super-boomerang/
Share on other sites

Have a look at the boomerang in my Link mod. It has an auto-catch feature - the max distance and power and everything are pretty obvious, if I recall.

im already playing with your "link the hero" :) he is my favorite but i wanna play maxwell and i can't do without boomerang :(

 

Since morning im tryng to solve your "linkereang" codes and make same respond (catchback) mechanism to main boomerang (the orginal) but there is no succsess...

 

Can you give me the edited version of "boomerang.lua"  i can change power-distance but catch-back mechanism; thats the point im fail...

 

_____

im fan of "Legend of Zelda" and your custom "Link" he is the best ...

*please add bow in a short time ,i cant wait fot it :D

thanks much...

I'm not really a coder - art and animation is my domain - but I believe this is the section that handles the auto-catch:

    local oldhit = inst.components.projectile.Hit    function inst.components.projectile:Hit(target)        if target == self.owner and target.components.catcher then            target:PushEvent("catch", {projectile = self.inst})            self.inst:PushEvent("caught", {catcher = target})            self:Catch(target)            target.components.catcher:StopWatching(self.inst)        else            oldhit(self, target)        end    end

I'm not really a coder - art and animation is my domain - but I believe this is the section that handles the auto-catch:

    local oldhit = inst.components.projectile.Hit    function inst.components.projectile:Hit(target)        if target == self.owner and target.components.catcher then            target:PushEvent("catch", {projectile = self.inst})            self.inst:PushEvent("caught", {catcher = target})            self:Catch(target)            target.components.catcher:StopWatching(self.inst)        else            oldhit(self, target)        end    end

It is. :razz:

 

I'm not really a coder - art and animation is my domain - but I believe this is the section that handles the auto-catch:

    local oldhit = inst.components.projectile.Hit    function inst.components.projectile:Hit(target)        if target == self.owner and target.components.catcher then            target:PushEvent("catch", {projectile = self.inst})            self.inst:PushEvent("caught", {catcher = target})            self:Catch(target)            target.components.catcher:StopWatching(self.inst)        else            oldhit(self, target)        end    end

thanks for your attention :)

 

but could you do this as "super boomerang mod" ?

 

because when i change somethng about gamefiles game crashs...

 

i think ist about the game mechanism if somethng changes game stops itself...doesnt work etc...

 

please i trust you you are experienced about making mods , could you do that for me ,make a little mod  ? 

Sorry that i cant test this (i dont have any games with boomerangs) but I -think- this will work to do what you need

 

https://dl.dropboxusercontent.com/u/13440285/coding%20zips/autocatch.zip

 

The modmain.lua just contains the following:

 

function setAutoCatch(inst)	local oldhit = inst.components.projectile.Hit	function inst.components.projectile:Hit(target)		if target == self.owner and target.components.catcher then			target:PushEvent("catch", {projectile = self.inst}) 			self.inst:PushEvent("caught", {catcher = target})			self:Catch(target)			target.components.catcher:StopWatching(self.inst)		else			oldhit(self, target)		end	endendAddPrefabPostInit("boomerang", setAutoCatch)

 

Sorry that i cant test this (i dont have any games with boomerangs) but I -think- this will work to do what you need

 

https://dl.dropboxusercontent.com/u/13440285/coding%20zips/autocatch.zip

 

The modmain.lua just contains the following:

 

function setAutoCatch(inst)	local oldhit = inst.components.projectile.Hit	function inst.components.projectile:Hit(target)		if target == self.owner and target.components.catcher then			target:PushEvent("catch", {projectile = self.inst}) 			self.inst:PushEvent("caught", {catcher = target})			self:Catch(target)			target.components.catcher:StopWatching(self.inst)		else			oldhit(self, target)		end	endendAddPrefabPostInit("boomerang", setAutoCatch)

 

thank you buddy :D 

and Dana Addams thanks for codes...

 

god bless you...

Excuse me

Anyone here?

I still have a problem

 

 

Can this happen?

 

when the boomerang on thrown, immediately equip my other boomerang in my inventory.

i try to write a code in the scripts/prefabs/boomerang.lua

but it become cannot throw.

 

 

local function OnThrown(inst, owner, target)
owner.components.inventory:Equipitem(inst)
    if target ~= owner then
        owner.SoundEmitter: PlaySound("dontstarve/wilson/boomerang_throw")
    end
    inst.AnimState: PlayAnimation("spin_loop", true)
end
 
 

 

Can anyone teach me ?

THX

But i try to slow the boomerang speed, i can equip another boomerang manually.

Then i can throw again.

 

If my hand is not empty, the auto-catch code still work.

So the first boomerang wiil be caught, turn into my inventory.

 

Then i can do it again and again.

 

But i dont know how to write the auto-equip code. Orz

 

(wish you can understand my poor grammar)

Check in  projectile.lua and when a projectile is thrown you will see it posts an 'onthrow' event and the objects previous owner (entity that threw it) is included in the attached data for the event. So in a PrefabPostInit() for the boomerang add in a listener for the onthrow event.

 

at the top of your handler for the onthrow event check to make sure the thrower is either just the player, or the specific character that you want to be able to speed throw multiple rangs. Then you need to see if the owner even has an extra boomerang in their inventory.  You do this with something like

 

local item = owner.components.inventory:FindItem(function(item) return item.prefab == "boomerang" end ) 

 

If 'item' isnt set to nil then it means the thrower had a spare 'rang. Then you just equip it using the line you pasted above

 

owner.components.inventory:Equipitem(item)

Edited by seronis

Sorry i still not figure out.

But where should i add this code?

 

local item = owner.components.inventory:FindItem(function(item) return item.prefab == "boomerang" end ) 

 

I try several places, but still cannot run.

 

Should i add it at PrefabPostInit() ?

But i can't find it.

 

 

Thanks

It work!! Thank you!!

 

 

local function OnThrown(inst, owner, target)

local item = owner.components.inventory:FindItem(function(item) return item.prefab == "boomerang" end ) 

owner.components.inventory:Equip(item)

    if target ~= owner then
        owner.SoundEmitter: PlaySound("dontstarve/wilson/boomerang_throw")
    end
    inst.AnimState: PlayAnimation("spin_loop", true)
end

If you want to make that OnThrown() a little more generic you can prob change

 

item.prefab == "boomerang" 

 

to

 

item.prefab == inst.prefab

 

that will allow it to be usable on multiple projectile types if you ever decide to add throwing rocks or spears etc. As it is right now you have a bug. I told you in the other post you need to check if 'item' is nil or not. you never do this. You just blindly tell the player to equip item even if item doesnt exist.  You also arent checking if the boomerang was just thrown, or if it hit its target and is now being 'rethrown' back to the owner.  So your code will attempt to equip 2 different boomerangs each time you throw one.

I want to check, but i don't know how and where.

 

This is my first contact with file .lua

 

So what i can do is just try the simplest way to let my idea come true.

 

Still thanks a lot that you solved my problem and many advices.

 

It's a good idea to throw rocks or spears, maybe i will try them later.

Then i have to face the bug.

 

But now i wonder that can the throwing boomerang have its own brain which can auto-attack my enemy, or attack maybe two target

then return to owner.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...