Jump to content

Recommended Posts

Hello!

I am making a custom staff, and I want it to set things on fire like the Firestaff.

The code from the "staff" code doesn't do this, and a lot of the animation lines hint that the color off the staff is an external value that determines what "staff" code activates.

What line of code do I need to tell the game that my staff is red?

I see no other scripts other than this and FX lua, neither of this contain the values.

Link to comment
https://forums.kleientertainment.com/forums/topic/73393-staff-color-lua/
Share on other sites

Yep, I have that included.

I literally copied the entire Red code into my staff. 

Not sure what I am missing, since this whole project is guesswork.

I want the staff to glow, and set things on fire. 

Let me know if you see any glaring issues.

dragonstaff_start.lua

Ok, so i'm not the best to see if something is wrong, but

First, i'll say that you need :
 


local prefabs =
{
    --"ice_projectile",
    "fire_projectile",
    "staffcastfx",
    "stafflight",
    --"staffcoldlight",
    --"cutgrass",
}

Not sure about which one you need exactly, but i'm sure you need at least fire_projectile.

Also, if you look at the end of the staff file, you have :


return Prefab("icestaff", blue, assets, prefabs),
    Prefab("firestaff", red, assets, prefabs),
    Prefab("telestaff", purple, assets, prefabs),

It's here that you say "my staff is linked to the red function" or whatever color you want.

And in the red function you'll see :


local function red()
    local inst = commonfn("red", { "firestaff", "rangedfireweapon", "rangedlighter" })

And it's the part linking the red function to the common function used by all the staff. So at least you need something like :

 

return  Prefab("common/inventory/dragonstaff_start", red, assets, prefabs)

And


local function fn()

Changed into :


local function commonfn(colour, tags)

Because this part is telling the game "i use the common function and i add the colour part (here, red) and the tags related (here, "firestaff", "rangedfireweapon", "rangedlighter" )

 

So i guess you could change things to make only one big function, but this way to do allows you to add more staff in the future with different color if you want to.

 

I'm not sure all these changes are needed, i'm not sure all will work, and i'm not sure if some others things are wrong too, but i hope it will help.

4 hours ago, naptimeshadows said:

Do I really need to recreate all the other prefabs?

You don't need to recreate the files in "local prefab" but you need to call them, because you are saying the game "i need theses files for my prefab". So for example you don't need to recreate Fire_projectile since it already exists, you just need to tell the game "my prefab will need Fire_projectile".

I'm not entirely sure about what you are asking so maybe it's not what you want to know...

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...