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

War3:Source
September 21, 2012, 09:29:56 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] 2
  Print  
Author Topic: [Item]Holy Shield  (Read 877 times)
Vulpone
Full Member
***
Posts: 140



View Profile Email
« on: November 18, 2011, 03:21:04 PM »

'sup,

I've had this lying around for a long time. This was actually the first thing I ever created for W3S, so expect no magic.
What it does is quite simple:
Remember how most people check for an Immunity_Skills block but few races actually HAVE one?

Well, a lot of races had abilities that were worth blocking and were quite annoying (ex.: an AoE-Stun).
If the race has a check for Immunity_Skills (which it should if the author took the time to do so), this blocks said ability.

Most of you coders already have this, but it's a beloved item on the server we run.
This also includes a German translation in case anyone needs it. If you have a different language you would like to see in the translation file, just PM me the content and the language-name. Ty!

Any mistakes were most-likely an accident and are eagerly awaiting a fix. Let me know if you find one.

Cheers,
Vulp


*Files appended.

Edit: 2011-11-19 (19.11.2011)
6:30 PM GMT+1
*Added language support for Russian! (All credits go to alex0310)

Edit: 2011-11-22 (22.11.2011)
8:55 AM GMT+1[/i]
    Changelog:
  • Changed money cost ($$) to 2000
  • Money and Shield can not be carried at the same time.
  • Added a ConVar that adds option to forbid necklace+shield.

[BUGTRACKING] This means: There may be bugs. The code compiles properly (but we all know that means nothing. :-D) and should (!) work correctly.
Any reported errors are greatly appreciated.


Console Variable(s):
war3_shop_shield_restriction "0" "Set this to 1 if you want to forbid necklace+shield. 0 default"[/list]
« Last Edit: November 22, 2011, 02:24:49 AM by Vulpone » Logged

Sapere aude!
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #1 on: November 19, 2011, 11:34:22 AM »

Russian language support. Many thanks to alex0310 for that.

Updated attachment.
Logged

Sapere aude!
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #2 on: November 19, 2011, 06:54:37 PM »


commit to svn
Logged

DarkEnergy
qwerty
Jr. Member
**
Posts: 87


View Profile
« Reply #3 on: November 21, 2011, 10:08:58 AM »

isn't this the same as necklace of immunity?
Logged
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #4 on: November 21, 2011, 10:25:59 AM »

isn't this the same as necklace of immunity?



Necklace = Immunity_Ultimates
Shield = Immunity_Skills
Logged

Sapere aude!
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #5 on: November 21, 2011, 10:29:27 AM »

Logged

DarkEnergy
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #6 on: November 21, 2011, 10:34:18 AM »

Logged

Sapere aude!
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 402


⠠⠵


View Profile
« Reply #7 on: November 21, 2011, 04:35:17 PM »

Let's dump the forums for a imageboard.

Also I'd like a restriction so you can either have a holy shield or necklace of immunity, but not both at the same time.
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #8 on: November 22, 2011, 12:21:30 AM »

Let's dump the forums for a imageboard.

Also I'd like a restriction so you can either have a holy shield or necklace of immunity, but not both at the same time.

haha.

It all boils down to how many max-items you can carry.  But I'll add it, I have no idea how this affects TF2 or L4D. Thanks for reminding me.

Edit:
Oh, I misread what you said.  I don't think I can do that, as I would have to edit the original War3Source_Shopitems.sp and enable a shield-check.
Should I just do that or is that your realm? I'll add it for the Shield, though.
« Last Edit: November 22, 2011, 12:24:21 AM by Vulpone » Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #9 on: November 22, 2011, 12:47:20 AM »

You wouldn't need to edit it, you just need to add a little chunk to your OnItemGain (Can't remember the precise name of the event) then see if the item being gained is necklace, and if it is and if the person also has a shield, then prevent them from getting their necklace.

Very easy Smiley
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #10 on: November 22, 2011, 12:55:26 AM »

You wouldn't need to edit it, you just need to add a little chunk to your OnItemGain (Can't remember the precise name of the event) then see if the item being gained is necklace, and if it is and if the person also has a shield, then prevent them from getting their necklace.

Very easy Smiley

Yes, but vice-versa? If I have a check when purchasing Shield, I don't have one when purchasing Necklace.

e.g. I have a necklace. I'm purchasing Shield. Boom, error! But...
I'm wearing a Shield. I'm purchasing a necklace.

Thing is, why do this inside Holy Shield?

But meh, I scrapped this together.
Code:
if(ValidPlayer(client))
{
new lace = War3_GetItemIdByShortname("lace");
if(item == thisItem && !War3_GetOwnsItem(client, lace) || item == lace && !War3_GetOwnsItem(client, thisItem))
{
War3_SetBuffItem(client,bImmunitySkills,thisItem,true);
War3_SetOwnsItem(client,item,true);
}
else if(item == thisItem && War3_GetOwnsItem(client, lace))
{
War3_SetBuffItem(client,bImmunitySkills,thisItem,false);
War3_SetOwnsItem(client,item,false);

War3_ChatMessage(client, "Error purchase Holy Shield! Cannot wear Necklace and Shield at the same time.");
}
}

Probably got a few error, and I have at LEAST one case not written out (the one behind the logical OR).
But I gotta run. See ya.
Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #11 on: November 22, 2011, 01:01:22 AM »

Code:
if(ValidPlayer(client))
{
new lace = War3_GetItemIdByShortname("lace");
if(item == thisItem && !War3_GetOwnsItem(client, lace) || item == lace && !War3_GetOwnsItem(client, thisItem))
{
War3_SetBuffItem(client,bImmunitySkills,thisItem,true);
War3_SetOwnsItem(client,item,true);
}
else if(item == thisItem && War3_GetOwnsItem(client, lace))
{
War3_SetBuffItem(client,bImmunitySkills,thisItem,false);
War3_SetOwnsItem(client,item,false);

War3_ChatMessage(client, "Error purchase Holy Shield! Cannot wear Necklace and Shield at the same time.");
}
else if(item == lace && War3_GetOwnsItem(client, thisItem))
{
War3_SetOwnsItem(client, item, false);
War3_ChatMessage(client, "Error purchasing Necklace of Immunity! Cannot wear Necklace and Shield at the same time.");
//blahblah refund their junk
}
}
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #12 on: November 22, 2011, 01:06:30 AM »

help help.. help help.. help help. :d

Hah! Thanks. I don't have to go,so I'm free. Thanks a bunch for that.

I'll take care of refunding their gold. lol.

Edit:
I also have to remove their ultimate immunity 8^D.
Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #13 on: November 22, 2011, 01:09:32 AM »

Happy to help XD But yeah, thanks to how much is broadcast as events, that kind of thing is easy without modification :3
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #14 on: November 22, 2011, 01:18:14 AM »

Happy to help XD But yeah, thanks to how much is broadcast as events, that kind of thing is easy without modification :3

True!
The API really makes things easy...

Is W3GetItemCost(itemid,bool:csmoney) safe? If I set the bool false, does it return the value ACTUALLY used? Sadly, I have no way of checking what it returns.. (no server and no comments)
Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #15 on: November 22, 2011, 01:23:01 AM »

No reason it shouldn't return the cvar-set value (so if they changed it it should revert) although you should probably check that one cvar/command that returns whether its actually money or credits Tongue
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #16 on: November 22, 2011, 01:25:27 AM »

No reason it shouldn't return the cvar-set value (so if they changed it it should revert) although you should probably check that one cvar/command that returns whether its actually money or credits Tongue

What about this one?  bool:W3BuyUseCSMoney()
I should really comment out some of the Interface APIs to make sure. lol.

I'm on it, though.
Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #17 on: November 22, 2011, 01:41:28 AM »

That should get it, I would assume that true = csmoney, false = credits.
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #18 on: November 22, 2011, 02:01:01 AM »

That should get it, I would assume that true = csmoney, false = credits.

First post updated! Get it while it's hot. :d
Logged

Sapere aude!
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #19 on: November 22, 2011, 02:03:01 AM »

Should probably set that to a choice :3 some people like allowing both necklace and shield (possibly default to allowing both?)
Logged

Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #20 on: November 22, 2011, 02:21:29 AM »

Should probably set that to a choice :3 some people like allowing both necklace and shield (possibly default to allowing both?)


I've allowed both on my server, but Glider requested this.
We have a max. of two items, though..

**done.

Added to main post!
Logged

Sapere aude!
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #21 on: November 22, 2011, 10:00:37 AM »

note this event:

W3SetVar(EventArg1,item);
W3SetVar(EventArg2,1);
W3CreateEvent(CanBuyItem,client);
Logged

DarkEnergy
Arturius
Full Member
***
Posts: 155



View Profile Email
« Reply #22 on: November 22, 2011, 04:10:49 PM »

AntiWard already has Immunity_Skills.
Code:
bImmunitySkills, //is immune to skills
bImmunityUltimates, // is immune to ultimates
bImmunityWards, // is immune to wards, skill immunity includes ward immunity
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #23 on: November 22, 2011, 07:03:49 PM »

antiward gives ward immunity
holyshield gives skill immunity which along gives ward immunity
Logged

DarkEnergy
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 402


⠠⠵


View Profile
« Reply #24 on: November 23, 2011, 12:56:50 PM »

[BUGTRACKING] This means: There may be bugs. The code compiles properly (but we all know that means nothing. :-D) and should (!) work correctly.
Any reported errors are greatly appreciated.

Quote from: Donald Knuth
Beware of bugs in the above code; I have only proved it correct, not tried it.

 Grin
Logged

Pages: [1] 2
  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!