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

War3:Source
January 24, 2013, 10:40:00 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: My Planned Updates for war3source SVN....  (Read 98 times)
-El Diablo
Sr. Member
****
Posts: 252


View Profile
« on: December 06, 2012, 06:43:49 AM »

I plan to update the SVN with these updates, any rejections let me know:

Item Categories - a feature that will give a player a extra option to return to categories on the first and last page after they have choosen a category.   This will make it less annoying to players whom wish to browse all the categories without having to retype in the shopmenu command.

for Item Creation:

I have created 2 new natives for war3source.

/*
 War3_TFSetItemClasses(itemid, and then use ItemClassString
separted by comma )

 example:

 War3_TFSetItemClasses(itemid,sniper,medic,scout)

if you want all classes then don't assign anything OR you can
use:
War3_TFSetItemClasses(itemid,all)

 As many classes that you want this item to have access to.

enum ItemClassString
{
   all = TFClass_Unknown,
   scout = TFClass_Scout,
   sniper = TFClass_Sniper,
   soldier = TFClass_Soldier,
   demoman = TFClass_DemoMan,
   medic = TFClass_Medic,
   heavy = TFClass_Heavy,
   pyro = TFClass_Pyro,
   spy = TFClass_Spy,
   engineer = TFClass_Engineer
}
*/
native War3_TFSetItemClasses(itemid,any:...);


Here is another code if you want to check if a item is for a
certain class.

// If TFClassType is set for TFClass_Unknown, then all classes
have access to this item.
// use  War3_TFIsItemClass(itemid,TF2_GetPlayerClass(client));
/*
01: enum TFClassType
02: {
03:     TFClass_Unknown = 0,
04:     TFClass_Scout,
05:     TFClass_Sniper,
06:     TFClass_Soldier,
07:     TFClass_DemoMan,
08:     TFClass_Medic,
09:     TFClass_Heavy,
10:     TFClass_Pyro,
11:     TFClass_Spy,
12:     TFClass_Engineer
13: };
*/

native War3_TFIsItemClass(itemid,TFClassType:iPlayerClass);



Here is an example code of how to use it:

Code:
#pragma semicolon 1

#include <sourcemod>
//#include <sdktools_functions>
#include "W3SIncs/War3Source_Interface"

new thisItem;

public Plugin:myinfo= {
name="War3Source Shopitem - (Medic Only) Insta Uber",
author="El Diablo",
description="War3Source",
version="1.0",
url="http://www.war3source.com/"
};



public OnPluginStart()
{
LoadTranslations("w3s.item.uberme.phrases");
}
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10)
{
thisItem=War3_CreateShopItemT("uberme",100,3000);
War3_TFSetItemClasses(thisItem,medic);
}
}

public OnWar3Event(W3EVENT:event, client)
{
if(event == CanBuyItem)
{
        new item = W3GetVar(EventArg1);
        if(item==thisItem && TF2_GetPlayerClass(client)!=TFClass_Medic)
            {
                W3SetVar(EventArg2, 0);
                War3_ChatMessage(client, "Only Medics can buy this item!");
                //War3_SetGold(client,100);
                //War3_SetOwnsItem(client,item,false);
                //PrintToChat(client,"Store refunded your gold.");
            }
        else W3SetVar(EventArg2, 1);
}
}

public OnItemPurchase(client,item)
{
if(item==thisItem&&ValidPlayer(client) && TF2_GetPlayerClass(client)==TFClass_Medic)
        {
        if (GetEntProp(client, Prop_Send, "m_iClass") == 5)
            {
            //`EquipPlayerWeapon(client, tf_weapon_medigun);
            TF_SetUberLevel(client, 100.0);
            War3_SetOwnsItem(client,item,false);
            }
      //War3_SetOwnsItem(client,item,true);
      //War3_SetBuffItem(client,fArmorPhysical,item,6.0);
        }
}

stock TF_SetUberLevel(client, Float:uberlevel)
{
new index = GetPlayerWeaponSlot(client, 1);
if (index > 0)
SetEntPropFloat(index, Prop_Send, "m_flChargeLevel", uberlevel*0.01);
}

/*
public OnWar3EventDeath(victim){
if(War3_GetOwnsItem(victim,thisItem)){
War3_SetOwnsItem(victim,thisItem,false);
War3_SetBuffItem(victim,fArmorPhysical,thisItem,0.0);
}
}
*/


The new natives basically prevent classes you don't allow to have access to the item you create by preventing them from even seeing the item.  Instead of just denying and annoying players whom will then ask you repeated questions, we decided to not deny them...but instead just make it only visible to the classes we wish to have access to them.

1 single line of code added to your item will give you this benefit.

I have not yet udpated war3source with this new code yet, but I plan to add this.  If you reject me adding this, please add your statements below...

« Last Edit: December 06, 2012, 06:49:18 AM by -El Diablo » Logged
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #1 on: December 06, 2012, 02:22:41 PM »

Looks pretty cool to me!

My only suggestion would be to block the shopmenu items rather than not show them.  I say this because everyone already knows what's in there, and if you make items disappear, then it will change the numbering of the rest.  I'm so used to purchasing items that I can do it without looking, however if you renumbered them depending on class, I'd have to get used to the numbering per class!
Logged
-El Diablo
Sr. Member
****
Posts: 252


View Profile
« Reply #2 on: December 07, 2012, 12:58:33 AM »

I just checked out the deny system, which I have never really used and found it to be better than using this code... if anyone would actually use this code I'll add it if not... the deny system works pretty well.
Logged
Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #3 on: December 07, 2012, 12:05:38 PM »

heh nice thats a real cool addition! Cheesy
the deny system is great for that purpose.
Logged

#war3source
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2169



View Profile WWW
« Reply #4 on: December 07, 2012, 12:35:28 PM »

You could use deny on creating the menu


i personally prefer items stay in the same place, so i dont have to actually check the position of the item. I just press 1 2 3 4 without looking. Thats why i kept kept disabled items on the menu.
Logged

DarkEnergy
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!