Jump to content

Please help with the editing of the character


Recommended Posts

9 minutes ago, Tezumoto said:

Somehow it at me does not work.
But I found another way.

inst.components.temperature.inherentinsulation = ( TUNING.INSULATION_PER_BEARD_BIT * 9 )
By increasing the number 9, I get a bigger bonus.
But it will work for all seasons.

When I have time, I will dig this code and test the values. Is really strange don't work... But if you find a solution, good :wilson_goodjob:

Link to comment
Share on other sites

1 hour ago, Tezumoto said:

Can I do that every character on the server could take only one person?

I don't know if it is possible. But have a code for despawn a player, look the mods Change Character or Magical Chest. And have a mod called Disable characters too. If you despawn a player that don't have the name of the allowed character, you can "do it". Join in server and put a custom item that have a despawn near players. If have better way, I have no idea xD

Link to comment
Share on other sites

50 minutes ago, kavaline said:

I don't know if it is possible. But have a code for despawn a player, look the mods Change Character or Magical Chest. And have a mod called Disable characters too. If you despawn a player that don't have the name of the allowed character, you can "do it". Join in server and put a custom item that have a despawn near players. If have better way, I have no idea xD

What are doing these options?

	inst.OnSave = onsave
	inst.OnLoad = onload
	inst.OnNewSpawn = onload
	inst.OnPreLoad = onpreload

 

Link to comment
Share on other sites

1 hour ago, kavaline said:

I don't know if it is possible. But have a code for despawn a player, look the mods Change Character or Magical Chest. And have a mod called Disable characters too. If you despawn a player that don't have the name of the allowed character, you can "do it". Join in server and put a custom item that have a despawn near players. If have better way, I have no idea xD

The mod @kavaline cleverly mentioned is Star's Disable Characters.

Link to comment
Share on other sites

1 hour ago, Tezumoto said:

What are doing these options?


	inst.OnSave = onsave
	inst.OnLoad = onload
	inst.OnNewSpawn = onload
	inst.OnPreLoad = onpreload

 

Is functions that occour in events with the same name. I don't know explain technically about it, search in forum or google it for learn better =]

But, put the despawn code inside of the "onload" function of each char sounds nice...

 

1 minute ago, Arlesienne said:

The mod @kavaline cleverly mentioned is Star's Disable Characters.

Right, is this mod

Link to comment
Share on other sites

2 hours ago, kavaline said:

Is functions that occour in events with the same name. I don't know explain technically about it, search in forum or google it for learn better =]

But, put the despawn code inside of the "onload" function of each char sounds nice...

I tried to add backpack in the starting items, but I did not succeed.

local start_inv = {"backpack", "bedroll_furry"}

Can backpack need another code?

Edited by Tezumoto
Link to comment
Share on other sites

I'm not sure but i guess it needs another code, because i think since backpack can't be in "inventory" (only in the armor slot), you can't give it to a character this way. A complicated way could be to give a backpack blueprint and the grass/twigs, but i'm sure someone have a better way to manage this.

Link to comment
Share on other sites

29 minutes ago, SuperDavid said:

This mod character starts with a backpack, download it, check it & get the code ;)!

http://steamcommunity.com/sharedfiles/filedetails/?id=402336848

It throws an error, an old script or something like that.

local fn = function(inst)
	--start inventory
	inst._OnNewSpawn = inst.OnNewSpawn
	inst.OnNewSpawn = function()
		local start_inv ={"backpack"}
		for i, v in ipairs(start_inv) do
            inst.components.inventory:GiveItem(SpawnPrefab(v))
            inst.components.inventory:Equip(SpawnPrefab(v))
        end
			if inst._OnNewSpawn ~= nil then
				inst:_OnNewSpawn()
				inst._OnNewSpawn = nil
        end
    end

 

Edited by Tezumoto
Link to comment
Share on other sites

17 minutes ago, Tezumoto said:

It throws an error, an old script or something like that.

It seems spawning with backpacks seems like a huge hassle for some reason in DST, I know in SW Warly just starts with his spicepack in local_inv...

Um, If I was in you I would just make him start with the ingredients for crafting a backpack & make him know how to craft backpacks without science machine. You would do this

modmain.lua

AddPrefabPostInit("YOUR CHARACTER NAME HERE", function(inst)
if (inst.components and inst.components.builder) then
inst.components.builder:UnlockRecipe("backpack")
end
end)

YOUR CHARACTER NAME HERE.lua

local start_inv =
{
"cutgrass",
"cutgrass",
"cutgrass",
"cutgrass",
"twigs",
"twigs",
"twigs",
"twigs",
}

This would be the simplest way of getting what you want ;).

Link to comment
Share on other sites

2 hours ago, SuperDavid said:

It seems spawning with backpacks seems like a huge hassle for some reason in DST, I know in SW Warly just starts with his spicepack in local_inv...

Um, If I was in you I would just make him start with the ingredients for crafting a backpack & make him know how to craft backpacks without science machine. You would do this

modmain.lua


AddPrefabPostInit("YOUR CHARACTER NAME HERE", function(inst)
if (inst.components and inst.components.builder) then
inst.components.builder:UnlockRecipe("backpack")
end
end)

YOUR CHARACTER NAME HERE.lua


local start_inv =
{
"cutgrass",
"cutgrass",
"cutgrass",
"cutgrass",
"twigs",
"twigs",
"twigs",
"twigs",
}

This would be the simplest way of getting what you want ;).

Perhaps this is the only option

Link to comment
Share on other sites

2 hours ago, Tezumoto said:

How to make that character beside to the monsters quickly he lost his mind?

In master_postinit put this, it makes character beside the monsters quickly he lost his mind.

inst.components.sanity.neg_aura_mult = 1 -- Default number is 1 to add 50% more you would do.. "1.5" instead of 1, stuff like that

 

Link to comment
Share on other sites

1 hour ago, SuperDavid said:

In master_postinit put this, it makes character beside the monsters quickly he lost his mind.


inst.components.sanity.neg_aura_mult = 1 -- Default number is 1 to add 50% more you would do.. "1.5" instead of 1, stuff like that

 

I did so
 

    inst.components.sanity.neg_aura_mult = 8

But this only works if you stand side by side with a monster.
Сan slightly increase the range of this effect?
I want to this effect has been at least one step from the monster.

Edited by Tezumoto
Link to comment
Share on other sites

Just now, Tezumoto said:

I did so
 


    inst.components.sanity.neg_aura_mult = 8

But this only works if you stand side by side with a monster.
Сan slightly increase the range of this effect?

I don't think insanity range can be changed, well at least I don't know how, sorry :(.

 

2 minutes ago, Tezumoto said:

I did so
 


    inst.components.sanity.neg_aura_mult = 8

I think this means your character would lose sanity 700% faster from monsters? Are you sure you want it that much xD ?

Link to comment
Share on other sites

7 minutes ago, SuperDavid said:

I don't think insanity range can be changed, well at least I don't know how, sorry :(.

 

I think this means your character would lose sanity 700% faster from monsters? Are you sure you want it that much xD ?

I even have a value of 20, the effect of the weak

Link to comment
Share on other sites

12 minutes ago, SuperDavid said:

I don't think insanity range can be changed, well at least I don't know how, sorry :(.

 

I think this means your character would lose sanity 700% faster from monsters? Are you sure you want it that much xD ?

But this only works if you stand side by side with a monster =(

Now need to find a way to change the radius of the effect.
At least one step from the monster.

Edited by Tezumoto
Link to comment
Share on other sites

4 minutes ago, Tezumoto said:

But this only works if you stand side by side with a monster =(

The range of  insanity aura of monsters depends on how big the monster's insanity aura is which means you can't really change it, I don't even know if it's possible to increase the positive or negative sanity aura range...

If you really want do you want me to make something for your character that every second he's close to 1 monster at whatever range you want he loses as much sanity as you want? If you do tell me & i'll make for you.

Edited by SuperDavid
Link to comment
Share on other sites

Sanity drain auras is calculated using TUNING.SANITY_EFFECT_RANGE for each entity within that range.

The value is 10 units, or 2.5 turf squares away.

Each negative aura has an exponential falloff based on the distance the entity is to the player.

You can remove this falloff by hooking the sanityaura component's GetAura function and returning its normal value multiplied by math.max(1, self.inst:GetDistanceSqToInst(observer)).

To make the falloff linear merely multiply it by the square root of that so that way it diminishes linearly by distance.

 

Of course to have it affect your character compare with observer.prefab to ensure it's affecting your character and return normal values so it won't affect other characters.

Link to comment
Share on other sites

16 minutes ago, SuperDavid said:

The range of  insanity aura of monsters depends on how big the monster's insanity aura is which means you can't really change it, I don't even know if it's possible to increase the positive or negative sanity aura range...

If you really want do you want me to make something for your character that every second he's close to 1 monster at whatever range you want he loses as much sanity as you want? If you do tell me & i'll make for you.

 

5 minutes ago, CarlZalph said:

Sanity drain auras is calculated using TUNING.SANITY_EFFECT_RANGE for each entity within that range.

The value is 10 units, or 2.5 turf squares away.

Each negative aura has an exponential falloff based on the distance the entity is to the player.

You can remove this falloff by hooking the sanityaura component's GetAura function and returning its normal value multiplied by math.max(1, self.inst:GetDistanceSqToInst(observer)).

To make the falloff linear merely multiply it by the square root of that so that way it diminishes linearly by distance.

 

Of course to have it affect your character compare with observer.prefab to ensure it's affecting your character and return normal values so it won't affect other characters.

I just wanted to at one or two steps from monster mind went down by 2/sec

Thanks for the advices, but I'm a little hard to understand you.
My English is very bad =(

Edited by Tezumoto
Link to comment
Share on other sites

58 minutes ago, Tezumoto said:

I just wanted to at one or two steps from monster mind went down by 2/sec

Thanks for the advices, but I'm a little hard to understand you.
My English is very bad =(

Could you perhaps draw the curve you want the sanity aura values to be created?

FJ82o8U.png

The exponential is the default one, the other two are easily created.

Notice that at distances <=1 the sanity aura is in full effect for all three cases.

Are you wanting to shift the <=1 portion to be something like <=4?

Such that it is in full effect until the player is 4 units away (1 turf)?

TRzkmMX.png

^ Doing it at <=3 for the proposed purple line.

Edited by CarlZalph
Link to comment
Share on other sites

16 minutes ago, CarlZalph said:

Could you perhaps draw the curve you want the sanity aura values to be created?

The exponential is the default one, the other two are easily created.

Notice that at distances <=1 the sanity aura is in full effect for all three cases.

Are you wanting to shift the <=1 portion to be something like <=4?

Such that it is in full effect until the player is 4 units away (1 turf)?

 

I wanted to a few steps away from the monster, this effect was already working at full capacity.
I'm standing at a distance of two steps from the monster, but the effect is the same as if I was standing next to him.
I hope you understand what I'm saying.

Link to comment
Share on other sites

28 minutes ago, Tezumoto said:

I wanted to a few steps away from the monster, this effect was already working at full capacity.
I'm standing at a distance of two steps from the monster, but the effect is the same as if I was standing next to him.
I hope you understand what I'm saying.

I assume you're wanting the purple proposed line, then.

AddComponentPostInit(
    "sanityaura",
    function(self, inst)
        local GetAura_old = self.GetAura or function(...) return 0 end
        self.GetAura = function(self, observer)
            local retVal = GetAura_old(self, observer)
            if retVal<0 and observer and observer.prefab=="wilson"
            then
                local distsq = self.inst:GetDistanceSqToInst(observer)
                local dist = math.sqrt(distsq)
                local moddist = math.max(1, dist-2)
                retVal = retVal * math.max(1, distsq) / math.max(1, moddist*moddist)
            end
            return retVal
        end
    end
)

Change "wilson" to your character's prefab, and the "dist-2" to increase or decrease the cutoff threshold. (More negative = bigger inner radius and the 'purple' curve appears to start more right on the graph)

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