sc2c.org

Go Back   Sc2C.org > Developer's Corner > Scripting
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 04-28-2010, 08:58 PM   #1
Fireeye
Is that a bomb? ...
 
Fireeye's Avatar
 
Join Date: Apr 2010
Posts: 4
Default UnitDamageTarget v.0.9

---UPDATE---
Made from scratch using Behaviors, its current damage cap is at 2047.
It use 20 behaviors. 10 for ignoring armor and 10 for not ignoring it.
The damage is: 1,2,4,8,16,32,64,128,256,512,1024
The effect is set to be fired when a unit receive the buff, furthmore it is hidden and got a 0.00 sec duration.
For the damage reduction, set the field armor near the damage to 1.

The behavior is based on PsiStorm.
The map containing it is attached.

Global variables:
  • DamageBehaviors = "" <string[1][10]>
  • DamageMax = 0 <int>
  • DamageMaxN = 0 <int>

Function:
Code:
Dummy Options: Action Return Type: void Actions Custom script action
Code:
} void print(string s){ UIDisplayMessage(PlayerGroupAll(),c_messageAreaSubtitle,StringToText(s)); } void UnitDamageTarget(unit source,unit target,fixed amount,bool count_armor){ // Variable Declarations int i = gv_DamageMaxN; int ignore_armor = 0; int pow_val = 0; if(count_armor){ ignore_armor=1; } if(amount<gv_DamageMax){ while(i>0){ pow_val = FixedToInt(Pow(2,i)); if(amount>=pow_val){ UnitBehaviorAdd( target, //Target gv_DamageBehaviors [ignore_armor] //Armor [i], //Damage source, //Source 1 //No idea ); amount=amount-pow_val; } i=i-1; } }else{ print("Exceeding Max Damage of :"+IntToString(gv_DamageMax)+" !"); }

Trigger:
Code:
InitDamageBehaviors Events TriggerAddEventMapInit() Actions Custom script action
Code:
//Ignore Armor gv_DamageBehaviors[0][0]="DamageTarget"; //1 damage gv_DamageBehaviors[0][1]="DamageTarget2"; //2 damage gv_DamageBehaviors[0][2]="DamageTarget3"; //4 damage gv_DamageBehaviors[0][3]="DamageTarget4"; //8 damage gv_DamageBehaviors[0][4]="DamageTarget5"; //16 damage gv_DamageBehaviors[0][5]="DamageTarget6"; //32 damage gv_DamageBehaviors[0][6]="DamageTarget7"; //64 damage gv_DamageBehaviors[0][7]="DamageTarget8"; //128 damage gv_DamageBehaviors[0][8]="DamageTarget9"; //256 damage gv_DamageBehaviors[0][9]="DamageTarget10"; //512 damage gv_DamageBehaviors[0][10]="DamageTarget11"; //1024 damage //Do not ignore Armor gv_DamageBehaviors[1][0]="DamageTargetArmor"; //1 damage gv_DamageBehaviors[1][1]="DamageTargetArmor2"; //2 damage gv_DamageBehaviors[1][2]="DamageTargetArmor3"; //4 damage gv_DamageBehaviors[1][3]="DamageTargetArmor4"; //8 damage gv_DamageBehaviors[1][4]="DamageTargetArmor5"; //16 damage gv_DamageBehaviors[1][5]="DamageTargetArmor6"; //32 damage gv_DamageBehaviors[1][6]="DamageTargetArmor7"; //64 damage gv_DamageBehaviors[1][7]="DamageTargetArmor8"; //128 damage gv_DamageBehaviors[1][8]="DamageTargetArmor9"; //256 damage gv_DamageBehaviors[1][9]="DamageTargetArmor10"; //512 damage gv_DamageBehaviors[1][10]="DamageTargetArmor11"; //1024 damage //Other variables gv_DamageMaxN=11; //[max slot at array 4]+1 gv_DamageMax=FixedToInt(Pow(2,gv_DamageMaxN)); //Base ^ n





---EDIT---
Played around a bit with behaviors, they work quite well. But is there any way to change the damage dealt by a behavior on the fly or do we need like 10 different behaviors to deal any amount damage we want?
I guess i've to create some behaviors with damage based on 2^n...
---EDIT2---
Alright got it to work, gonna update this post once i'm done.
Attached Files
File Type: sc2map UnitDamageTarget.SC2Map (194.8 KB, 2 views)

Last edited by Fireeye : 07-14-2010 at 04:24 PM. Reason: cpp tag does not work atm
Fireeye is offline   Reply With Quote
Old 08-09-2010, 03:45 PM   #2
Ranakastrasz
Junior Member
 
Join Date: Aug 2010
Posts: 18
Default

I managed to make a much easier damage function, using a custom damage effect, and a catalog modify call

Code:
UnitDamageUnit Options: Action Return Type: void Parameters Damager = null <unit> Damagee = null <unit> Damage = 0.0 <fixed> Grammar Text: UnitDamageUnit(~Damager|Damaging Unit~, ~Damagee|Damaged unit~, ~Damage|Amount of damage~) Hint Text: This function causes a unit to deal damage to anouther unit, via catalogs and a custom effect Custom Script Code Local Variables Actions CatalogFieldValueSet(c_gameCatalogEffect, "Damage", "Amount", (UnitGetOwner(Damager)), (FixedToString(Damage, 2))) UnitCreateEffectUnit(Damager, "Damage", Damagee)

Along with a custom effect that was copied from a unit's attack's damage effect, With the Id of "Damage". This may be an easier method.
Ranakastrasz is offline   Reply With Quote
Old 08-17-2010, 09:30 PM   #3
Zerzax
Zerzy
 
Zerzax's Avatar
 
Join Date: Aug 2010
Location: U.S.
Posts: 11
Send a message via AIM to Zerzax
Default

My question is why Blizzard hasn't implemented it yet.
Zerzax is offline   Reply With Quote
Old 08-18-2010, 09:00 AM   #4
Anitarf
Procrastination incarnate
 
Join Date: Jul 2010
Posts: 28
Default

The method proposed by Ranakastrasz is indeed better, not only because it is simpler, but also because dealing damage with multiple chunks would apply armour every time, although you could probably avoid that by only considering armour on the first, largest chunk; that would still yield incorrect results if the armour value is larger than that chunk, though. Furthermore, dealing damage in chunks would fire a bunch of damage events where there should only be one. Good thing we have catalog natives.
Anitarf is offline   Reply With Quote
Old 08-20-2010, 07:19 AM   #5
Hydrolisk
AKA Sand Wraith
 
Hydrolisk's Avatar
 
Join Date: Aug 2010
Posts: 6
Default

Quote:
Originally Posted by Ranakastrasz
I managed to make a much easier damage function, using a custom damage effect, and a catalog modify call

Code:
UnitDamageUnit Options: Action Return Type: void Parameters Damager = null <unit> Damagee = null <unit> Damage = 0.0 <fixed> Grammar Text: UnitDamageUnit(~Damager|Damaging Unit~, ~Damagee|Damaged unit~, ~Damage|Amount of damage~) Hint Text: This function causes a unit to deal damage to anouther unit, via catalogs and a custom effect Custom Script Code Local Variables Actions CatalogFieldValueSet(c_gameCatalogEffect, "Damage", "Amount", (UnitGetOwner(Damager)), (FixedToString(Damage, 2))) UnitCreateEffectUnit(Damager, "Damage", Damagee)

Along with a custom effect that was copied from a unit's attack's damage effect, With the Id of "Damage". This may be an easier method.

Can you release that along with the Effect and stuff? This would be so useful, and I'd greatly appreciate it.
__________________
Hydrolisk is offline   Reply With Quote
Old 08-21-2010, 01:00 PM   #6
Adovid
Data Editor ZOMG
 
Adovid's Avatar
 
Join Date: Aug 2010
Posts: 41
Default

Now that I know that behavior buffs can modify combat damage-- I'm thinking this kind of thing can be done in the data editor by using a buff that modifies combat damage based on requiring an effect from an array (combat require effect array ?). I'm guessing the way it would work is each buff could be an armor against a set of attacks with effects that are in the array. Haven't tested it out yet.

[edit: yeah I tested it out, works! A unit can be invulnerable to the attacks of other units just by having a behavior buff that reduces damage to zero for all effects in the required array and it seems like every weapon uses an effect to deal damage so you can just use those effects.]

Last edited by Adovid : 08-21-2010 at 03:50 PM.
Adovid is offline   Reply With Quote
Old 09-22-2010, 12:29 AM   #7
busterkomo
Junior Member
 
Join Date: Jul 2010
Posts: 1
Default

Patch 1.1.0 added a damage function.
busterkomo is offline   Reply With Quote
Old 09-23-2010, 08:51 AM   #8
Adovid
Data Editor ZOMG
 
Adovid's Avatar
 
Join Date: Aug 2010
Posts: 41
Default

Yes, pretty neat.

They also fixed the warping immortals. I haven't been able to test but I wounded if all hidden abilities are broken by this update. (My power supply went out on my sc2 machine, broke last week so I am stuck without being able to test out the new patch)
Adovid is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 10:20 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.