• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Damage Detection Trouble

Status
Not open for further replies.
Level 3
Joined
Mar 6, 2010
Messages
36
Alright guys, I have a vamps game, and for those of you that don't know about it: the humans build towers around their base in order to defend themselves from the vampires. In my game, vampires gain blood from attacking a unit, and also gain Blood(their currency) based on the damage dealt.


My problem here is:

Each tower has the ability: "Blood Barrier", which would prevent the Vampire from gaining any Blood off of it. I have problems recognizing which tower has used the Blood Barrier ability for when the vampire attacks it (resulting in no blood gain, and which I'm trying to detect in the "Blood" Trigger)
Note: I couldn't make this an upgrade from the tower, or an actual effect because I'm not good with those parts of the editor, I tried basing it off of the orc "Spiked Barrier" or whatever, so I resulted to triggers and damage detection. So if there's a easier way around this, please let me know.

I know what parts are having problems, and what part of the trigger is messed up, but I just don't know what to replace them with that will make it work.

Here is the code:
NOTE: I used the GDD(GUI-Friendly Damage Detection) system.

When the tower uses the ability:
  • Blood Barrier Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Barrier
    • Actions
      • Set Caster = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of Caster) Current lumber) Greater than or equal to 50
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BloodBarrierUnit[NumberOfBloodUnits[(Player number of (Triggering player))]] Equal to Caster
            • Then - Actions
              • Game - Display to (Player group((Owner of Caster))) the text: (playercolor[1] + Error: This unit already has Blood Barrier activated.)
            • Else - Actions
              • Set NumberOfBloodUnits[(Player number of (Triggering player))] = (NumberOfBloodUnits[(Player number of (Triggering player))] + 1)
              • Set BloodBarrierUnit[NumberOfBloodUnits[(Player number of (Triggering player))]] = Caster
              • Unit Group - Add Caster to BloodBarrierGroup[(Player number of (Triggering player))]
              • Player - Set (Owner of Caster) Current lumber to (((Owner of Caster) Current lumber) - 50)
              • Game - Display to (Player group((Owner of Caster))) the text: (playercolor[7] + Blood Barrier has been activated on this unit.)
        • Else - Actions
          • Game - Display to (Player group((Owner of Caster))) the text: (playercolor[1] + Error: Not enough Lumber.)
When the vampires attacks the tower(either gaining blood or no blood):
  • Blood
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of GDD_DamagedUnit) Not equal to Vampire
          • (Unit-type of GDD_DamageSource) Equal to Vampire
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BloodBarrierUnit[NumberOfBloodUnits[(Player number of (Owner of GDD_DamagedUnit))]] Equal to GDD_DamagedUnit
        • Then - Actions
        • Else - Actions
          • Player - Set (Owner of GDD_DamageSource) Current gold to (((Owner of GDD_DamageSource) Current gold) + ((Integer(GDD_Damage)) / Blood))
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
im not sure what ere you trying to detect... if you can detect when tower is casting an ability what more do you need actually ?



anyway...
i think making a vamp game could be very bad (i mean to make people want to play your vamp game)...because there is already a vamp game...

- the vamp game is very hard to balance

- the vamp actually only has one enemy for Vamp and it is "Wall" ,i mean it is the only attack-able and not easy kill-able enemy,,the problem in that is that
you cant make some special (targeting) skills for vamp
-heroes like strength,intelligence,agility hero would not have much use
-i wanna say that vamp has no creeps to witch he would use some abilities accept the wall and a slayer that must die fast,if the slayer would be to strong it can make the game inbalanced because humans could kill the vamp with slayers
-im no sure if there is a way to make some big different between one vamp and the other
-im not sure if they is a good way to make vamp game better than Vampirism Fire

(it is good for learning triggers and i think that will be it,but who knows maybe you do a good vamp game xD)
i recommend you not to do a vamp game,but if you want..


the thing i can give you is a good trigger that will stop other players to build in base if they are not allowed

sorry if this is a bit off topic
 
You can add your tower in a Unit Group, once they cast the Blood Barrier ability. Then, in your Damage Detection System, you will need a Boolean comparison, that will check if the unit is in that Unit Group.
  • If (All conditions are true) then do (Actions) else do (Actions)
  • If - Conditions
    • (GDD_DamagedUnit is in UnitGroup) Equal to False
  • Then - Actions
    • Player - Set (Owner of GDD_DamageSource) Current gold to (((Owner of GDD_DamageSource) Current gold) + ((Integer(GDD_Damage)) / Blood))
You will need some MUI here though, which requires hashtables. I will write the triggers, if you know how to handle, good.
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hashtable = (Last created hashtable)
  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Blood Barrier
  • Actions
    • Set Point1 = (Position of (Triggering unit))
    • Unit - Create 1 dummy unit for (Owner of (Triggering unit)) at Point1 facing default building degrees
    • Hashtable - Save (Triggering unit) as (Key(tower)) of (Key(Last created unit)) in Hashtable
    • Unit Group - Add (Triggering unit) to (BloodBarrierGroup)
    • -------- The following timer value will follow the duration of your Blood Barrier ability. --------
    • -------- If the duration is for example 30.00 seconds, then place 30.00 for the expiration timer. --------
    • Unit - Add 20.00 seconds generic expiration timer to (Last created unit)
    • Custom script: call RemoveLocation (udg_Point1)
  • Trigger2
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Dummy
    • (Load (Key(tower)) is stored as a Handle of (Key(Triggering unit)) in Hashtable) Equal to True //Boolean comparison (Hashtable - Hashtable value exists)
  • Actions
    • Set Tower = (Load (Key(tower)) of (Key(Triggering unit)) from Hashtable)
    • Unit Group - Remove Tower from BloodBarrierGroup
    • Hashtable - Clear all childhashtables of (Key(Triggering unit)) in Hashtable
So, like I said, you will make the comparison if your damaged unit is in BloodBarrierGroup.
 
Level 3
Joined
Mar 6, 2010
Messages
36
You can add your tower in a Unit Group, once they cast the Blood Barrier ability. Then, in your Damage Detection System, you will need a Boolean comparison, that will check if the unit is in that Unit Group.
  • If (All conditions are true) then do (Actions) else do (Actions)
  • If - Conditions
    • (GDD_DamagedUnit is in UnitGroup) Equal to False
  • Then - Actions
    • Player - Set (Owner of GDD_DamageSource) Current gold to (((Owner of GDD_DamageSource) Current gold) + ((Integer(GDD_Damage)) / Blood))
You will need some MUI here though, which requires hashtables. I will write the triggers, if you know how to handle, good.
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hashtable = (Last created hashtable)
  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Blood Barrier
  • Actions
    • Set Point1 = (Position of (Triggering unit))
    • Unit - Create 1 dummy unit for (Owner of (Triggering unit)) at Point1 facing default building degrees
    • Hashtable - Save (Triggering unit) as (Key(tower)) of (Key(Last created unit)) in Hashtable
    • Unit Group - Add (Triggering unit) to (BloodBarrierGroup)
    • -------- The following timer value will follow the duration of your Blood Barrier ability. --------
    • -------- If the duration is for example 30.00 seconds, then place 30.00 for the expiration timer. --------
    • Unit - Add 20.00 seconds generic expiration timer to (Last created unit)
    • Custom script: call RemoveLocation (udg_Point1)
  • Trigger2
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Dummy
    • (Load (Key(tower)) is stored as a Handle of (Key(Triggering unit)) in Hashtable) Equal to True //Boolean comparison (Hashtable - Hashtable value exists)
  • Actions
    • Set Tower = (Load (Key(tower)) of (Key(Triggering unit)) from Hashtable)
    • Unit Group - Remove Tower from BloodBarrierGroup
    • Hashtable - Clear all childhashtables of (Key(Triggering unit)) in Hashtable
So, like I said, you will make the comparison if your damaged unit is in BloodBarrierGroup.

Gah, I feel so stupid, i knew I was missing a condition function like that: "Is unit in unit group" that's going to help me so much later on. Thank you so much for your help, and making it MUI. :thumbs_up: +rep for you, THANK YOU!

Problem solved :)

To ALiEN95: What's different from my vamps game from other has a lot to do with the builders. Builders now have something called "Base Control" that they can use. It can close/open their base, preventing other builders from going inside. Also, they have the ability to abandon their base, that teleports them to the entrance of their base and allows no base control further on in the game. Located in the base control is something called Harvester Control, that can create your harvesters. There are two types of harvesters, one called green area harvester and the other is called an outside harvester. When you make your first green area harvester, it gets teleported to a "Green Area"(Which is used to harvest lumber more efficiently) that is not taken currently. Each green area has a capacity that, once reached, no more green area harvesters can go in it. The "Harvester Control" from then on, is used as a teleporter to go in and out of your green area with your green area harvesters, but here's the catch: Vampires can enter this area with a spell that randomly teleports them to one of the 9 green areas that are activated and he can get feed from there, then he is teleported to the spawn point. Most likely a long cooldown. That's not all, but that's what i've got so far.
 
Status
Not open for further replies.
Top