• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Morale Triggers

Status
Not open for further replies.
Level 22
Joined
Jun 23, 2007
Messages
3,242
For my Medieval Tech Wars map, I plan on using a Morale system that will affect alot of the gameplay. So basically I've replaced Mana with Morale. Each spawned unit has some sort of feedback (mana rupture depends on weapon/unit type), so that they drain morale each time they attack.
Some units drain more than others, for example, Conscripts drain 5 morale, while a Silver Templar can drain up to 40.
Once Morale reaches 0, the unit deals 80% less damage, and has 150% reduced armor.
Morale is restored either by certain units abilities, like the Captain's Rally Ability, or either over time.

I've run into some trouble while triggering this to work. So far I've created 2 auras that target's SELF, one for reduced damage, one for reduced armor.

So when a unit reaches 0 morale, i just add the two auras via triggers. Now, the problem is how to detect how much morale a unit has.
This goes the same for restoring morale, I dont know how to detect how much morale the unit has so i can remove both auras.

some help plz?
 
Level 9
Joined
Jan 23, 2008
Messages
384
i know what are you trying to do so here you are :wink: :
  • Creating a Unit
    • Events:
      • Unit - A unit sells a unit
    • Conditions:
      • (Unit-type of (Selling unit)) Equal to YourUnit
    • Actions:
      • Trigger - Add to No Morale <gen> the event (Unit - (Sold unit)'s mana becomes Equal to 0
      • Trigger - Add to Hooray we have Morale <gen> the event (Unit - (Sold unit)'s mana becomes Greater than 20
  • No Morale
    • Events:
    • Conditions:
    • Actions:
      • Unit - Add YourAbility to (Triggering Unit) -------- (NOTE:"YourAbility" is a negative spell that does the effect when the units moral reaches 0)
  • Hooray we have Morale
    • Events:
    • Conditions:
    • Actions:
      • Unit - Remove YourAbility from (Triggering Unit)
Hopefully i was clear ask if something isn't cleat :thumbs_up: !
 
Level 17
Joined
Jan 21, 2007
Messages
2,014
I believe the add event action leaks, without any way of fixing it. I'd do it like this:

every 0.27 second(if GUI :d)
Pick every unit in map that has 0 mana and isn't in NoMorale
Add unit to unit group NoMorale
Add abilities
Pick every unit in map that has 0 mana equal to false and is in NoMorale
Remove from NoMOrale
Remove Abilities


Make sure you fix leaks here.

And it's all in 1 trigger!
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
hell, i dont get why i need to make the nomorale variable.

ok, here are my two triggers, please check if theres anything wrong with them:
Morale Broken
Events- Every .25 seconds of the game
Conditions-
Actions- Custom Script = bj_wantDestroyGroup = true
Unit Group- Pick every unit in playable area with less than or equal to 0 mana and do actions:
Loop - Actions
Unit- Add Morale Broken (Damage) to picked unit
Unit- Add Morale Broken (Armor) to picked unit
Create 1 DUMMY for player 1 at the position of picked unit
Unit- Add Morale Breaker (Buff) to Last Created Unit
Unit- Order Last Created Unit to Acid Bomb picked unit

Sooo the Morale Breaker spell is just acid bomb with a buff that displays some sort of effect around the unit that has no morale. lasts 3600 seconds.

Morale Restored
Events - Every .25 seconds of the game
Conditions -
Actions- Custom Script = bj_wantDestroyGroup = true
Unit Group- Pick every unit in playable area with greater than or equal to 100 mana and do actions:
Loop - Actions
Remove Broken Morale (the buff) from picked unit
Remove Morale Broken (Damage) from picked unit
Remove Morale Broken (Armor) from picked unit
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
ack this must be gayness incarnate.
ok so first of all, i changed it to every 1 second, since it causes huge amounts of lag if i do every .25 seconds.
even still, theres this really short but noticeable delay time every second.
second, feedback is draining any damn mana.
third, for some reason, units start out with their morale broken.
 
Status
Not open for further replies.
Top