Sign in to follow this  
TheBigDeal

Upgrade like system.

Recommended Posts

Aquaterion    821

For eating souls does nothing, make sure the if statements say food.prefab == "revenge" for example and not food.prefab == "bluesoul" if you did the last change to rename them to their power.

For the tab issue, you didn't add soultab.xml/.tex to the Asset table.

As for the first issue.. im not sure? does ur character have "soul_builder" tag?

 

Share this post


Link to post
Share on other sites
TheBigDeal    22

I'll just share this code bit:

	local eater = inst.components.eater
	table.insert(eater.preferseating, FOODTYPE.SOULS)
	table.insert(eater.caneat, FOODTYPE.SOULS)
	eater:SetOnEatFn(
    function(inst, food)
		if food.components.edible and food.components.edible.foodtype == FOODTYPE.SOULS then
        	--inst.SoundEmitter:PlaySound("some_sound_here_for_consuming_souls")
		
			if food.prefab == "determination" then
				local percent = inst.components.health:GetPercent()
				inst.components.health:SetMaxHealth(inst.components.health.maxhealth + 50)
				inst.components.health:SetPercent(percent)
			elseif food.prefab == "bravery" then
				local percent = inst.components.health:GetPercent()
				inst.components.health:SetMaxHealth(inst.components.health.maxhealth + 30)
				inst.components.health:SetPercent(percent)
			elseif food.prefab == "integrity" then
				local percent = inst.components.health:GetPercent()
				inst.components.health:SetMaxHealth(inst.components.health.maxhealth + 30)
				inst.components.health:SetPercent(percent)
			elseif food.prefab == "kindness" then
				local percent = inst.components.health:GetPercent()
				inst.components.health:SetMaxHealth(inst.components.health.maxhealth + 10)
				inst.components.health:SetPercent(percent)
			elseif food.prefab == "patience" then
				local percent = inst.components.hunger:GetPercent()
				inst.components.hunger:SetMax(inst.components.hunger.max + 20)
				inst.components.hunger:SetPercent(percent)
			elseif food.prefab == "perseverance" then
				local percent = inst.components.health:GetPercent()
				inst.components.health:SetMaxHealth(inst.components.health.maxhealth + 25)
				inst.components.health:SetPercent(percent)
			elseif food.prefab == "justice" then
				if inst.components.combat.damagemultiplier == nil then
					inst.components.combat.damagemultiplier = 1
				end
			inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier + 0.25
			elseif food.prefab == "revenge" then
				if inst.components.combat.damagemultiplier == nil then
					inst.components.combat.damagemultiplier = 1
				end
			inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier + 0.50
			end
        end
    end
)
	inst:AddTag(FOODTYPE.SOULS.."_eater")

So yeah they all == the right thing.

 

Icon works fine now.

 

And yeah the character has the soul_builder tag.

Share this post


Link to post
Share on other sites
TheBigDeal    22
1 hour ago, Aquaterion said:

You could either add some prints in the SetOnEatFn function. also could u link the souls.lua again if that doesnt work

Also, forgot to say, it doesn't seem that the print works either.

Share this post


Link to post
Share on other sites
Aquaterion    821

atm the souls are called "redsoul", "bluesoul", etc. So you either change those to named as their powers like so;

 

--change this(in souls.lua): 
return Prefab(color.."soul", fn, assets)
--to:
return Prefab(power, fn, assets)

or.. you change every thing else in recipes and ur character.lua to reference them as food.prefab == "redsoul" and such

 

 

Share this post


Link to post
Share on other sites
TheBigDeal    22
43 minutes ago, Aquaterion said:

atm the souls are called "redsoul", "bluesoul", etc. So you either change those to named as their powers like so;

 


--change this(in souls.lua): 
return Prefab(color.."soul", fn, assets)
--to:
return Prefab(power, fn, assets)

or.. you change every thing else in recipes and ur character.lua to reference them as food.prefab == "redsoul" and such

 

 

Alright, works 100% now, all souls give what they should, but I was wondering, is there anything i can have them buff besides sanity, hunger and damage, since there are 8 souls It would be nice for each to do something different.

Share this post


Link to post
Share on other sites
Aquaterion    821
11 minutes ago, TheBigDeal said:

Alright, works 100% now, all souls give what they should, but I was wondering, is there anything i can have them buff besides sanity, hunger and damage, since there are 8 souls It would be nice for each to do something different.

shoulda taught about that before you added them haha..

lets see.. maybe speed boost.. absorption? maybe bravery gives a random 1?

Share this post


Link to post
Share on other sites
TheBigDeal    22
4 minutes ago, Aquaterion said:

shoulda taught about that before you added them haha..

lets see.. maybe speed boost.. absorption? maybe bravery gives a random 1?

Not so much speed boost, he's a pretty big, and therefore slow character so I don't really want that to change, absorption would be nice but he'd already be able to get quite a bit of health, I still gotta think of very hard recipes for these souls, or better yet would be a way for them to be randomly found in the world.

 

Is there, probably a long shot but, a way to make it so once a player dies instead of becoming a ghost he'd be instantly revived at a location. I was thinking that once you eat the determination soul, it will place down some sorta marker maybe which will do just that, and after one use will go away. Also somehow limit there to only be one of those... I can see it being sorta easy and sorta hard at the same time...

 

Once more thanks for all the help. I can't wait to finish this mod.

Share this post


Link to post
Share on other sites
TheBigDeal    22
5 minutes ago, Aquaterion said:

Yea it's possible, I would help you right now, but I'm about to go to sleep, if no 1 helps you by then, I'll prob help you out tomorrow

Alright thanks!

Share this post


Link to post
Share on other sites
TheBigDeal    22
6 hours ago, Aquaterion said:

Yea it's possible, I would help you right now, but I'm about to go to sleep, if no 1 helps you by then, I'll prob help you out tomorrow

So I met with my friend who is pretty much my art person for the mod and we discussed what each soul will do:

Determination [Red Soul] - On eating, spawns a SAVE Point, where once the player dies, will instantly respawn. Once respawned the SAVE point will delete itself, only one save point can be on the map at once. Will have to find a way so if another red soul is eaten it won't be used if there already is a save point, or just have it overwrite the last one.

Bravery - Higher Absorption

Integrity - Higher Attack Speed, if that's even a thing

Patience - Has a chance to double drops up to 75%

Justice - Deals more damage to evil monsters (Only one I can think of atm is hounds but i know there are more)

Perseverance - Higher Max Sanity

Kindness - More Hunger

Revenge - Can only be consumed once, very hard to get, creates a new meter on how many things the player kills, the more kills, the more damage the soul will give to the player, also will passively shoot out from player damaging enemies (rarely)

 

Hopefully all of this is possible and not too hard, this is more of a wish list that we came up with lol.

Also to add, i realized a pretty big problem that I have no idea how I did not notice before.

All of my items, may it be the trident or souls, do not appear while on the ground, so something it wrong there.

 

If i come up with more things I'll edit this post.

 

EDIT: I was thinking about making the soul's stack-able just because having more than one would be very annoying if they were not, so i put the following:

		inst:AddComponent("stackable")
		
		inst.components.stackable.maxsize = 5

But it gives this error:

[00:01:05]: [string "scripts/components/stackable_replica.lua"]:21: attempt to perform arithmetic on field '?' (a nil value)
LUA ERROR stack traceback:
    scripts/components/stackable_replica.lua:21 in (method) SetMaxSize (Lua) <20-22>
    scripts/components/stackable.lua:11 in (field) ? (Lua) <10-12>
    scripts/class.lua:30 in () ? (Lua) <23-32>
    ../mods/Asgore/scripts/prefabs/souls.lua:46 in (field) fn (Lua) <9-49>
    scripts/mainfunctions.lua:146 in () ? (Lua) <135-177>
    =[C]:-1 in (method) SpawnPrefab (C) <-1--1>
    scripts/mainfunctions.lua:191 in (global) SpawnPrefab (Lua) <188-193>
    scripts/util.lua:23 in (global) DebugSpawn (Lua) <20-29>
    scripts/consolecommands.lua:137 in (global) c_spawn (Lua) <133-144>
    c_spawn("determination", 5):1 in () ? (main) <0-0>
    =[C]:-1 in (global) pcall (C) <-1--1>
    scripts/mainfunctions.lua:1338 in (global) ExecuteConsoleCommand (Lua) <1330-1347>
    scripts/screens/consolescreen.lua:129 in (method) Run (Lua) <116-131>
    scripts/screens/consolescreen.lua:222 in (field) fn (Lua) <220-227>
    scripts/scheduler.lua:194 in (method) OnTick (Lua) <168-225>
    scripts/scheduler.lua:406 in (global) RunScheduler (Lua) <404-412>
    scripts/update.lua:166 in () ? (Lua) <150-223>

Everything else works 100% fine.

client_log.txt

Edited by TheBigDeal

Share this post


Link to post
Share on other sites
Aquaterion    821
--Determination Power

--in: asgore.lua(these shouldnt be in any function, but above master_postinit)
local function OnDeath(inst)
	if inst.savelocation then
		inst:DoTaskInTime(2, function()--estimate time it takes to do the death animation
		inst.Transform:SetPosition(inst.savelocation.x, inst.savelocation.y, inst.savelocation.z)
		inst:PushEvent("respawnfromghost", {source= {name="Determination", components ={}}})
		inst.savelocation = nil
		end)
	end
end

local function OnSave(inst, data)
	if inst.savelocation then
		data.savelocation = inst.savelocation
	end
end
--saving and loading the savelocation
local function OnLoad(inst, data)
	if data and data.savelocation then
		inst.savelocation = data.savelocation
	end
end

--in asgore.lua masterpostinit function:(you should already have the if part, just change its contents)
if food.prefab == "determination" then
    local x,y,z = inst.Transform:GetWorldPosition()
    inst.savelocation = {x=x,y=y,z=z}
end

inst:ListenForEvent("death", OnDeath)
	
inst.OnSave = OnSave
inst.OnLoad = OnLoad

 

As for the stacksize, for some reason you can only do 10, 20 or 40 stacksize.

 

Btw, I wouldn't mess with attack speed, as modifying it to be higher even slightly, could make you easily stun lock mobs

The revenge perk, UI is pretty complicated to make in DST due to having to do net variables and stuff.

How about instead for the revenge perk, if you get hit by a mob(maybe depending on how much damage it did to you) you do extra damage to it. so it would never work on passive mobs since they dont attack back, and such.

 

Doubling Drops, I never really messed around with loottables, not sure how easy it is to achieve that

 

Justice should be easy, just gotta know what monster tags you wanna effect I guess.. But does this last forever? Does consuming multiple increase the damage?

 

Edited by Aquaterion

Share this post


Link to post
Share on other sites
TheBigDeal    22
7 hours ago, Aquaterion said:

--Determination Power

--in: asgore.lua(these shouldnt be in any function, but above master_postinit)
local function OnDeath(inst)
	if inst.savelocation then
		inst:DoTaskInTime(2, function()--estimate time it takes to do the death animation
		inst.Transform:SetPosition(inst.savelocation.x, inst.savelocation.y, inst.savelocation.z)
		inst:PushEvent("respawnfromghost", {source= {name="Determination", components ={}}})
		inst.savelocation = nil
		end)
	end
end

local function OnSave(inst, data)
	if inst.savelocation then
		data.savelocation = inst.savelocation
	end
end
--saving and loading the savelocation
local function OnLoad(inst, data)
	if data and data.savelocation then
		inst.savelocation = data.savelocation
	end
end

--in asgore.lua masterpostinit function:(you should already have the if part, just change its contents)
if food.prefab == "determination" then
    local x,y,z = inst.Transform:GetWorldPosition()
    inst.savelocation = {x=x,y=y,z=z}
end

inst:ListenForEvent("death", OnDeath)
	
inst.OnSave = OnSave
inst.OnLoad = OnLoad

 

As for the stacksize, for some reason you can only do 10, 20 or 40 stacksize.

 

Btw, I wouldn't mess with attack speed, as modifying it to be higher even slightly, could make you easily stun lock mobs

The revenge perk, UI is pretty complicated to make in DST due to having to do net variables and stuff.

How about instead for the revenge perk, if you get hit by a mob(maybe depending on how much damage it did to you) you do extra damage to it. so it would never work on passive mobs since they dont attack back, and such.

 

Doubling Drops, I never really messed around with loottables, not sure how easy it is to achieve that

 

Justice should be easy, just gotta know what monster tags you wanna effect I guess.. But does this last forever? Does consuming multiple increase the damage?

 

Wow, that worked perfectly, Only thing to add, how would i make it so it sorta drops a object down, to mark the save point? And maybe give it a simply animation also.

 

As for the revenge, it would be hard for players to track that and make sure it is actually working, would it atleast be possible to do the part where the soul will passively attack enemies, if so I'd probably literally take the soul, texture and all and shoot it at enemies,.

 

We can replace double drops, and as for Justice it would probably last until death, unless a save point is used from determination.

as for the monsters, it would be any hostile mob, but not bosses:

 

Share this post


Link to post
Share on other sites
Aquaterion    821

Revenge: By Passively attack enemies, do you mean an AoE DoT? or randomly shoot projectile out of you? As for tracking the buff, you could add some particles to the target(fx prefab)

Determination: You can create a prefab at looks like a marker and then just spawn it when you eat the soul, but atm it doesn't check if the player has another determination active, it just overwrites it so you'd have to check for that to make it despawn when a new 1 spawns.

Justice: What happens when you eat a second one?

 

 

Share this post


Link to post
Share on other sites
TheBigDeal    22

In revenge i mean a projectile, and when you eat a second one it would probably deal more damage. up to a stack of maybe 4 souls. After 4 souls it can just replenish Health maybe.

Edited by TheBigDeal

Share this post


Link to post
Share on other sites
Aquaterion    821

For some reason the revenge perk seems weird. I mean randomly shooting projectiles at entities? Maybe damage done to you is reflected or something? Random Projectiles dont scream "revenge" :p

Share this post


Link to post
Share on other sites
TheBigDeal    22
4 minutes ago, Aquaterion said:

For some reason the revenge perk seems weird. I mean randomly shooting projectiles at entities? Maybe damage done to you is reflected or something? Random Projectiles dont scream "revenge" :p

Yeah, I agree but i'm not sure because the revenge soul is supposed to be the rarest and most powerful, and it's all about killing things alot so I'm not sure, the reflected idea isnt bad, but i'm not sure what else there can be.

If anything the reflected damage isn't a bad idea at all so maybe just use that for now, and once i release the mod maybe some ideas will come up then, but I still need to make 2 more items after these and finish the sprite, and with the 2 item's one is fire magic and i have no idea where to go with that really since it isn't exactly an object the character is holding but just... fire.

Share this post


Link to post
Share on other sites
Aquaterion    821

Ok I modified some of the previous functions, so you'll have to replace them or merge them;

I made Revenge similar to Justice, can go up to 4 times(reflecting 25% each 1) and is lost on death

 

local function IsValidVictim(victim)
    return victim ~= nil
        and not ((victim:HasTag("prey") and not victim:HasTag("hostile")) or
                victim:HasTag("veggie") or
                victim:HasTag("structure") or
                victim:HasTag("wall") or
                victim:HasTag("companion"))
        and victim.components.health ~= nil
        and victim.components.combat ~= nil
		and not victim:HasTag("epic")
end

local function OnAttack(inst, data)
	local target = data.target
	if IsValidVictim(target) then
		local basedamage = (data.weapon and data.weapon.components.weapon.damage) or (inst.components.combat and inst.components.combat.defaultdamage)
		target.components.combat:GetAttacked(inst, basedamage*inst.justicepower, data.weapon)
	end
end

local function OnHit(inst, data)
	if data and IsValidVictim(data.attacker) and data.damage then
		target.components.combat:GetAttacked(inst, data.damage*inst.revengepower)
	end
end

local function OnDeath(inst)
	if inst:HasTag("justice") then
		inst:RemoveEventCallback("onattackother", OnAttack)
		inst:RemoveTag("justice")
		inst.justicepower = nil
	end
	if inst:HasTag("revenge") then
		inst:RemoveEventCallback("attacked", OnHit)
		inst:RemoveTag("revenge")
		inst.revengepower = nil
	end
	if inst.savelocation then
		inst:DoTaskInTime(2, function()--estimate time it takes to do the death animation
		inst.Transform:SetPosition(inst.savelocation.x, inst.savelocation.y, inst.savelocation.z)
		inst:PushEvent("respawnfromghost", {source= {name="Determination", components ={}}})
		inst.savelocation = nil
		end)
	end
end

local function OnSave(inst, data)
	if inst.savelocation then
		data.savelocation = inst.savelocation
	end
	if inst.justicepower then
		data.justicepower = inst.justicepower
	end
	if inst.revengepower then
		data.revengepower = inst.revengepower
	end
end
--saving and loading the savelocation/justicepower/revengepower
local function OnLoad(inst, data)
	if data then
		if data.savelocation then
			inst.savelocation = data.savelocation
		end
		if data.justicepower then
			inst.justicepower = data.justicepower
		end
		if data.revengepower then
			inst.revengepower = data.revengepower
		end
	end
end

--master post_init(This is the whole SetOnEatFn function i have, youll have to copy the parts you need only):
inst.components.eater:SetOnEatFn(function(inst, food)
		if food.prefab == "determination" then
			local x,y,z = inst.Transform:GetWorldPosition()
			inst.savelocation = {x=x,y=y,z=z}
		elseif food.prefab == "justice" then
			if not inst:HasTag("justice") then
				inst:AddTag("justice")
				inst:ListenForEvent("onattackother", OnAttack)
			end
			if inst.justicepower == nil or inst.justicepower < 1 then
				inst.justicepower = inst.justicepower and inst.justicepower + .25 or 0.25
			else
				inst.justicepower = 1--just incase it somehow went over the cap
				inst.components.inventory:GiveItem(SpawnPrefab("justice"))--give him a soul back
			end
		elseif food.prefab == "revenge" then
			if not inst:HasTag("revenge") then
				inst:AddTag("revenge")
				inst:ListenForEvent("attacked", OnHit)
			end
			if inst.revengepower == nil or inst.revengepower < 1 then
				inst.revengepower = inst.revengepower and inst.revengepower + .25 or 0.25
			else
				inst.revengepower = 1--just incase it somehow went over the cap
				inst.components.inventory:GiveItem(SpawnPrefab("revenge"))--give him a soul back
			end
		end
	end)
Edited by Aquaterion

Share this post


Link to post
Share on other sites
TheBigDeal    22
30 minutes ago, Aquaterion said:

Ok I modified some of the previous functions, so you'll have to replace them or merge them;

I made Revenge similar to Justice, can go up to 4 times(reflecting 25% each 1) and is lost on death

  Hide contents


local function IsValidVictim(victim)
    return victim ~= nil
        and not ((victim:HasTag("prey") and not victim:HasTag("hostile")) or
                victim:HasTag("veggie") or
                victim:HasTag("structure") or
                victim:HasTag("wall") or
                victim:HasTag("companion"))
        and victim.components.health ~= nil
        and victim.components.combat ~= nil
		and not victim:HasTag("epic")
end

local function OnAttack(inst, data)
	local target = data.target
	if IsValidVictim(target) then
		local basedamage = (data.weapon and data.weapon.components.weapon.damage) or (inst.components.combat and inst.components.combat.defaultdamage)
		target.components.combat:GetAttacked(inst, basedamage*inst.justicepower, data.weapon)
	end
end

local function OnHit(inst, data)
	if data and IsValidVictim(data.attacker) and data.damage then
		target.components.combat:GetAttacked(inst, data.damage*inst.revengepower)
	end
end

local function OnDeath(inst)
	if inst:HasTag("justice") then
		inst:RemoveEventCallback("onattackother", OnAttack)
		inst:RemoveTag("justice")
		inst.justicepower = nil
	end
	if inst:HasTag("revenge") then
		inst:RemoveEventCallback("attacked", OnHit)
		inst:RemoveTag("revenge")
		inst.revengepower = nil
	end
	if inst.savelocation then
		inst:DoTaskInTime(2, function()--estimate time it takes to do the death animation
		inst.Transform:SetPosition(inst.savelocation.x, inst.savelocation.y, inst.savelocation.z)
		inst:PushEvent("respawnfromghost", {source= {name="Determination", components ={}}})
		inst.savelocation = nil
		end)
	end
end

local function OnSave(inst, data)
	if inst.savelocation then
		data.savelocation = inst.savelocation
	end
	if inst.justicepower then
		data.justicepower = inst.justicepower
	end
	if inst.revengepower then
		data.revengepower = inst.revengepower
	end
end
--saving and loading the savelocation/justicepower/revengepower
local function OnLoad(inst, data)
	if data then
		if data.savelocation then
			inst.savelocation = data.savelocation
		end
		if data.justicepower then
			inst.justicepower = data.justicepower
		end
		if data.revengepower then
			inst.revengepower = data.revengepower
		end
	end
end

--master post_init(This is the whole SetOnEatFn function i have, youll have to copy the parts you need only):
inst.components.eater:SetOnEatFn(function(inst, food)
		if food.prefab == "determination" then
			local x,y,z = inst.Transform:GetWorldPosition()
			inst.savelocation = {x=x,y=y,z=z}
		elseif food.prefab == "justice" then
			if not inst:HasTag("justice") then
				inst:AddTag("justice")
				inst:ListenForEvent("onattackother", OnAttack)
			end
			if inst.justicepower == nil or inst.justicepower < 1 then
				inst.justicepower = inst.justicepower and inst.justicepower + .25 or 0.25
			else
				inst.justicepower = 1--just incase it somehow went over the cap
				inst.components.inventory:GiveItem(SpawnPrefab("justice"))--give him a soul back
			end
		elseif food.prefab == "revenge" then
			if not inst:HasTag("revenge") then
				inst:AddTag("revenge")
				inst:ListenForEvent("attacked", OnHit)
			end
			if inst.revengepower == nil or inst.revengepower < 1 then
				inst.revengepower = inst.revengepower and inst.revengepower + .25 or 0.25
			else
				inst.revengepower = 1--just incase it somehow went over the cap
				inst.components.inventory:GiveItem(SpawnPrefab("revenge"))--give him a soul back
			end
		end
	end)

It gave that that variable 'target' is not declared, in onHit. Justice works fine though

Share this post


Link to post
Share on other sites
Aquaterion    821

oh ye my bad

target.components.combat:GetAttacked(inst, data.damage*inst.revengepower)
--to
data.attacker.components.combat:GetAttacked(inst, data.damage*inst.revengepower)

 

Share this post


Link to post
Share on other sites
TheBigDeal    22

Alright, I'm getting an error with Justice actually after testing.

[00:07:16]: [string "../mods/Asgore/scripts/prefabs/asgore.lua"]:58: variable 'OnAttack' is not declared
LUA ERROR stack traceback:
=[C]:-1 in (global) error (C) <-1--1>
scripts/strict.lua:23 in () ? (Lua) <21-26>
   t = table: 1F4A6820
   n = OnAttack
../mods/Asgore/scripts/prefabs/asgore.lua:58 in (local) fn (Lua) <48-76>

 

client_log.txt

33 minutes ago, Aquaterion said:

oh ye my bad


target.components.combat:GetAttacked(inst, data.damage*inst.revengepower)
--to
data.attacker.components.combat:GetAttacked(inst, data.damage*inst.revengepower)

 

Also, I was about to start making the marker but I was just thinking and thought of some potential problems.

Firstly, would it be possible for it to show on the map?

Secondly, What resolution should it be, since i wouldn't be replacing a weapon or anything.

Thirdly, How would i add an animation to this object

Lastly, How would I get it to deploy when eaten and remove the last marker if it is being overridden.

Share this post


Link to post
Share on other sites
Aquaterion    821

Can you post ur asgore.lua maybe there was some conflict with something you had before.

1. Yes

2. I'd say find something similar to what you're thinking, like if its gonna be like a slightly lit area like fireflies, you could do that, if its a floor marker than you could copy something like a pond.

3. Erm depends what you want.. with spriter

4. I can help you do that(by spawning it and teleporting it to the player when you eat the thing)

Share this post


Link to post
Share on other sites
TheBigDeal    22

Yeah the firefly idea seems good, as well as emitting light is also a good idea. I'll also look into spriter later then, it'd only be like 2 frames, just rotating, it'll resemble this:

this

I'll start to make it now. Shouldn't take long

Also here is Asgore.lua, should have also said, it seems to happen when I attack a non-hostile mob, for example a beefalo.

 

asgore.lua

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
Sign in to follow this