Skip to content

CaravanBadge

Similar than Shop, but for interacting with a shelved Caravan prize medal which only involve some parts of the shop system because it is handled entirely on its own with its own set of data.

NOTE: This interaction will cause the entitytype to be overriden to SemiNPC which features the same logic than the ones used for the shop system.

Data Arrays

  • data[0]: An entity id corresponding to the shop keeper the interaction will target when Interact is called
  • data[1]: The dialogue line id of the shop keeper (whose entity id is data[0]) to call SetText with when Interact is called

args meaning

None.

SetUp

The same than Shop, but CaravanMedalSet features extended logic.

CaravanMedalSet

The logic for this interaction changes as it doesn't follow the usual Shop system workflow:

  • shopkeeper is set to the entity resolved using data[0] as the entity id
  • The array of the currently available prize medals at the caravan is obtained via PrizeBadges(true)
  • If the array is empty, this object gets destroyed as there's no need to have it
  • Otherwise:
    • The prize medals array is shuffled
    • MainManager.caravanorder is set to the shuffled array
    • entity.item is set to true making it an item entity
    • entity.animid is set to 2 (medal)
    • entity.animstate is set to the first element of the shuffled array (this is the first prize medal id of the array)
    • entity.itemstate is set to entity.animstate
    • entitytype is set to SemiNPC which behaves the same than the ones used in the shop system
    • If we are rerolling (which only happens if we are calling from a kill or rerollshops commands), DeathSmoke particles are played at this NPCControl position
    • The first element of MainManager.caravanorder is removed
  • entity.rigid gets its gravity disabled with all constraints frozen
  • The position is set to entity.startpos
  • entity.ccol is disabled
  • descwindow is destroyed if it existed
  • The scol is disabled

HasHiddenItem

The same than Shop.

Interact

  • If this is an item entity, the entity animstate is set to its itemstate
  • flagvar 0 is set to the entity animstate
  • flagvar 1 is set to the buying price of the medal whose id is the entity animstate unless flag 681 (MYSTERY? is active) which forces it to 35
  • flagstring 0 to be the name of the medal whose id is the entity animstate unless flag 681 (MYSTERY? is active) which forces it to menutext[59] (?????)
  • Call SetText in dialogue mode using data[1] as the dialogue line id for the input string (the shop keeper's caravan medal dialogue line) with the following:
    • fonttype of BubblegumSans
    • messagebreak as the linebreak
    • No tridimensional
    • No position offset
    • No camera offset
    • size of Vector3.one
    • The parent is the entity resolved using data[0] (the shop keeper map entity id) as the entity id
    • This NPCControl as the caller
  • All playerdata entities have FaceTowards call on them to face the entity resolved using data[0](the shop keeper map entity id) as the entity id

SetBadgeShop

The logic changes drastically from Shop as the initialisation of the shelved item is delegated to CaravanMedalSet entirely which will be called instead of the logic of creating shelved items. If we are refreshing however, instance.showmoney is still set to 10.0 after which shows the berry count HUD element.

LateUpdate (Every 3 frames, non dummy and the entity is incamera)

The same than Shop, but this interaction always causes the instance.showmoney to be set to 1.0 before calling CreateDescWindow if we are calling it.

PlayerControl.LateUpdate

The same than Shop.

EntityControl.Unfix

The same than Shop.

SetText

This interactions affects SetText in several ways, but all of them are the same than Shop except fot kill which will cause SetBadgeShop with refresh to be called on the entity to kill (not its shopkeeper) if the caller has this interaction and the entity to kill's animid is 2 (meaning it's a medal as it's assumed that this is an item entity). Additionally, this interaction also causes this command to skip calling Death on the entity to kill.