Jump to content

boneAttach


Axel

Recommended Posts

I'm trying to make a short function to attach a object to my player with the bone_attach script..

function burger() 
burger1 = createObject(2880,0,0,0) 
exports.bone_attach:attachElementToBone(burger1,source,12,0,0,0,0,-90,0) 
end 
addCommandHandler("bu",burger) 

Am i an idiot or something were changed from the new version..

Edited by Guest
Link to comment
function burger (thePlayer) 
    --x,y,z=getElementPosition(thePlayer) 
    burger1 = createObject ( 2880, 0, 0, 0 ) 
    exports.bone_attach:attachElementToBone ( burger1, thePlayer, 12, 0, 0, 0, 0, -90, 0 ) 
end 
addCommandHandler ( "bu", burger ) 

Your error(s):

1: You forgot about 'thePlayer' in the function .

2: You forgot to rename 'source' to 'thePlayer.

Link to comment

Thanks, now i want to introduce it in the item-system, i did it fine but the burger doesn't dissapear after usage..

        elseif (itemID==8) then -- sandwich 
            giveHealth(source, 50) 
            exports.global:applyAnimation(source, "food", "eat_burger", 4000, false, true, true) 
            toggleAllControls(source, true, true, true) 
            exports.global:sendLocalMeAction(source, " mananca un sandwich.") 
            takeItemFromSlot(source, itemSlot) 
            burger1 = createObject ( 2880, 0, 0, 0 ) 
            exports.bone_attach:attachElementToBone ( burger1, source, 12, 0, 0, 0, 0, -90, 0 ) 

Got a idea or something how to make it dissapear after the animation is finished?

Link to comment

Nvm i succeded:

        elseif (itemID==8) then -- sandwich 
            giveHealth(source, 50) 
            exports.global:applyAnimation(source, "food", "eat_burger", 4000, false, true, true) 
            toggleAllControls(source, true, true, true) 
            exports.global:sendLocalMeAction(source, " mananca un sandwich.") 
            takeItemFromSlot(source, itemSlot) 
            local burger1 = createObject ( 2880, 0, 0, 0 ) 
            exports.bone_attach:attachElementToBone ( burger1, source, 12, 0, 0, 0, 0, -90, 0 ) 
            function destroy() 
            destroyElement(burger1) 
            end 
            setTimer(destroy,2000,1) 
  

:D

Edit: Were can i see a list with all the objects?

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...