Page 347 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Mar 28, 2020 7:31 pm
by Zo Kath Ra
bongobeat wrote: Sat Mar 28, 2020 1:39 pm It worked perfectly for a while, then it's power attack don't work anymore. Don't know if the script has an error or if it's something other related to the rest of the mod.
The script works for me, as long as I

a) Comment out this line:
party.berserkerScript.weaponUnequip(self,champion,slot)

b) Change this line:
requirements = { "critical", 2, "epic_weapons", 3 },
to
requirements = { "critical", 2 },

c) Change this line:
spell = "darkburst",
to
spell = "fireburst",

The power attack works until it runs out of charges.

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 29, 2020 12:37 am
by bongobeat
Well, with the custom spell and custom skill, the thing worked great for the first few hours I used it, since I got the sword.
The power attack recharges itself when hitting a monster.

Then after a few reload, the power attacks cannot be used anymore.

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 29, 2020 9:43 am
by Zo Kath Ra
bongobeat wrote: Sun Mar 29, 2020 12:37 am Well, with the custom spell and custom skill, the thing worked great for the first few hours I used it, since I got the sword.
The power attack recharges itself when hitting a monster.

Then after a few reload, the power attacks cannot be used anymore.
If you've used up all charges, and then call CastSpellComponent:setCharges(number) to set the charges to 1 (or any other number > 0), the power attack won't work anymore.
You have to call CastSpellComponent:recharge() first.

Code: Select all

if self.go.collection:getValue() >= 100 then
	local currentCharges = self.go.Dfire:getCharges()
	if currentCharges < self.go.Dfire:getMaxCharges() then
		if doDebug then print("Charge added, resetting count.") end
		self.go.Dfire:recharge()
		self.go.Dfire:setCharges(currentCharges + 1)

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 29, 2020 9:45 am
by Zo Kath Ra
Zo Kath Ra wrote: Sun Mar 29, 2020 9:43 am
bongobeat wrote: Sun Mar 29, 2020 12:37 am Well, with the custom spell and custom skill, the thing worked great for the first few hours I used it, since I got the sword.
The power attack recharges itself when hitting a monster.

Then after a few reload, the power attacks cannot be used anymore.
If you've used up all charges, and then call CastSpellComponent:setCharges(number) to set the charges to 1 (or any other number > 0), the power attack won't work anymore.
You have to call CastSpellComponent:recharge() first.

Code: Select all

if self.go.collection:getValue() >= 100 then
	local currentCharges = self.go.Dfire:getCharges()
	if currentCharges < self.go.Dfire:getMaxCharges() then
		if doDebug then print("Charge added, resetting count.") end
		self.go.Dfire:recharge()
		self.go.Dfire:setCharges(currentCharges + 1)
I suppose you could call CastSpellComponent:recharge() only if currentCharges == 0
But I think it doesn't hurt to call CastSpellComponent:recharge() every time you add a charge.

Re: Ask a simple question, get a simple answer

Posted: Wed Apr 01, 2020 12:20 pm
by bongobeat
Zo Kath Ra wrote: Sat Mar 28, 2020 6:44 pm
bongobeat wrote: Sat Mar 28, 2020 1:39 pm Please can somebody check the attached script of this item?
I haven't checked the script yet, but...

"The rapier of Jean Bart, the legendary pirate. It is said that he has slayed 13 drakes with this sword during the Dragon's War. A succesful hit replenishes its power attack."

has slayed -> slew
succesful -> successful
Thanks! :lol:

Re: Ask a simple question, get a simple answer

Posted: Wed Apr 01, 2020 12:23 pm
by bongobeat
Zo Kath Ra wrote: Sun Mar 29, 2020 9:45 am
Zo Kath Ra wrote: Sun Mar 29, 2020 9:43 am
bongobeat wrote: Sun Mar 29, 2020 12:37 am Well, with the custom spell and custom skill, the thing worked great for the first few hours I used it, since I got the sword.
The power attack recharges itself when hitting a monster.

Then after a few reload, the power attacks cannot be used anymore.
If you've used up all charges, and then call CastSpellComponent:setCharges(number) to set the charges to 1 (or any other number > 0), the power attack won't work anymore.
You have to call CastSpellComponent:recharge() first.

Code: Select all

if self.go.collection:getValue() >= 100 then
	local currentCharges = self.go.Dfire:getCharges()
	if currentCharges < self.go.Dfire:getMaxCharges() then
		if doDebug then print("Charge added, resetting count.") end
		self.go.Dfire:recharge()
		self.go.Dfire:setCharges(currentCharges + 1)
I suppose you could call CastSpellComponent:recharge() only if currentCharges == 0
But I think it doesn't hurt to call CastSpellComponent:recharge() every time you add a charge.
thanks! I will give it a try.

Re: Ask a simple question, get a simple answer

Posted: Wed Apr 01, 2020 12:35 pm
by bongobeat
Is "fitContainer = false," necessary to a container item?

I've accidentaly omitted the line "fitContainer = false," in a custom container item. So you can put the container into another container, and you can open it from there. I've noticed that during the test of my mod.

I found that practicall, but I don't know if this is safe and cannot do some issues later with the inventory

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 02, 2020 12:45 pm
by Zo Kath Ra
bongobeat wrote: Wed Apr 01, 2020 12:35 pm Is "fitContainer = false," necessary to a container item?

I've accidentaly omitted the line "fitContainer = false," in a custom container item. So you can put the container into another container, and you can open it from there. I've noticed that during the test of my mod.

I found that practicall, but I don't know if this is safe and cannot do some issues later with the inventory
I've never had any problems with containers that fit inside other containers, such as
- keyring
- shotgun (reload it by manually putting shells inside)
- sword (increase its attack power by putting gems inside)

It just looks weird, because only one container UI can be open at any time.

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 02, 2020 6:07 pm
by minmay
If you allow the player to place containers inside other containers, it immediately introduces two problems. First, they can put a container inside itself and crash the game:
1. Open container A
2. Put container B inside container A
3. Open container B
4. Put container A inside container B, causing an immediate stack overflow

Second, they can put items in and out of a container they aren't carrying:
1. Open container A
2. Put container B inside container A
3. Open container B
4. Drop container A
5. Container B's interface remains open, so now the player can put items in it even though they aren't carrying it anymore - effectively letting them teleport items across the dungeon, drink potions they aren't carrying, modify the weight of the container they aren't carrying, all sorts of mayhem.



That said, I think you could prevent these with a careful PartyComponent.onClickItemSlot hook.

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 03, 2020 12:49 am
by bongobeat
Ah yes, it's definetely not good. :lol:

I found that funny, but it's better if I don't mess with that. Beside this becomes too hard scripting.