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, 07:06:53 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: Lockdown shopmenu per player?  (Read 231 times)
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« on: November 24, 2012, 12:32:23 AM »

So I'm making a new race that gambles between positive and negative buffs.  One of the gambles is for various types of immunity.  I want to make the bad stuff that happens in that gamble that the player can't access certain shopmenu items (or the shopmenu at all).

Is there a way to lockdown either certain shopmenu items or the entire shopmenu from within a race?  I know how to do this for an entire race from within the war3source.cfg file, but I want to know if it's possible to do from within a race (so I can reenable them again next round, etc).

Any help appreciated!
Logged
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 454


⠠⠵


View Profile
« Reply #1 on: November 24, 2012, 05:42:18 AM »

There should be a W3Event to interfere with the shopmenu/purchase
Logged

Necavi
Sr. Member
****
Posts: 297


View Profile
« Reply #2 on: November 24, 2012, 02:29:07 PM »

There is indeed, although I don't think there's anything to lock out opening the shopmenu itself.
Logged

Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #3 on: November 24, 2012, 03:57:37 PM »

Thanks, this is my first forray into w3events.

Having a look through the enum list for it I notice a levelbank w3event also.  Does that mean I could theoretically use that to stop people from using their levelbank on a particular race?

Does anyone have any sort of guide to how i would go about using the w3event to interfere with shopmenu / levelbank?

I can work out how to pick up what I want (something like the below), but not really sure how to then modify what's presented.

Code:
public OnWar3Event(W3EVENT:event,client){
if(event==DoShowShopMenu){
// WHAT GOES HERE ?
}
}
Logged
Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #4 on: November 24, 2012, 04:53:18 PM »

I think you can't deny W3Events, thats why there is W3Deny.

There's no existing W3Denyable yet to do so, but war3source is opensource Smiley

I've added a new W3Denyable - see svn.

http://goo.gl/wnG7t
Logged

#war3source
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #5 on: November 24, 2012, 09:07:10 PM »

So something like this should stop them from opening the shopmenu?

Code:
public OnW3Denyable(W3DENY:event, client)
{
if(event==DN_CanBuyItem1){
W3Deny();
War3_ChatMessage(client,"%T","You can't buy shopmenu items",client);
}
}

If so, that's awesome!  Any chance you could do something similar for the levelbank?  The idea for the levelbank is to create a truly grinding race, that as you level up it gets harder and which can't be leveled up by tomes or levelbank.

EDIT: ignore the lack of usual checking functions (raceid, validplayer, etc)

EDIT2: Also, if I understand correctly, does that also mean I could then test EventArg1 for which item it is and block individual items only? eg -

Code:
public OnW3Denyable(W3DENY:event, client)
{
if( War3_GetRace( client ) == thisRaceID && ValidPlayer( client ) && ShopmenuToggle[client] == true)
{
if(event==DN_CanBuyItem1)
{
new item = W3GetVar(EventArg1);
decl String:itemname[64];
W3GetItemName(item,itemname,sizeof(itemname));
if(StrEqual(itemname, "necklace"))
{
W3Deny();
War3_ChatMessage(client,"%T","You can't buy the necklace this round.",client);
}
else if(StrEqual(itemname, "shield"))
{
W3Deny();
War3_ChatMessage(client,"%T","You can't buy the shield this round.",client);
}
}
}
}
« Last Edit: November 24, 2012, 09:42:45 PM by Remy Lebeau » Logged
Necavi
Sr. Member
****
Posts: 297


View Profile
« Reply #6 on: November 24, 2012, 10:04:32 PM »

They can still open the shopmenu, but can't buy anything.
Logged

Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #7 on: November 25, 2012, 02:29:11 AM »

So something like this should stop them from opening the shopmenu?

Code:
public OnW3Denyable(W3DENY:event, client)
{
if(event==DN_CanBuyItem1){
W3Deny();
War3_ChatMessage(client,"%T","You can't buy shopmenu items",client);
}
}

If so, that's awesome!  Any chance you could do something similar for the levelbank?  The idea for the levelbank is to create a truly grinding race, that as you level up it gets harder and which can't be leveled up by tomes or levelbank.

EDIT: ignore the lack of usual checking functions (raceid, validplayer, etc)

EDIT2: Also, if I understand correctly, does that also mean I could then test EventArg1 for which item it is and block individual items only? eg -

Code:
public OnW3Denyable(W3DENY:event, client)
{
if( War3_GetRace( client ) == thisRaceID && ValidPlayer( client ) && ShopmenuToggle[client] == true)
{
if(event==DN_CanBuyItem1)
{
new item = W3GetVar(EventArg1);
decl String:itemname[64];
W3GetItemName(item,itemname,sizeof(itemname));
if(StrEqual(itemname, "necklace"))
{
W3Deny();
War3_ChatMessage(client,"%T","You can't buy the necklace this round.",client);
}
else if(StrEqual(itemname, "shield"))
{
W3Deny();
War3_ChatMessage(client,"%T","You can't buy the shield this round.",client);
}
}
}
}

exactly, that will stop players from buying single items(like necavi said).
Logged

#war3source
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #8 on: November 25, 2012, 03:01:26 PM »

That's great, thanks Revan!  Any chance of adding a denyable to levelbanking as well?  That would allow me to create the ultimate grinding race Cheesy
Logged
Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #9 on: November 26, 2012, 06:32:35 AM »

yes I can do that but I'm currently at work, you can also try to do it by yourself (just see svn diff I posted before for instructions).

EDIT: done(rev. >=882) Smiley
« Last Edit: November 26, 2012, 11:01:10 AM by Revan » Logged

#war3source
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #10 on: November 26, 2012, 01:46:02 PM »

were's the +like button? Cheesy
Logged
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!