Mod API Reference:CardInstance: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| No edit summary | No edit summary | ||
| (2 intermediate revisions by the same user not shown) | |||
| Line 18: | Line 18: | ||
| * Play the card with the appropriate subclass of [[Mod API Reference:GameOrderPlayCard|GameOrderPlayCard]] function | * Play the card with the appropriate subclass of [[Mod API Reference:GameOrderPlayCard|GameOrderPlayCard]] function | ||
| Example:   | '''Example: ''' | ||
|   local cardinstance = {} -- step 1 |   local cardinstance = {} -- step 1 | ||
|   table.insert (cardinstance  ,  WL.NoParameterCardInstance.Create(WL.CardID.Airlift)) -- step 2 |   table.insert (cardinstance  ,  WL.NoParameterCardInstance.Create(WL.CardID.Airlift)) -- step 2 | ||
|   addNewOrder(WL.GameOrderReceiveCard.Create(PlayerID, cardinstance)) -- step 3 |   addNewOrder(WL.GameOrderReceiveCard.Create(PlayerID, cardinstance)) -- step 3 | ||
|   addNewOrder(WL.GameOrderPlayCardAirlift.Create(cardinstance[1].ID, Player.ID, TerritoryID''[[Mod API Reference:TerritoryID|TerritoryID]]' , TerritoryID''[[Mod API Reference:TerritoryID|TerritoryID]]' , '''Armies''' ''[[Mod API Reference:Armies|Armies]]'')) |   addNewOrder(WL.GameOrderPlayCardAirlift.Create(cardinstance[1].ID, Player.ID, TerritoryID  ''[[Mod API Reference:TerritoryID|TerritoryID]]' , TerritoryID  ''[[Mod API Reference:TerritoryID|TerritoryID]]' , '''Armies''' ''[[Mod API Reference:Armies|Armies]]'')) -- step 4 | ||
Latest revision as of 05:26, 22 November 2023
CardInstance: An actual instance of a card belonging to a player or team. For example, when a player completes their 4th piece of a 4-piece reinforcement card, an instance of CardInstance is created, assigned a random ID, and given to the player/team.
- CardID CardID:
- ID CardInstanceID:
Children
This is an abstract type. For Reinforcement cards, you should use the ReinforcementCardInstance, and for all other cards use the NoParameterCardInstance.
How to create a Card
- Create a table
- Create a card instance with WL.NoParameterCardInstance.Create (CardID) , then add it into the new table. Your element in that table is your cardInstanceID
- Give the card to the player you want to have this card used on with addNewOrder(WL.GameOrderReceiveCard.Create( playerID PlayerID, cardInstanceID CardInstanceID))
- Play the card with the appropriate subclass of GameOrderPlayCard function
Example:
local cardinstance = {} -- step 1
table.insert (cardinstance  ,  WL.NoParameterCardInstance.Create(WL.CardID.Airlift)) -- step 2
addNewOrder(WL.GameOrderReceiveCard.Create(PlayerID, cardinstance)) -- step 3
addNewOrder(WL.GameOrderPlayCardAirlift.Create(cardinstance[1].ID, Player.ID, TerritoryID  TerritoryID' , TerritoryID  TerritoryID' , Armies Armies)) -- step 4