Search Unity

KINGS - Card Swiping Decision Game Asset

Discussion in 'Assets and Asset Store' started by Maulwurfmann, Nov 26, 2017.

  1. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Thanks for the investigation, but I don't think this solution will work for me because of how I have things set up. I'll find another way. I would still love to hear if it's possible to put multiple "Consume" buttons on an item though.
     
  2. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    there are limited possibilities for this. It is possible to make item detail views per item. This can contain additional buttons and images which are bypassing the internal structures. I will give an example:

    The prefabs for the item UI are located at:
    Project->Kings->addons->Inventory->Prefabs

    The default prefab for the consume is the one named "InventoryItem_DetailedConsumeable". For this example I duplicated this prefab and modified it to have another button. I called it "CrystalBall_UseDiscard" because I want to make special operations for the crystal ball item:
    ItemPrefab_UseDiscard.PNG
    The second button was a copy of the "Use Item" button and was partially reconfigured to have a new behaviour:
    1. Destroy the UI element within the game to close the view
    (in this example I linked the "Destroy" script, which was attached to the close button)
    2. Send the global message "spawnEnd", this will reeanable the movement/swiping of cards. This was already from the "Use Item" Button.
    3. Remove one crystal ball by calling a "MakeChanges" script which was attached to the button. The configuration then looks like this:
    CrystalBall_DiscardButtonConfig.PNG

    To use this prefab of a panel, which shall be only for a specific item, I configured the item to override the panel. This is done in the item configuration, in this example for the crystal ball:
    CrystalBall_PanelOverride.PNG


    If the item is now selected within the game, it shows the new panel with two buttons. Only for this item:
    CrystalBall_PanelOverride_inGame.PNG

    If I press Discard, the panel is closed, one crystal ball is removed and the game goes back to usual.

    I hope this helps.
     
  3. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Excellent, thank you so much for taking the time! This will really help me set up my item system properly :)
     
  4. yazidane

    yazidane

    Joined:
    Oct 6, 2015
    Posts:
    29
    I want the ads below the menu bar. It should not cover the menu. Maybe move the menu bar to more upper.

    My games will be in potrait mode.
     
  5. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    The lower bar is not the menu bar, this one is the inventory panel. The position of the inventory panel should not be controlled by a script and can moved freely. Did you try moving or rearrange the interface element? Perhaps you have to change the drawing order by moving it within the GameCanvas to a lower position or adjust the horizontal layout group, depending on your requirements.
     
  6. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Hey there. I'm trying to launch my game and keep getting this bug when I start drawing from the card stack. I can't tell what the actual problem is here, do you know?
     

    Attached Files:

    • BUG.PNG
      BUG.PNG
      File size:
      82.5 KB
      Views:
      333
  7. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Thank you for the callstack.
    NullReferenceException says theres something missing and could not be accessed as programmed.
    If I see this correctly, it happens when a specific card despawns. This has the scripts "ConditionalActionList" attached. There is a condition (e.g. for giving stuff or a next card or something) which shall be evaluted. In this condition it depends on the number of some items (the last call is to "Inventory.GetItemCount"), then the error happens.

    Because the item it should count doesn't exist. It is not configured which item it should count. The slot propably is empty. This can happen if you didn't linked it, or it was deleted (or perhaps renamed and Unity doesn't recognize it anymor). Look for an condition on the card in one of the scripts which looks similar to this:
    inventoryMissing.PNG
    Perhaps theres some other text, but the item is not linked correctly.

    Thats my guess. I hope this helps.
     
  8. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Thanks! I'll be on the lookout for missing items from now on. I have run into a problem with the way I implemented the armor system. Here's my logic:

    1) The player needs to be rewarded stats for wearing armor.
    2) The only way to reward stats for "wearing" something is to give a value bonus on a swipe event that equips it. Then, as a consume effect, remove the same amount of stats.
    3) However, when the player discovers a new armor while they already have one equipped, prompt them with a card that if accepted, set all armors except the new one to 0, set the new one to 1. This "swaps" the armor.
    4) But it doesn't remove the stats that the armor was providing because the armor was never "consumed" just set to 0. :(

    How can I make the armor "consumed" when the player swaps it? Or perhaps there's a better way of achieving what I am trying to do?
     
  9. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    The more I think about it, the more I think it's better if there's just an "in_inventory" state, it will future-proof me from other problems. Can I create something like that using the scripts already in the asset?
     
  10. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Checkmate,
    sorry I'm a little bit busy at the moment. Overall, the behaviour you are describing sounds more like a specialized script than something within the Kings asset is easy achievable with existing scripts. Like it was mentionened, the inventory system was never layed out for such complex tasks, sorry.
    Regarding your "in_inventory" state, could you describe what you want to achieve here and where to put it? It is not clear to me.
     
  11. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    That's okay, don't feel rushed or anything. I'm very limited in my technical skills, so any help is appreciated but don't feel obligated. For an "in_inventory" state, I want the system to recognize when an item is being held and provide value changes while it is in that state. If the item is removed from the inventory, its "in_inventory" state would be off. The goal is that an item has an effect while you are holding it, not just upon pickup or discard because doing it that way is causing me a lot of problems. As for where to put it, I would say in the item itself would be the most logical place to me, but perhaps you would know better.
     
  12. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Chekmate,
    I was thinking about it some time. The "in_inventory" State is equivalent to a condition which checks if more than 0 items are in the inventory.
    I've given the whole thing a little more thought on my part. It would be great to have a setting on the item itself, how it affects an value, e.g. for each item which is in the inventory. It would be great if theres nothing to memorize and the items in the inventory can directly modify stats. These stats could be tomporary Kings-values, which are ONLY controlled by the inventory. How they affect other values could be calculated later, e.g. with the script "ValueMath" which is already a part of the package.

    Let me give an example what the result could look like:
    There could be a value "Stat_Armory".
    An item "LightArmor" will give +5 for this stat, another item "HeavyArmor" will give a +10 for this stat.
    How many Armors a player can have is dependent on your logic and will not be checked by the inventory system itself.
    Every time, the inventory changes it will check for the stat-changes:
    It resets the temporary value to 0, then sum all the corresponding stat changes. This way there would be no need to memorize the change itself.
    If the item is consumed or discarded, the inventory would change and trigger the recomputation of this stat value.

    If theres an event which needs the value (e.g. a fight) the script "ValueMath" could be used to calculate the damage by subtracting the armor value from the damage value (perhaps also something temporary) and subtracting that again from a live value.

    Please tell me, if this sounds fitting for your application.
     
  13. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Hey there, thanks for taking the time! I think I understand, however the last part regarding "ValueMath" is not needed because that's not really how I am using Armor. To make sure everything is clear, and there isn't any miscommunication for my needs, I will tell you in detail how I am using Armor in my game:

    1) The loot system in my game needs items which make the player more powerful. This way they are interested in getting these items to improve their 4 main stats: Strength, Speed, Intellect, and Charm.

    2) Therefore, each piece of Armor needs to improve those stats, for example "Fancy Boots" will give the player: +5 Charm and +5 Speed for as long as they are equipped (currently I fake the "equipped" functionality as I have already described).

    3) The player has 3 different types of Armor items: Boots, Weapon, and Armor. The player can only have one of each equipped at a time. For example, if they find another pair of Boots while they are already wearing Boots and they try to equip them, they are prompted with a card which says "Would you like to swap?", however this leads to problems as I have already described because the previous bonus provided by the first Boots is never removed.

    I think that covers everything. I just want to be extra clear so there is no confusion. It may also be useful to know that enemies deal damage to the player's stats; there is no HP. For example, a Wizard would deal damage to the player's intellect if they lose the battle. But yes, as I mentioned earlier, the game has no current need for "Damage mitigation" by doing a ValueMath calculation as you described, however, if this is just an extra bonus of implementing the way you described, then that is fine! I just wanted to be clear about my needs and make sure there wasn't a misunderstanding!

    Let me know if that makes sense, or if you have any more questions! Thanks!
     
  14. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,

    since I think it is a useful extension, I have implemented the item-stats.
    If someone wants to implement this update, please read the documentation first.
    And don't forget to make a backup of your project first.

    @Chekmate : Sorry, but it will not fit correctly to your issue. The value for the item stats should be only modified from items, because it gets recalculated every time the inventory changes. However, I mention a workaround in the documentation by creating a displayed value from the stats-value added to an temporary value which can be altered.
    However, I have not tested this.

    I hope this helps. Feedback is welcome.
     

    Attached Files:

    Chekmate likes this.
  15. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    I don't understand the workaround. If you have a spare moment, could you explain further? I would like to try it. If it doesn't work, I will have to redesign a lot of things.
     
  16. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    it updated the update package with a script which simplifies the summation of values. I also found a bug regarding the stats summation from inventory items (it was not actulicing if the item was removed completely). The principle in short:
    ValueSuperposition.png
    I further explained the principle and the value-setup in the attached update documentation.
    The updated package is also attached.

    I hope this helps.
     

    Attached Files:

    Chekmate likes this.
  17. furkan1aktas

    furkan1aktas

    Joined:
    May 2, 2018
    Posts:
    33
    Hello, I want to add a language option to the landing page of the game. But I don't have the code information to do this. I just write. Can you please prepare for me? It is enough to have something very simple. I have no idea how to add it. Please help me. You are a very helpful team. You have always helped so far. Thank you for that. I hope you help me.
     
  18. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    I got most things working correctly! Thank you! However for some reason my starting values have gone buggy and I can't figure out what is going wrong. I took a screenshot to show you my set up. Let me know if I can provide any further information.
     

    Attached Files:

  19. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Chekmate,

    I assume the error messages occures the moment you press Play.
    In this case, close the additional Inspector tabs first. This is an old Unity error.

    Regarding the starting values. Did you reset the player prefs (not in playmode -> Inspector -> scripts -> Delete Player Prefs) or did you play until GameOver and restarted the game? Without this the initial values are not refreshed.

    I hope this helps.
     
    Last edited: May 2, 2020
  20. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi furkan1aktas,

    if I remember correctly, you are using I2Localization?
    By landing page you are referring to the "FirstStartPanel" of Kings?
    Do you want to add buttons or a drop down for language selection?

    Again, here's the link to their documentation regarding changing the language:
    http://inter-illusion.com/assets/I2LocalizationManual/ChangingthegameLanguage.html
    From their page:
    "The plugin contains several example scenes showing how to change the language by clicking on buttons or selecting them from a dropdown list."

    If you have their example scenes, look at which functions the button calls by its Unity Events.
    Then you don't need new scripts. Which functions have to be called is depending on their interface.

    Regarding Kings, the only required Action (if they didn't change too much on their side) is to uncomment the first line in "TranslationManger.cs", like the documentation of Kings states:
    i2l_docuCut.PNG

    I hope this helps. Please don't forget to anwer my questions.
     
  21. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Great! That got the starting values running again. I'll Delete Prefs more often and avoid having multiple Inspectors open. Thank you for your insight. I have two more bugs that are showing up now that I can play the game properly:

    1) It seems there is a missing object reference, but I can't tell from the callstack where the error is occurring. How do I find out this information?

    2) I have seen this error before, but for some reason it occurs very often now with some cards in particular. Sometimes a follow-up card won't load the proper text on the card and will instead load the default text. Is there a way to fix this from happening?
     

    Attached Files:

  22. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    regarding the first issue, you are missing some linked in item.
    This time it is from the quest system. Some quest will check automatically if it is fullfilled: "checkIfActiveQuestIsFullfilledByCondition" from the callstack. It then tries to give or change an item and this fails because the item is missing.

    Regarding the second issue, this should not happen. I try to investigate this further.
    This only happens with follow up cards?
     
  23. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Yes, so far I believe it only happens with Follow-Up cards. I will look into the first issue regarding the quests, thanks!
     
  24. furkan1aktas

    furkan1aktas

    Joined:
    May 2, 2018
    Posts:
    33

    I want to add a language selection button to the first start panel. l2 localization i also have. But I do not have the hardware to do this as coding. As I said before, I write and understand a little bit of graphics. Thank you for your help.
     
  25. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Chekmate,
    because I couldn't reproduce it, I have two questions:
    If the missing test replacement happens, are there any errors or strange warnings in the console output?
    Second, when it happens again, could you please close the game (go out of play mode) and hit play again. Is it then actualized?
     
  26. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi furkan1aktas,
    I have some questions, because it's not clear to me where your issue is.
    I hope with the following questions I could get a more clear view at which point you are.

    Do you know how to add a button to the first start panel?
    Do you know what Unity events are?
    Do you know how to use Unity events?
    Do you know what a function or a method is?
    Do you know how to link an Unity event to an method call?

    In the end, you have to add a button for the language to the panel, from it's on click event call the function to switch the language. Which method to call should be shown in the example scene of the translation asset.
    I do not know at which point this fails, also sorry, I do not know what is has to do with hardware to do this as coding?

    If you could please at least tell me what you have tried and where you are failing, that would be helpful.
     
  27. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    1) There are no errors or warnings when it occurs.
    2) Exiting and re-entering Play Mode does not actualize it.
    3) The starting values problem is back. It goes away whenever I press Delete Prefs, but comes back as soon as I restart the game in Play Mode.

    I hope this helps ;)
     
  28. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Chekmate,
    It's not clear for me whats the source for this behaviour.
    I started an extra conversation for this.
     
  29. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    for general information (had this in the support mails). Some newer Unity versions throw an error reagarding unresolved packages of the asset:
    "An error occurred while resolving packages: Project has invalid dependencies:
    com.unity.package-manager-ui: Package [com.unity.package-manager-ui@2.1.2] cannot be found [...]"

    Step 1: Make a back up of your project!

    For me following steps worked:

    Go to (Upper toolbar) -> Window -> Package Manager
    Select the old package and click remove.
    After that, click on (Upper toolbar) -> File -> Save Project
    Then restart Unity. The error should be gone.


    I hope this helps.
     
  30. furkan1aktas

    furkan1aktas

    Joined:
    May 2, 2018
    Posts:
    33
    Hello again, thank you for your interest. I don't know how to create a button and activate the language switching function. And I don't know how to add it to the first start page. Can you prepare me a package for this? It is enough to have something very simple. All I want is to add the language option. Thank fou for helping..
     
  31. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi furkan1aktas,

    at this point, again, I have to say sorry. I can not do this.
    Not because I don't want to, it's because:
    • Unity Packages are technically not designed to link to methods of non-existent resources.
      and
    • I'm legally not allowed to create a unity package which includes resources of another paid asset.
    I also will not teach Unity basics, like adding buttons or linking events.
    These instructions can be found en masse on the Internet. Unfortunately, I cannot relieve you of the task of understanding the elementary basics of Unity.

    As I wrote in a previous post, the translation asset provides a demo scene according to its documentation in which you can change the language using buttons. You should look for your example there.

    I'm sorry, I can't help you here. I hope I could point you in the right direction.
     
  32. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    61
    Hello ! I'm thinking about creating a webgl game with this asset. Is there kind of guideline or "good practices list" to follow ? Or are there some limitations due to the webgl engine ? I've been looking on the net, but only found pieces of information..

    Edit : i've read the Unity documents about webgl, and it s quite clear. But from your experience, with this kind of game, are there particular points to be aware of ?
     
    Last edited: May 20, 2020
  33. AxelCasauran

    AxelCasauran

    Joined:
    Dec 3, 2016
    Posts:
    5
    Hi,

    I have an option at first load if you are a boy or a girl.
    My question are:
    1. How can I dynamically change a Card Question/Answer/Statement to fit in the gender?
      1. (sample) You met a (prince/princess).
    2. How can I dynamically change the image source so I can load a boy/girl image in prefab/style?
    3. Can I make a gender as condition of what to show next card?

    Thank You.
    Stay Safe.
     
  34. pkessler94

    pkessler94

    Joined:
    Dec 20, 2018
    Posts:
    21
    Hi!

    If I want a bunch of cards with the same layout but all different images and colors, do I just use one template with a different style for each card?

    Is there an easier way to change the icon/image on the card individually, without having to make a different card style for each unique card?

    Thank you!
     
    Last edited: May 20, 2020
  35. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi tieum67,
    welcome back. I personally have no real experience or best practices regarding WegGL builds.
    The Kings asset can handle touch and mouse inputs.
    For savegames the playerprefs are used. But I'm not really shure how stable the savegames are in webgl builds.
    Like mentioned here, PlayerPrefs can fail in WegGL.

    Did you encounter an issue?
    If so, I could look into it and maybe find a solution.

    I hope this helps.
     
  36. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi AxelCasauran,

    do you use the selection screen example? Theres already a value named "Gender" as Kings-Value. It is set to 0 for a male and 1 for female. Because it is a Kings-Value it can be used for conditions.
    If you are using your own gender selection, you could create your own Gender-Value and use this for conditions.

    Regarding your questions:

    1. Directly changing the texts of a card specific for a gender has no good implementation. Therefore I would suggest creating whole cards regarding the gender. If such a card should be drawn, you could use the gender-value and then decide if you are drawing the male or female version. For randomly drawing cards, you could create gender specific card stacks and add sub-stack conditions.

    2. There are different scripts, which you can attach to your card. In your case the script "valueDependentImages.cs" should work, if you add it to your card and use the gender-value. The usage is described in the documentation on page 27.

    3. If you save your gender as an value: yes.

    I hope this helps.
     
  37. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi pkessler94,

    welcome to the Kings forum. CardStyles are not mandatory. But to be compatible with the import and export, you should not remove the script from the cards or remove the style itself. If you want, you could create a style called e.g. "cs_undefined".

    You can simply remove the links in the card style script on the card itself. The prefab will stay as it is and the elements will not be overwritten:
    emptyCardStyleTargets.PNG

    The script has null-pointer checks, so there should be no issue.

    I hope this helps.
     
  38. pkessler94

    pkessler94

    Joined:
    Dec 20, 2018
    Posts:
    21
    Sorry, I'm still a bit confused. I'm totally new to Unity!

    What would be the best way to have 100 cards with unique icons/images on them? Just copy a template 100x and edit the cards individually? Is there a way to create 100 cards with different images/icons on them using a few styles and templates, or would each style/template override that?

    Ideally, I'd be able to edit the master card template and have that change be applied to all of the cards (I want to flesh out my decks but my card design is not finalized). I can't figure out if this should be done using card templates or a card styles. I don't really know what the difference is between templates and styles, to be honest.

    Thank you so much :)
     
    Last edited: May 21, 2020
  39. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    there are several way to do this.
    Since about two major versions of Unity ago, they changed their prefab behaviour (in short, a prefab is a pre fabricated game object) to work with derivated versions when the master prefab is changed. This is one way to implement this. Because this a Unity feature, there are several tutorials online.

    The card style elements (not from Unity itself) are created from Kings as a way to define Front-elements, Icons etc. as a style for a card and therefore this is specialized for this asset. What I wanted to suggest at the above post was, that you can define a style, but you don't have to use every element of the style.

    Let me give you an example:
    The cardstyle defines an card image and and icon.
    Like you mentioned, usually the card image and icon will be replaced by these two elements. This is done by the script "CardStyle" which is attached on the card prefab itself. It uses these data to replace some target images.
    For a single card where the icon doesn't match, you can remove the link to the icon itself:
    CardStyle_CardOnly.PNG
    You can then adjust the icon in the prefab, it will not be overwritten for this modified card.

    There could be several other ways to implement this, but they would require some scripting.

    I hope this helps.
     
  40. pkessler94

    pkessler94

    Joined:
    Dec 20, 2018
    Posts:
    21
    This was great, thank you so much for explaining!
     
    KMDeclius likes this.
  41. Chekmate

    Chekmate

    Joined:
    Sep 24, 2017
    Posts:
    77
    Hey again! How does the game's restarting process work? I don't want all of the post-game stuff, I just want to return to the starting card, but I'm afraid if I delete the post-game stuff, I won't be able to get back to the start once I reach a game over state.
     
  42. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    61
    Hello,

    Thanks for your reply ! Actually i'm not encountering any issue, i wanted to avoid mistakes so that i would need to change all the project settings... As i'm not planning to give the "savegame" option, i guess i just have to reduce the graphic and audio files to the minimum, and it should work...
    Thanks again for this asset, i'm very happy to work with it again !
     
  43. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi Chekmate,

    the original implementation uses two global messages (the message implementation is not the Unity one, it's a own written system). I'm not aware how deep your knowledge regarding the Kings-Global Messages is, therefore I will go a little bit more into the details. Don't worry, the solution is simple.

    The first message one card can send is "preGameover" (e.g. from the game over cards). This will trigger:
    • Clearing of follow up cards (it would be nasty, if there would appear a follow up card after the game over from the previous game).
    • Some score calculation and logging for the summary at the end of the game.
    After that, from the last card, the global message "gameover" is sent. This will execute the game over and the scene will be reloaded.

    Here's the example for sending the message "gameover" from a card, the card requires the script "GlobalMessageEventSender". From the despawn event the method "GlobalMessage" has to be called:
    GameOverTrigger.PNG

    And here is the execution logic, these parts are accessible in the hierarchy:
    GameOverLogic.PNG

    TL;DR : Send the global message "gameover". [Edit] Also ensure the follow up card stack is cleared.

    I hope I haven't forgotten a detail. I hope this helps.
     
  44. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    61
    /// How to track the number of cards that have been played ? ///

    Hello again,
    I would like to track the number of cards that have been played, for example to make a group of cards available :

    Group 1 : always available
    Group 2 : available after 10 cards played
    etc....

    I guess i could track the years value, thtaht It should increment by one after a card despawn ?
    Or i could create a new value, and make "value change , +1" on each card despawn. Meaning i would need to set it for all cards ?
    Or i could use the "on card swipe" (from the card stack) and link it to a script that would add 1 to the value ?

    thanks !
     
  45. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hello tieum67,
    as you wrote, there are several ways to implement this.

    You can use all versions, every one should work.
    If you want it to count like the years, you have to add it to each card. This would have the advantage for counting different based on the card. We did this for the years, in case theres a cards where no time should pass.

    If you are sure to only count 1 per card, use the "on card swipe" from the card stack and link it to one the scripts which can modify a value, this sounds reasonable for this case.
     
  46. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    61
    thanks for your advice ! I'm also looking for the API, is it available somewhere ? I would like to use a another type of slider for the values, but i need to connect it to the value and get notified each time the value changes.
     
  47. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi,
    we don't have a dedicated api documentation, but helper scripts which can do this tasks.

    1.You are looking for the script "ValueDisplay.cs" which is does the acess and the display (I believe you want to show the actual value):
    upload_2020-5-24_23-56-5.png

    2. Events are already generated at the "ValueScript.cs". Because it's similar to your draw count, here's the one for the years-value (I believe you want to fire an event or get notified if the value increases):
    upload_2020-5-24_23-59-21.png

    [Edit] If you want to see how this is done, feel free to look inside the scripts.

    I hope this helps.
     
  48. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    61
    thanks ! i works like a charm... your prebuilt event system is very useful!
     
    KMDeclius likes this.
  49. pkessler94

    pkessler94

    Joined:
    Dec 20, 2018
    Posts:
    21
    How do I make a gender selection screen that works with the name generator?

    I made a card where you choose the gender, and swiping right makes the gender value 0 and swiping left makes the gender value 1...but the game still generates male and female names regardless of what is selected. How do I tell the game to only generate a female name if the player selects female, and visa versa? The CountryGenerator script has a way to designate gender per name, but it doesn't appear to do anything.

    Also, for some reason the Name Value appears as a number in the sub-menus and when I use {value=name} on a card. A name does appear in the top menu, but that's it. Not sure how the name generation works with gender.

    Thank you!
     
    Last edited: May 27, 2020
  50. KMDeclius

    KMDeclius

    Joined:
    Aug 12, 2019
    Posts:
    213
    Hi pkessler94,
    the combination of names and genders can be manually controlled. This uses 4 different values:
    upload_2020-5-27_19-18-45.png

    One for the first name, one for the Surname and one for the country. The names can differ per country. So you also have to set the values for the names.

    If you want to have random names, you can set random values to select the name from your list, e.g.:
    upload_2020-5-27_19-29-42.png

    It works reverse. If you select a name it uses this information to overwrite the gender. Sorry for the confusion.

    Ah, I understand the confusion. The name is stored as a number. {value=xxxxx} shows this number. As an example, this is useful for showing something like "Your strength is 5" (where 5 is written in the text as {value=strength} ).

    if you want to show the name on a card, you can use the script "CountryNameDisplay.cs". In this example I created an extra text on the card prefab, added the script and linked it to show the name:
    upload_2020-5-27_19-52-59.png

    There are several other ways to do similar functionality, e.g. by using the Kings-dictionary system. If you are using the dictionary system and set a "name"-key to your own name directly, then you could also use it inside a text
    ( e.g. "Your name is {dict=name}" )

    I hope this helps.