[SUPPORT] Roguelike Deckbuilder Toolkit

Ahhh I see it now, being silly. Thanks!

I still can’t get it to work 100% though, it is weird?

If I have the artefact it plays the message and retains my hand as desired, so working at 50% correct. I then delete all artefacts in the array and play the game again, however it still retains the cards and doesn’t discard them?

If I attach the loop completion to the discard function then the discard works as it should (however it will clearly then discard my cards even if I have the artefact because it will always complete)

I added a print string to the false and despite there being nothing in the array, which should return a false it never goes down that path.


EDIT

I added a breakpoint to the code and ran through it, I got to here and it ended:

So I am guessing that maybe because there are no objects at all in the array that this just returns a false result and ends out without going through the loop, in order to return a false to discard the hand?

Yep, that seems to be the case, solved it by adding another branch to the setup:

It now discards if I have another artefact other than the one I request as well as if the array is empty.

If one wanted to have a card that when played gave health to the player, either instantly or over a number of turns how would one access that attribute?

I tried casting to “BP_Status_Health” and then running the function Add Status Value. (doing the opposite of the card effect attack) However this did not increase the player’s health.

I am doing it as a status rather than a card effect, but that shouldn’t make a huge difference right? I did it as a status as I was thinking that it might be multiple turns as well as a just one use?

I am no doubt misunderstanding something yet again, I just thought doing the opposite of minus would result in a plus?

Thanks

Hey, glad you figured out the reason for the artifact issue. As you learned, a ForEachLoop will only execute its loop body if there are any elements in the array. Beware that the loop body will execute a number of times equal to the size of the input array.

In general, if you want to search for a specific instance in an array (in cases where you cannot simply use the Find node) it is a better idea to put the for loop inside a function and to return from the function either when a branch returns true or at Completed. That way, the loop won’t go on any longer than you need after you have found the appropriate value.

However, if I have understood what you’re trying to do correctly you can do this a lot simpler by just using a Contains node:

As for your health question, I recommend looking at something like the Block card. It adds armor using AddToStatus. You can do the same for health. If you want to do it outside of a card you can use AddToStatus with a Minion as the target.

Note that by default doing this with health can extend the health of the Minion beyond its max value. If you want to avoid this you’ll need to make the following modification:

And the following if you want the unit from flinching and damage text appearing when it is healed:

1 Like

I got the healing card to work, so thanks for the advice on and that, and I added the code to stop the over heal, I seem to have done it right, though more testing may well reveal I got something wrong.

Would this not always return true also as it will be checking the datatable?

I have noticed something with a little bit of testing and that is that if I have the artefact that holds on to my shield, it also keeps it for the enemy minions as well. I am guessing because they all share the same component?

I don’t really want the advantages of the artefacts going to the enemy as well So would I need to create a new component for my hero in order for it to only work for him?

Thanks.



I noticed that the block card uses an add status, I had a look at BP_Status to see if there was a remove status and couldn’t find one?

I looked in Poisoned and found the subtract status value, so if I set the value to 0, it should remove the status? There doesn’t appear any way to access this via the card effects, so I would need to create a status that subtracts from the value, the current value (so it = 0) and that should remove it?

Do you know why I might be getting this message? I copied already existing cards to make new ones and changed very little on them.

Screenshot 2022-01-04 at 14.51.13

I added a couple of new attacks to the enemy minions and a couple of new cards to the hero character. I have had a look at all the new cards and I can’t see any issue. I appreciate this is a little ambiguous but do you know here I might start looking?

The check would not always be true here. I don’t check within the data table. I am checking within the artifact array for a struct that contains both the data table and the specific name of the artifact in that table.

For your armor issue I’d need to see how you have coded your artifact for retaining shields. There are many different ways you could go about ensuring it only affects the hero minion (I’m assuming there is only one in your game?). The minions don’t all have their own individual armor components, but they tend to listen for the same events.

You can use SetStatusValue (found in the same interface as the other two you mentioned) if you want to set a status to 0. Setting a status to 0 will destroy it provided “bCanBeZero” is false for that status blueprint.

As for your error it is hard to know exactly what is going on, since it is caused by your changes, but this warning appears if you spawn a card and don’t feed it appropriate card data. This warning can be found in the MakeCardStructFromCardData function in BPFL_Card. Are you spawning new cards in any odd ways?

This is how I have the armour set up at the moment, which I checked twice, but now appears to not be working again? Which I guess is not an issue as I will have to think of a new way of achieving the same thing at any rate; as this doesn’t work long term.

The only thing I could think of was putting another branch in there to make sure that it was the card player only?


I solved the card error message issue, I added a card to the starter deck twice, but later didn’t like the name of it, so I went to DT_Cards and changed the name of the card. However I never went to DT_Decks and updated it there, so DT_Decks was looking for a name that no longer existed. So I will have to write a reminder somewhere, that when I changed the name of a card I need to update the decks as well.



image

So can be 0 is false, I don’t set this anywhere else so assume this will remain the same from the default?

It is a duplication of “Poisoned” the only difference is that I removed the ability for it to decrease its amount (as I don’t want it to drop in value per turn, instead I want to have to use a card to remove the status)

So on my “healing” card I added under effect class BP_CardEffect_Addstatus, the affect value to 0 and then the target component is my status I want removed, the target is the card owner.

I am guessing having the effect value at 0 is an issue, because I am adding that to the status instead of setting the status. In fact I am probably making the situation worse by adding to the status.

Under effect vale though there is no option to set a status value, I tried to create a new card effect but it is not as simple as that is it?

EDIT

I made a card effect and did a set status to 0 within it and it worked. So I think, fingers crossed that is that issue solved. I have tested it and it seems to work as intended with no undesired results so far.

I have looked through the status icon and I assume this is what sets the text on the “Shield” icon when the player has shield.

I don’t want to change the font style for all other instances but I would like to have the shield text be a different colour and have a different border colour. Is there a way to affect the WBP_StatusIcon for just one instance of it?

Good to hear you got the status removal working. As for the armor component, here is a similar approach to the one you are going for, but a bit cleaner and only working on the hero minions:

In this particular case you’re in luck, because the armor status icon is the only one that uses the center text in the default project. So you should be able to just change the font and color of the center text widget directly.

If you wanted to add more types of statuses that also display a number in the center and have a different font to the armor one you would have to put in a bit more work. You could then extend the FStatusAppearance struct to include font and outline color and then use these to set them appropriately in the UpdateAppearance function i WBP_StatusIcon.

Hope that helps!

1 Like

That’s great thank you, I will look to work in your armour solution and see if I can get it to work.



On a separate note though do you know why this might be happening?

image

I appear to have lost the numbers on the minion attack icon, I am sure it used to tell you how much damage was going to be done?

EDIT

Followed the instructions and the the retaining of block works a treat, thanks very much for that…driving me up the wall.

EDIT 2

I have worked out what the issue is with the number just not 100% sure how to solve it other than to re-create everything that I had done.

So the issue is that I see the Effect.Attack and decided to add a number of other attack types, such as melee, ranged, ETC under the attack banner so Effect.Attack.Melee. This has nullified the Effect.Attack tag which means anything with it does not work any more as it used to. I tried changing the tags to the new tags but not worked it out just yet to get it to work with the new tags.

See if this fixes your issue (note that bExactMatch must be false to allow for tags nested below to read as true):

I had unticked that on a couple of other things in order to get the cards to show the card type, I just didn’t even realise that there was an attack pattern status! So I didn’t even look at it; this makes sense and has solved the issue.

Thanks very much

How is the player’s deck built?

Does the GI store the player’s cards and the data derive from there? Or does the card data get pulled directly from the Datatable?

I ask because I was thinking about adding a card upgrading system to the game, but wondered how I could/would/should update that data?

If I could pull the card data from the deck array, change an aspect of the array, most likely the effect value or mana cost…possibly repetitions? Something like that and then replace the item in the array?

The BP_PileComponent_Deck appears to pull data from the GI, however if there is no data in GI it seems to then use the “Cards” array in the BP_PileComponent.

So I am not sure which one would be best to access the current cards in hand and then to replace with the upgraded card?

I tried to make an artefact for immunity to a status effect (in this example Poison) I copied broken shield as I felt that because that did something “on attack” it might be a good idea of where to start. I then looked at the “Poisoned” BP to see how poison worked.

I had already created a card that removed poison from the player when played. So I really thought that I would be able to work this one out but I am missing something!

Have I done something simple wrong, or am I totally in the wrong place? Is there a better example in existence in the game for an “immunity” status.

I would like to have this ability for the player, but also there are certain enemy types I would like to be able to set up as not able to be poisoned, or burned, ETC (as I am adding elemental creatures to the game, I need them to be weak against some things, strong against other)

So really the artifact probably just needs to add a status to the player, and that status then needs to grant them immunity, so that I can either add it to a card or give it to an enemy (in the same way venomous is given, give the creature immunity to it also.

Any help/ suggestions of where to go what to look at ETC appreciated.

Thanks

The decks are kept in the DT_Decks data table by default. Here they are made up of references to data rows in the various card tables (such as DT_Cards). When starting the game the selected deck data table gets used by the game instance to create an array of FCard structs, which will function as the persistent deck for the entire game. When entering a battle map, this array gets looped over by the Deck Pile and Card actors are created for each one. It then gets shuffled into the Draw Pile. If you want to make peristent changes to cards you can modify the card structs within the Deck array in the Game Instance.

I’m working on finding a solution for this. There are many hacky and simple ways to do something like this, but I’m going to try to find something more elegant and extendable.

Thanks I will take a look at the Deck within the GI. Hopefully simple enough to find a card, replace a card, or alternatively just set the member of the FCard struct to some new value.

Designing the interface is going to be the harder part me thinks. Need to be able to display the current deck from the GI as selectable widgets, recognise which one is selected and then either do an auto upgrade or give the player the choice of what to upgrade…hmmmmm.

I look forward to seeing what this might be, with 12 different enemy types and 8 (so far) different heroes it would be amazing to be able to have a strength/weakness system for all those characters…I added burn damage, and enjoy it so much, that it just worked. The code for BP_Status_Cursed should be re-usable for doubling an elements damage, if a minion has the weakness status hopefully.

The double damage works if I don’t have the branch, but never seems to work with the branch so I can only assume that the Effect.Damage.Fire never calls? The card being played has the tag, so would assume that the tag would be called and listened for?

Also in “slay the spire” when you target an opponent with a card if it has a weakness of some effect the card will reflect that damage based on who it is pointing at…so the card damage will reduce to 1 or 5 x 1 if they have ghost or whatever it was called, or if they are wounded 5 x 5 will update to 5 x 10 or whatever.

I notice with the double damage the cards do not update, is there a way to update the card data based on the target, which would show to the player before they play it?

Just wanted to add this here so I don’t forget about asking about it.

Setting the flip book of my character should be really straight forward but I am have an operations nightmare and can not get a flip book set, and reset when a card is played.

I know that 2D widget stuff is not your thing but any thoughts on how I could go about playing an animation via a flip book and then having it return to the standing still flip book.

I tried to piggy back off of the existing animation set up that there is and replacing animations with flip books but no success.

As usual any thoughts, advice, ideas appreciated.

Thanks


My project seems to now just be exhibiting a lot of weird behaviour

This suddenly started happening, and as far as I am aware I haven’t changed anything to do with the cards? This happens when discovering cards either from playing the card that discovers or by winning and getting a card reward.

Minions attack twice even though they say they are only going to attack once.
Minions sometimes and only sometimes don’t display the amount of damage they are going to do?

I tried to create a video to show this all happening in one fight, but the file is too large.

Also I had the whole artifact kept my hand working and now suddenly it has stopped working again?

Hey MAIKERU_Jackson, I see the questions are pouring in, but I’m going to have to do some of these one at a time, when they can’t be answered briefly. I’ve worked to find an implementation for damage resistance/vulnerability. What I went for was adding a new variable to the minion data that keeps track of damage multipliers for different kinds of effects and an immunity status that handles this in game. I also hadd to add some new tags and event calls to have this working. Here is what you need to do in order to reproduce it:

First create a new map variable in FMinion with GameplayTags as keys and floats as values. This will be the multipliers that will alter incoming card effects that have those tags. Here is how it looks:


In this case, Trolls multiply incoming poison by three, while any incoming card effect tagged with Attack will get multiplied by 0, nullifying the damage.

Note that when you add a new variable to a struct, do the following to avoid some annoying bugs with Unreal Engine: Save your project first, then add the variable, then save only that struct. Exit the engine and click no when prompted to add anything else. Then reopen the engine and everything will work fine, without having to reattach any pins in any blueprints.

Ok, next I added a new event tag, which I use to signal that a minion’s status is going to be altered by a card (including minion abilities):

I call this the following places:


Next for the immunity status. It listens to these events called from the owning Minion’s Event Dispatcher Hub. For any card effects that call this event it checks the damage modifiers of the owning minion in its data and modifies the value of the incoming card effect appropriately (based on the gameplay tags set for that card effect in the card data table it is pulled from):

Add the immunity status to the minions you want to make use of this gameplay logic and voilà:

That took some time to figure out, so can’t go in-depth into your other questions right now. Been a while since I looked at flipbooks. Assumed it should be as easy as swapping out the flipbook depending on the incoming animation gameplay tag to the Puppet, but might be wrong.

As for the error you are getting, have you removed my old cards, perhaps? This warning might appear if the Reward Manager has been told to find cards of a specific rarity (based on the RarityWeights set in a reward card, as it does by default) and there don’t exist any cards with that rarity it will throw this warning and give the player a debug card. Check your cards and their rarities and make sure you have at least three of each for the standard three card rewards. Alternately change the reward weights in the reward cards so that you’re only finding cards from the rarities of which you have added enough cards.

2 Likes