This topic contains 2 replies, has 2 voices, and was last updated by  Lamb 1 year ago.

  • Author
    Posts
  • #1747

    Lamb
    Participant

    Hi, i’d like to ask about how/where to add a script for a new attack method. I’m fairly new to making games in Unity. I wrote a script that lets the player shoot projectiles, but i don’t really know where to add this script. I thought about adding it as a component to the player data (child to the player_manager) because the bombs script was also in there, but couldn’t seem to find it unless the game was running. Is there a better place i could implement my new attack script? Thanks for any help and this is an amazing kit. 🙂

    #1748

    Joey Lubonty
    Moderator

    Hey Lamb,

    So how the current script system works is that in Player_Manager there is a Method called “Attack()” which is called in the Update() method in that same script (Player_Manager). So if you want to use your own script (I am assuming you have an animation that goes with the shooting as well) to do some pewpewpew 😀 then I would recommend adding it to the “Player” GameObject which is the one with the Animator on it so you can easily reference it and send it as a parameter for the Animation methods that are in Helper_Manager BUT you can honestly add it anywhere in the parent child relationship (which is Player_Manager -> Player Data & Player) so long as you just make sure that you can drag and drop the Animator in that script so you can pass the info to Helper_Manager.

    Let me know if this guided you in the right direction and if not just let me know and we can go deeper and get your game working :D.

    EDIT : Just wanted to add a bit more information for you to make this easier. So pretty much you may want to take a look at the Update() method in Player_Manager and if you are using your own script for shooting (and not doing any melee attacks) then I would comment out the code that handles the attacking there. Hope this extra info also helped! 🙂

    Joey,
    Troll Bridge Studios

    #1760

    Lamb
    Participant

    Ok, I’ll try that out! Thanks for the help

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.