| 08-13-2007, 10:02 PM | #1 |
I'm trying to implement damage detection systems. I've tried using Shadow1500's and Vexorian's, but both of them are confusing to me. I'm still new to JASS and I'm really confused what goes where and how to use any of it. Does it give me a new function to call that gives me the damage of something? Is there a command to get which unit damaged it and what type? I have no idea how the algorithm works so I'm having trouble figuring out how to even use it. Any direction to make sense of this is appreciated. Thanks ahead of time. |
| 08-14-2007, 06:04 AM | #2 |
I had a hard time implementing Shadow1500's system also, and I eventually learned (the hard way). The attacking unit is JASS:GetEventDamageSource() JASS:GetTriggerUnit() |
| 08-17-2007, 02:35 PM | #3 |
I realized I didn't specify the different things I was confused about, so here's all the stuff I wondering. 1.Are these two commands (GetEventDamageSource() and GetTriggerUnit()) used within 1500's JASS code, or the trigger referenced in the beginning of the JASS code: JASS://Your actions here2. How do I get a real number that tells me the damage dealt? Is there a command or variable that stores that, or do I simply call a certain function? 3. If the system does not run every time a unit recieves damage, where do I specify the event that I want to detect damage? Or does this create an event that can be used (EVENT_UNIT_TAKES_DAMAGE)? If the system DOES run every time a unit takes damage, what variable does it store it to temporarily (going back to question #2). |
| 08-17-2007, 03:22 PM | #4 | |
Quote:
|
| 08-17-2007, 03:40 PM | #5 |
OK, so let me make sure I have this: EVENT_UNIT_DAMAGED is the event GetTriggerUnit() is the damaged unit GetEventDamageSource() is the damaging unit GetEventDamage() is the damage recieved do these commands work only in shadow 1500's trigger, or can I make a seperate trigger that will use all these commands? Please keep in mind I'm new to JASS and do not grasp natives or handles. |
| 08-17-2007, 03:43 PM | #6 | |
Quote:
Shouldn't this be somewhere in the system documentation or something? |
| 08-17-2007, 03:55 PM | #7 |
http://www.wc3jass.com/viewtopic.php...mage+detection If I was more familiar with JASS I might, but to a newcomer it was overwhelming. |
| 08-17-2007, 04:19 PM | #8 |
Oh yeah comments in the form of JASS:// part 1 // part 2 // part 3 really helpful. Systems like that should not be approved. EDIT: I was just wondering... What is the difference between unit is attacked and unit takes damadge ? The fact that you can see how much damadge was dealt? Why would you need that? |
| 08-17-2007, 05:34 PM | #9 | |||||||||
Quote:
Thu Jan 19, 2006 And in that time vJASS was barely a dream. So please don't come with that kind of comments. Quote:
Resuming:
@CastleMaster: Quote:
The only thing that you have to do with this system is to add your custom code to this function: JASS:function AnyUnitTakesDamage takes nothing returns nothing // your actions here // Sample Damage display: call BJDebugMsg( "Damage: " + R2S(GetEventDamage()) ) // of course, you can change the code for the things you need to detect or do in your map. endfunction And, inside this function, if you want to get the damage, you should use the command GetEventDamage(), to get the attacker unit: GetEventDamageSource() and the affected unit GetTriggerUnit() |
| 08-17-2007, 05:52 PM | #10 | |
Quote:
What does that got to do with anything? How is lack of comments/documentation in any way connected with vJASS or even with the date of trigger? People back from 1960 knew how to make proper code, it has nothing to do with tools or anything. |
| 08-17-2007, 07:12 PM | #11 |
A lapsus, my apologies. I hope the other part of my post can be useful to this thread and its starter. |
| 08-17-2007, 08:20 PM | #12 |
Ok, I've about got it figured out, (thanks Moyack) I'm now having trouble making the line of code that is the actual event. I keep getting a "cannot convert unitevent to unitplayerevent" and other problems when I fiddle with that line of code since there is no GUI equivalent for me to convert and look at. |
| 08-17-2007, 09:06 PM | #13 |
Shouldn't the system already handle the event? What are you trying to do? |
| 08-17-2007, 10:23 PM | #14 |
I'm trying to make another trigger that uses Shadow 1500's DamageModify system. http://www.wc3jass.com/viewtopic.php?t=2653 I'm trying to make a trigger whose event is "a unit takes damage" GUI does not have this event (as far as I know), but JASS does. I'm trying to write the event line of the trigger, basing it off of "a unit is attacked" JASS:call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ATTACKED ) JASS:call TriggerRegisterUnitEvent( gg_trg_Untitled_Trigger_001, EVENT_UNIT_DAMAGED ) |
| 08-17-2007, 10:54 PM | #15 |
As you can see, the EVENT_PLAYER_UNIT_ATTACKED is a player unit event while EVENT_UNIT_DAMAGED is a specific unit event. The function TriggerRegisterAnyUnitEventBJ actualy creates multiple player owned unit events, one for each player (since there's actualy no such thing as a generic unit event), that's why it can use a player unit event, but can't use a specific unit event. That's the whole reason why we need special systems to detect damage that dynamicaly create specific unit event triggers as units are created and clean them up as untis die. The whole point of Shadow's system is that you do all damage modifying stuff in that one function that the system provides. You don't make "another trigger". You do everything there. |
