Jump to content

Need help to learn coding !


Recommended Posts

Hi! I learned coding from Roblox but I cant make my own character habilities in this game because I dont have like a tree which shows me the names of the stats that I want to change. For example:
I know that inst.components.combat.damage multiplier = 2, means the character will do 2 times or 200% of the damage. 

Lets say I want to make my character hold a cane and walk faster with it...

should be something like:


local function caneEquipped(inst, data)
     if data.item.prefab == walkingcane (i dont know if thats the name of the item) then
          inst.components.locomotor.runspeed = 6 (which is a 50% increase since default is 4)
     end

inst:ListenForEvent("equip", caneEquipped)

In Roblox we get the item names, the tree which shows us where each item or property is located and everything so we can actually change values with the codes. But my problem is I dont know where to get this information. 

For example: How can I make the character blind? I don't know how to do that, since I dont know if there is a value for that... Or remove daylight from the client so it appears as if she is blind but only on the client. 

So how can I find all this information? (I'm trying to explain it as much as I can but I'm not sure if I'm explaining it correctly.

Edited by HarukaIssey
Link to comment
Share on other sites

I recommend looking through the game scripts for answers but.

On 12/14/2023 at 10:39 AM, HarukaIssey said:


should be something like:


local function caneEquipped(inst, data)
     if data.item.prefab == walkingcane (i dont know if thats the name of the item) then
          inst.components.locomotor.runspeed = 6 (which is a 50% increase since default is 4)
     end

inst:ListenForEvent("equip", caneEquipped)
 

Instead of doing that, I recommend making a new prefab that is similar to the cane but has your ideas, you could first copy cane.lua into your mod's prefab file, then simply change.

inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT
to
inst.components.equippable.walkspeedmult = 1.5

and make other changes.

As for the blind thing, you could use. 

inst:ScreenFade(true)

But I don't recommend that, as you literally can't see anything, including prefabs, and probably any reticules that you could make.

So instead, you could probably make a custom color cube, but I have no idea how to do that.

I recommend reading this guide, since I obviously can't give all of the details.

 

Link to comment
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
 Share

×
  • Create New...