Author Topic: Making an Item  (Read 3512 times)

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Making an Item
« on: December 20, 2009, 12:45:27 PM »
Basically like any race, you can hook events or use War3 Forwards

1 You register the item, remember the itemid.

2 Create your events / loops

3 When events / loops are triggered, check if player owns the item, and do proper item effects

Common functions for an item: (see interface for details)

itemid= CreateShopItem(String:name[],String:desc[],String:cost[])

OnItemPurchase(client,item);

OnItemLost(client,item);

War3_GetOwnsItem(client,item);

War3_SetOwnsItem(client,item);

See Shopitem and other community made items for examples
« Last Edit: December 21, 2010, 05:28:21 PM by Ownz »

Frenzzy

  • Full Member
  • ***
  • Posts: 218
    • ICQ Messenger - 337905984
    • MSN Messenger - frenzzy@live.ru
    • View Profile
    • http://css.vsevnet.ru/
Re: Making an Item
« Reply #1 on: December 22, 2010, 04:21:59 AM »
How can I do some check before purchase item?

For example:
Code: [Select]
If (GetClientTeam(client) == CT_TEAM) {
    If (HasDefuser(client)) {
        // Allow item purchase
    } else {
        // Disallow item purchase
        War3_ChatMessage(client, "You already have a defuser.");
    }
} else {
    // Disallow item purchase
    War3_ChatMessage(client, "You must be a CT team to purchase this item.");
}
O_o

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making an Item
« Reply #2 on: December 22, 2010, 12:36:59 PM »
request this feature