elmstfreddie
The Finglonger
- Reaction score
- 203
Well, I'm not done yet, but I've started. I just wanted to make the thread to tell everyone what WILL be done:
This is a system that will use Str, Agi, and Int for triggered uses. Str will be used for shields, Agi will be used for Deflectors, and I'm still deciding what to do with Int (maybe laser power?).
Every time a hero is attacked, it will do the following:
Depending on your Agi (your Deflector's Power), you have a % chance to deflect the attack, taking no hull or shield damage.
If your deflectors fail, the attack will do damage to your shields. Shields are like a secondary HP. The damage dealt will be subtracted from your shields (str). If you have less shield power than the damage dealt, your shield power will be taken to 0, and your hull will take some damaging, depending on how much shield power there was. (for example someone does 10 damage, you have 5 shield power, your hull will take 5 damage).
Oh yeah, if your shield fails or your hull takes damage your screen will shake
For attacking:
I am planning on making lasers units that go forward forever (they are lasers, give me a good reason for them to stop ), until they hit a ship. The damage dealt will depend on the attacker's Int, and the defender's deflector chance, shields, etc.
Downfall:
Because I use Str, Agi, and Int for this system, you won't be able to use it for the normal stuff.
Working on:
Attacking
Completed:
Defence mechanisms (hull, shield, deflectors).
Agi = Deflector Strength
Just paste the code into your map to test, I won't release a test map until I have finished all coding so that I can add custom models to make it look nice.
This is a system that will use Str, Agi, and Int for triggered uses. Str will be used for shields, Agi will be used for Deflectors, and I'm still deciding what to do with Int (maybe laser power?).
Every time a hero is attacked, it will do the following:
Depending on your Agi (your Deflector's Power), you have a % chance to deflect the attack, taking no hull or shield damage.
If your deflectors fail, the attack will do damage to your shields. Shields are like a secondary HP. The damage dealt will be subtracted from your shields (str). If you have less shield power than the damage dealt, your shield power will be taken to 0, and your hull will take some damaging, depending on how much shield power there was. (for example someone does 10 damage, you have 5 shield power, your hull will take 5 damage).
Oh yeah, if your shield fails or your hull takes damage your screen will shake
For attacking:
I am planning on making lasers units that go forward forever (they are lasers, give me a good reason for them to stop ), until they hit a ship. The damage dealt will depend on the attacker's Int, and the defender's deflector chance, shields, etc.
Downfall:
Because I use Str, Agi, and Int for this system, you won't be able to use it for the normal stuff.
Working on:
Attacking
Completed:
Defence mechanisms (hull, shield, deflectors).
Defence Mechanism
Str = Shield HPAgi = Deflector Strength
Just paste the code into your map to test, I won't release a test map until I have finished all coding so that I can add custom models to make it look nice.
JASS:
//-----------------Defence Mechanisms-----------------//
function Add_Every_Unit_Group takes nothing returns nothing
call TriggerRegisterUnitEvent(gg_trg_Damage_Reduction,GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction
function Add_Every_Unit takes nothing returns nothing
local group Group = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroup(Group,function Add_Every_Unit_Group)
call DestroyGroup(Group)
set Group = null
endfunction
function TextTagMessage takes texttag tt,real lifespan,integer colourred,integer colourgreen,integer colourblue,integer transparency,real fadepoint,real x,real y,real heightoffset,real xspeed,real yspeed,string message,real size,boolean show returns nothing
call SetTextTagPermanent(tt,false)
call SetTextTagLifespan(tt,lifespan)
call SetTextTagColor(tt,colourred,colourgreen,colourblue,transparency)
call SetTextTagFadepoint(tt,fadepoint)
call SetTextTagPos(tt,x,y,heightoffset)
call SetTextTagVelocity(tt,xspeed,yspeed)
call SetTextTagText(tt,message,size)
call SetTextTagVisibility(tt,show)
endfunction
constant function DeflectorChance takes integer Deflectors returns integer
return (Deflectors + 0) * 1
endfunction
function Trig_Damage_Reduction_Conditions takes nothing returns boolean
return (IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true) and (not(UnitHasBuffBJ(GetTriggerUnit(),039;Immo039;)))
endfunction
function Trig_Damage_Reduction_Actions takes nothing returns nothing
local unit Def = GetTriggerUnit()
local integer Shield = GetHeroStr(Def,false)
local integer Deflectors = GetHeroAgi(Def,true)
local real DamageDealt = GetEventDamage()
local texttag Message = CreateTextTag()
local integer FlashRedL = 1
if (GetRandomInt(1,100) < DeflectorChance(Deflectors)) then
call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + DamageDealt))
call TextTagMessage(Message,1.00,0,255,0,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Deflected",0.0240,true)
else
if (Shield >= DamageDealt) then
call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + DamageDealt))
call SetHeroStr(Def,(Shield - (R2I(DamageDealt))),false)
call TextTagMessage(Message,1.00,0,0,255,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Shield Damage Taken",0.0240,true)
else
if (Shield > 0) then
call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + Shield))
call SetHeroStr(Def,0,false)
call TextTagMessage(Message,1.00,0,0,255,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Shield Failure",0.0240,true)
else
call TextTagMessage(Message,1.00,255,0,0,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Hull Damage Taken",0.0240,true)
loop
exitwhen FlashRedL > 17
call SetUnitVertexColor(Def,255,(255 - (15 * FlashRedL)),(255 - (15 * FlashRedL)),255)
set FlashRedL = (FlashRedL + 1)
endloop
loop
exitwhen FlashRedL < 1
call SetUnitVertexColor(Def,255,(255 - (15 * FlashRedL)),(255 - (15 * FlashRedL)),255)
set FlashRedL = (FlashRedL - 1)
endloop
endif
endif
endif
set Def = null
set Message = null
endfunction
function InitTrig_Damage_Reduction takes nothing returns nothing
set gg_trg_Damage_Reduction = CreateTrigger()
call TriggerAddCondition(gg_trg_Damage_Reduction,Condition(function Trig_Damage_Reduction_Conditions))
call TriggerAddAction(gg_trg_Damage_Reduction,function Trig_Damage_Reduction_Actions)
call Add_Every_Unit()
endfunction
//-----------------Add New Units-----------------//
function Trig_Add_New_Unit_Actions takes nothing returns nothing
call TriggerRegisterUnitEvent(gg_trg_Damage_Reduction,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
endfunction
function InitTrig_Add_New_Unit_Actions takes nothing returns nothing
set gg_trg_Add_New_Unit = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_Add_New_Unit,GetPlayableMapRect())
call TriggerAddAction(gg_trg_Add_New_Unit,function Trig_Add_New_Unit_Actions)
endfunction