HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to use 8 attack and 8 armor types with triggers?

01-23-2008, 05:14 PM#1
MasterofSickness
I must use 8 attack-/armortypes in my map and because through Game-Interface and Gameplay-Constants it is not possible, there is no other way then to trigger it (for now).

So, how do I make such a system?
In general I need a damage detection system right?
I looked a whole day at the Damage Detection system by grim001 and understood a little bit...
ok, almost nothing because of the Function Interface combined with Interfaces and so on *hui, heavy stuff for non programmer*
Sadly there are very minor discussions about these topics here in the forum so that I have my issues to understand it only with the help from JassHelper 0.9.9.7.
Well, I think I can use it although understanding it slightly.
But how would I go on?
Till here I only get the damge values that already have been dealt, so I can not edit them before damage is distributed or?
So what to do now? Using BonusMod (never used it before)?
Or checking every unit with if then else and so on? (could become very slow if I'm not mistaken)

I'm very curious about your answers, because this System is a must have Sys for my map
Thanks alot that you are sharing your wisdom!
01-23-2008, 05:41 PM#2
TaintedReality
Detect all damage, determine if it's from an attack or spell, if it's from an attack then determine how much health should be blocked based on the armor and attack type.
01-24-2008, 12:30 PM#3
MasterofSickness
Ok, with that sys from grim I can detect the damage and whether it is an attack or spell, but how can I "block" a special amount of health?

An Example:

An Unit has 50 lives.
It gets 10 damage from an attack.
But because it has a special armor it gets only 90% of damge.
So it only should loose 9 lives instead of 10.
So, after detected the armor I add 1 live or what
(% * damage = value for adding lives;
0,9 * 10 = 1)?
EDIT2: "After reading a bit deeper into grims sys, it looks like conditions from the event EVENT_UNIT_DAMAGED are fired before the actual damage is distributed. And AH! now it also makes sense that this condition always must return false in the end, so that the actual damage isn't fired at all! haha... kkk <- I mean this is right or?!"
No, I was wrong, damage is dealt in normal way, you can just change it by using the onDamage methods.

And how do I set and detect an armor or attack type?
With abilities or with BonusMod??

EDIT: Ui, Vex has birthday today
01-24-2008, 02:31 PM#4
tamisrah
I haven't looked into grims attack detect but you will probably need something like this function:
Quote:
Originally Posted by Shadow1500
Collapse JASS:
function DamageModify_Child takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")

    if GetHandleBoolean(t,"fix") then
        call UnitRemoveAbility( u, DeadFixerAbility() )
    endif
    call SetUnitState(u ,UNIT_STATE_LIFE, GetHandleReal(t,"finalhp") )

    set u = null
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
endfunction

// This function will "block" a certain amount of damage done to the unit
// Needs to be used in the EVENT_UNIT_DAMAGED event.
function DamageModify takes unit whichUnit, real dmg, real dmgnew returns nothing
 local timer t = CreateTimer()
 local real life = GetUnitState(whichUnit, UNIT_STATE_LIFE)
 local real maxlife = GetUnitState(whichUnit, UNIT_STATE_MAX_LIFE)
 local boolean usetimer = false
 local real dmgback = dmg-dmgnew
 local real finalhp = life-dmgnew
    if dmgnew>dmg then
        return
    endif
    if dmg > maxlife then
        call UnitAddAbility( whichUnit,DeadFixerAbility())
        call SetHandleBoolean(t, "fix", true)
        set maxlife = 1000+maxlife
        set usetimer = true
    endif
    if ( life+dmgback > maxlife ) then
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, maxlife )
        set usetimer = true
    else
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, life+dmgback )
    endif
    if usetimer then
        call SetHandleHandle(t,"u",whichUnit)
        call SetHandleReal(t,"finalhp",finalhp)
        call TimerStart(t, 0, false, function DamageModify_Child)
    else
        call DestroyTimer(t)
    endif
    set t = null
endfunction

(I believe I took it from his shield system on this site)
With this function you are able to control the damage dealt and it even avoids fatals.
You just use it as an onAttack action within grims system. The only thing left for you to do would be figuring out how to decide which armortype the unit has.
01-24-2008, 05:48 PM#5
TaintedReality
I don't think you have any clue what you're doing, to be honest. You're just getting deeper and deeper into other peoples' systems without understanding what's going on. If you want 8 attack and 8 armor types, you're completely triggering it. That means you're creating your own armor and attack types, displaying them however you want, and checking for them however you want. You're also checking all damage that is dealt and modifying it based on armor. I think that you need to get some basic knowledge of triggering and of the world editor first before trying to do this. If you don't know what you're doing it's just going to be a huge mess.
01-24-2008, 06:21 PM#6
MasterofSickness
@ tamisrah
Hey, many thanks for that stuff, I will have a look at it!

@ TaintedReality
I prove you right that I'm missing basics, especially in Interfaces, but that topic isn't so easy to understand right away for someone who only learned a little bit quick pascal at school *g
Perhaps you can give me some substantial links (for example good forum links or even over the net) for learning the basics. The tutorial section is apparent and search function is known very well (I don't like it when you have to w8 a whole minute till you can search for new keywords ).

In the meantime I will read and learn some stuff I find about buffs, because here's definitely my darkest place for the moment.

(First I felt a little bit attacked from your post, but that's of course blah)
01-24-2008, 07:24 PM#7
Av3n
Trigger your attack types... This can be easily done both in GUI and JASS

Learn to malipulate(however you spell this) global arrays assigned to units, and you'll do well.

If you want the thing to actually happen for ranged units.
Go through Vex's code for the Handle Vars to vJass conversion tut and search out how to calculate missle speed.
And use the OnAttack Template if you don't want to use it (Demo section of Demo Maps)

Buffs... Use auras in this situation a.k.a permenant buffs. And use GetUnitAbilityLevel(<unit>,<buffid>) > 0 to see if a unit has a buff. GetUnitAbilityLevel(<unit>,<buffid>) < 1 to see if the unit no longer has a buff. Because of Wc3 buff refresh rate is every 4 seconds, you might want to remove it straight away instead

-Av3n
01-24-2008, 08:09 PM#8
TaintedReality
Sorry for being kind of an ass. But really, you've made several posts on this same topic when the answer is pretty obvious and self-explanatory.

Edit: I really do feel bad, because your posts have been polite and haven't been annoying. But at this point I think you have the information you need from us, you just need to do some work on your own to understand it.
01-25-2008, 12:22 PM#9
Anitarf
Damage detection and prevention is not a trivial thing to do. I have made an as of yet unreleased modification to my ABuff system that lets me prevent damage (I made it to trigger a starcraft-like armour system, but it could also be used to trigger custom attack and defense types), if you'd like to use it I could send it to you.
01-25-2008, 01:42 PM#10
MasterofSickness
@ Av3n
Thanks for that hint for arrays and Vex's code, will read it.
Ah, now buffs become a little bit more familiar, but I will have to read a little bit more.

@ TaintedReality
Quote:
you've made several posts on this same topic
You mean the other two threads from the development forum?
Well, there I only wanted to know if it is possible to make it through Game-Interface and Gameplay-Constants, but sadly not.
Here I wanted to ask for a good jass alternative.
Quote:
I really do feel...
The fact, that you react to my expressed feelings and showing yours by apologizing you don't have to feel bad anymore. I was not angry about you, I only felt a little bit down. But that is ok. If you want something good and ask for help, then you also have to do your homework when you get the needed help, so you are right, I have enough new information for now.
You feel good now again! Thats a command!

@ Anitarf
That would be great! If it is ok for you that I can read and perhaps use it (of course I would add you to helper list in my map) I would very gladly have a look into it.