Jump to content

[HELP] Finding ground effects


Tayburro

Recommended Posts

I don't know how to word this but I can't seem to find where the effects for turfs are in the game code.

I'm trying to make turfs acctually have effects but i cant find the location of where i would mod and i just need to know where the cobblestone speed coding is.

 

(Sorry if this is hard to read, I am a very stupid person.)

Link to comment
Share on other sites

If you want to alter the speed a character moves while on cobblestone turf, or roads, you just need to change their Run speed.

inst.components.locomotor.runspeed = X

Where X is the speed value. Wilson's default walk speed is 4, and run speed is 6, if I recall correctly.

It is 5 

 

Thanks for the help my mod is sadly not working due to my idiocy but whatever...

 

God I suck at everything.

Link to comment
Share on other sites

Dude, that "I suck at everything."-attitude doesn't help you. Neither the "I am a very stupid person." Do me a favor and don't talk of yourself like this, not doing it on this forum is the first step to not doing it everywhere else. (If you didn't mean it then I'm sorry for that instruction on how to treat yourself)

On-Topic: If I understand you correctly then I think I can point you in the right direction when I'm home. Do you want to add effects to all of the turf? i.e. grassy turf makes you get more sanity, forest turf makes you burn... Do I understand correctly?

Link to comment
Share on other sites

Dude, that "I suck at everything."-attitude doesn't help you. Neither the "I am a very stupid person." Do me a favor and don't talk of yourself like this, not doing it on this forum is the first step to not doing it everywhere else. (If you didn't mean it then I'm sorry for that instruction on how to treat yourself)

On-Topic: If I understand you correctly then I think I can point you in the right direction when I'm home. Do you want to add effects to all of the turf? i.e. grassy turf makes you get more sanity, forest turf makes you burn... Do I understand correctly?

 

Just to the man-made turfs and perhaps to marsh turf.

Link to comment
Share on other sites

Just to the man-made turfs and perhaps to marsh turf.

So this might or might not be complicated depending on your knowledge modding. If you feel like I'm telling you totally strange things then you should probably start with something simpler  ; )

 

In "terrain.lua", which is in your maps folder, you have the list of all grounds that exist in the game. You'll need this just for reference. Now the useful function for what you want to do is GetTileAtPoint(x, y, z), which you can use like this

local ground = GetWorld()if ground.Map then    local tile = ground.Map:GetTileAtPoint(x, y, z)    if tile and tile == GROUND.MARSH then        --Do something    endend

Now you'll want your character to check every second on which tile he is (how often to check is your choice, but one second is probably a good start), which you can do like this

inst:DoPeriodicTask(1, function()    local x,y,z = inst.Transform:GetWorldPosition()    local ground = GetWorld()    if ground.Map then        local tile = ground.Map:GetTileAtPoint(x, y, z)        if tile and tile == GROUND.MARSH then            --Do something        end    endend)

If that seems above your head then start by looking at some samplemods or tutorials which were kindly gathered here. Good luck ^^

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...