Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-25 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog

War3:Source

Development => Tutorials => Topic started by: Ownz on December 20, 2009, 12:45:27 PM



Title: Making an Item
Post by: Ownz 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


Title: Re: Making an Item
Post by: Frenzzy on December 22, 2010, 04:21:59 AM
How can I do some check before purchase item?

For example:
Code:
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.");
}


Title: Re: Making an Item
Post by: Ownz on December 22, 2010, 12:36:59 PM
request this feature