• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

NeutralBuilding - Add Unit << Inconsistent Behavior

Status
Not open for further replies.
Level 4
Joined
Dec 26, 2021
Messages
47
Hello, I have a rather simple shop update which looks at the number of units in a unit group and then updates the unit count for sale.

The mechanics surrounding this are a little complicated but the output integer number is confirmed correct HOWEVER the number of units in stock is not the same as what I am printing on the screen.

I made another map with some chickens and tried to recreate this behavior, but I could not!

Game - Display to (All players) the text: (DEBUG: UpdateShop - Found in hand: + (String(i_tmp)))
Neutral Building - Add (Unit-type of un) to un_CardMaster with i_tmp in stock and a max stock of i_tmp
For some reason it always bugs at the number 3 -> 4 transition. When it should increment to 4, it stays as 3 but we print 4 as i_tmp value.
I made a second unit and assigned the same i_tmp value to the second unit --> One of the unit would go to 4, the other would not!


Anyone know what may be going on? units have sell.


I have attached the map.

When starting type -Debug
then buy a few cards from town hall
Then type -MakeDeckActive
Then type -Draw
draw a few cards via -Draw debug command.


As I said I cannot replicate this which is even stranger as i_tmp is the correct value...
 

Attachments

  • coreyCardGame.w3m
    33.9 KB · Views: 1
Level 4
Joined
Dec 26, 2021
Messages
47
so the order that I see when incrementing the unit stock by 1 until 5 is: 1, 2, 3, 3, 5
and when i buy the units, the stock is also updated in a similar way and I see:
5, 3, 3, 2, 1


super strange...

Relevant function in map is Cards/CoreFunctionality/gUpdateShop which is called by gAddCardToHand (same directory) which is called by DrawCard (-Draw command)
 
Level 4
Joined
Dec 26, 2021
Messages
47
Playing with it more and it seems to work consistently until a point, and then when it falls apart the numbers stay wacky. this tends to be around 3-4 changes before it gets confused.

have tried removing the unit from shop then adding it, no difference.
Have tried setting available stock to zero but no difference
Have tried setting only the available stock to i but no difference.


Appreciate any help.
 
Level 4
Joined
Dec 26, 2021
Messages
47
For now i just run the update stuff every second and it eventually gets corrected. I would like a solution though which provides more consistent behavior. Maybe I can call an update of the visual?
What I noticed is when i link the update stock code to player 1 skips cinematic sequence, it works with 100% success. This is unclear to me why.
 
Status
Not open for further replies.
Top