Aquafox333

TUTORIAL: Create a Custom Werewolf Character (Sorta)

Feedback  

3 members have voted

  1. 1. Was this helpful?

    • Oui!
      3
    • No!
      0


Recommended Posts

Aquafox333    5
Credit goes to the Bigby Wolf mod for the health threshold activator; however, if you would prefer to use the full moon as your activator, see the end of this tutorial.
 
In order to make your character transform into any other prefab in the game, you'll need to do a few things first.
 
Firstly, you'll need to post the following code in your character's prefab file (below assets is where I put my code):
 
local function becomeINSERTPLAYERPREFABHERE(inst)
 
        inst.YOURTRANSFORMATIONNAMEHERE = false
 
        inst.AnimState:SetBank("wilson")
        inst.AnimState:SetBuild("INSERTPLAYERPREFABHERE")
        inst:SetStateGraph("SGwilson")      
end
 
 
local function becomeYOURTRANSFORMATIONNAMEHERE(inst)
 
        inst.YOURTRANSFORMATIONNAMEHERE = true
 
        inst.AnimState:SetBank("YOURTRANSFORMATION'SANIMBANK") ----- You can find the bank of whatever creature you are using in its prefab.
        inst.AnimState:SetBuild("YOURTRANSFORMATION'SANIMFILE_build") ---- You can find the animation for blank_build in your creature's prefab.
        inst:SetStateGraph("SGCUSTOMSTATEGRAPHNAME") ------- See stategraph below
end
local becomeformtreshold = 60
local unbecomeformtreshold = 62
local function health_event_listener(inst, data)
if inst.components.health.currenthealth <= becomeformtreshold and not inst.YOURTRANSFORMATIONNAMEHERE then
        becomeYOURTRANSFORMATIONNAMEHERE(inst)
elseif inst.components.health.currenthealth >= unbecomeformtreshold and inst.YOURTRANSFORMATIONNAMEHERE then
        becomeINSERTPLAYERPREFABHERE(inst)
        
        end
end
inst:ListenForEvent("healthdelta", health_event_listener)
 
Stategraph:
You are going to need to find whatever creature you are using's stategraph (located in the game's data folders). You will need to replicate it and rename it, then create your own stategraph folder in your mod character's scripts folder and put your new renamed stategraph in there.
The stategraph will need some editing. On a basic level, such as turning into a bunnyman or pig, you will need to remove any instance of the term 'follower' from the stategraph (more often than not by just getting rid of the entire line it is contained in). This will prevent crashes if you equip an item such as a hat.
You can also add in actions (you can find a list of actions in the game's data folder under 'actions.lua'). For instance, you may want to add in the action PICK and PICKUP using one of the creature's existing animations to avoid any crashes. Here is an example of making a bunnyman able to pick objects such as grass and flowers:
 
local actionhandlers =
{
    ActionHandler(ACTIONS.GOHOME, "gohome"),
    ActionHandler(ACTIONS.EAT, "eat"),
    ActionHandler(ACTIONS.PICKUP, "pickup"), ----- The bunnyman can already pick up items
    ActionHandler(ACTIONS.EQUIP, "pickup"),
    ActionHandler(ACTIONS.ADDFUEL, "pickup"),
    ActionHandler(ACTIONS.PICK, "pickup"), ---------- So we added in the PICK action using the bunnyman's "pickup" animation
 
For most creatures, such as the Deerclops, death will cause a crash. This is to do with the fact that on death you drop all your loot and not the Deerclops' loot, so go into your creature's stategraph and remove the following line:
 
            inst.components.lootdropper:DropLoot(Vector3(inst.Transform:GetWorldPosition()))
 
And that should be all. This tutorial is probably going to prove rather rough around the edges (first draught, no proofreading, etc.), and not much attention has been paid to syntax as well as the fact I am but a novice when it comes to modding this game, but this should hopefully provide a general outline for those looking for an easy way to transform their character into anything within the game. 
 
Now as for custom werecreatures...
I have no clue. You won't need a stategraph, and you can probably just use inst.AnimState:SetBuild by itself for both your character's normal form and transformed state, but really, I have no experience in that area. It SHOULD work, but so should capitalism,
and communism,
and benefit frauds.
 
Regardless, good luck, everyone! I hope this helps.
 
Full moon transformation code:
inst:ListenForEvent("nighttime", function(global, data)     if GetClock():GetMoonPhase() == "full" and not inst.YOURTRANSFORMATIONNAME then      becomeYOURTRANSFORMATIONNAME(inst)              end end, GetWorld())
inst:ListenForEvent("daytime", function(global, data)     if GetClock():IsDay() and inst.YOURTRANSFORMATIONNAME then      becomeINSERTPLAYERPREFAB(inst)              end end, GetWorld())
Edited by Aquafox333
  • Thanks 1

Share this post


Link to post
Share on other sites
Yakuzashi    13

I have followed your tutorial but somehow my character is not able to transform. I have no error message, it just seems that I have made mistake that I don't see. I would really appreciate your help but I feel bad to bother you. Sorry and thank you in advance.

Taern TEST.7z

Taern TEST.rar

Share this post


Link to post
Share on other sites
Aquafox333    5

@Yakuzashi Hi, there. I haven't had too much of an in-depth look at your mod (I haven't loaded it up in the game, basically), but two things stand out to me:

In the becometaern function, you have written inst.AnimState:SetBank("taern")

It should be inst.AnimState:SetBank("wilson")

Also, I notice your mod changes your character based on health loss and the full moon. Again, I am unsure as to whether or not this is the problem, but try using one or the other, not both.

If this doesn't work, let me know and I'll have a proper fiddle with your mod.  

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

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