• 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.

[Solved] Faint

Status
Not open for further replies.
Level 1
Joined
May 1, 2011
Messages
4
First of all I would like to say ‘hello’ to you as a new user of this forum. Also I want to apologize for my bad English language(I hope you’ll understand what needs to be understood). In fact I’m not total new on this forums anyway, I use it very often but this is my first post here.

In order to avoid any more useless text I’m going more or less to the case: So, I’m an fan of the game mode called ‘Role Playing’. Some people might consider it as stupidity but tastes should not be discussed. Consequently with this passion I decided with friend to create a map that would be adapted to the each of our needs. Since I am a layman when it comes to programming I need help from someone. Most scripts that I wanted to write I did wrote (more or less well) but there is one that remained and for me it have a very high value.

My friend put the idea to create a faint system. The idea is that when the life of the unit drops to + / - 20% the fainting unit starts a death animation and unit side is changed to Neutral. The unit is intended to lie in that state until as long as its life will be equal to or greater than 50%. The script itself is fairly easy to write, but making it to work on more units (MUI) is black magic for me. If someone could help with this – give some tips and even rewrite the script - I would be very grateful. In fact, I did readed many guides buts still I’m too unexperienced to do it well. I tried many ways but they are kind of pathetic. I’ll paste here a script that works only for one unit.

Here are two triggers:

FIRST ONE:
  • Faint System
    • Events
      • Unit - A unit is attacked
    • Conditions
    • Actions
      • Set TempUnit = (Attacked unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (TempUnit is a Building) equal to NO
            • (Percentage life of TempUnit) less than or equal to 25.00
            • Fainted is equal to NO
          • Then - Actions
            • Animation - Play TempUnit's death animation
            • Unit- Change ownership of TempUnit to Neutral and Keep the color
            • Set Fainted = YES
          • Else - Actions
            • Do nothing

SECOND ONE:
  • Faint-Out
    • Events
      • Unit - A unit Starts to cast an abillity
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is a Building) equal to NO
          • (Ability being cast) equal to Healing
          • Fainted equal to YES
          • (Percentage life of (Target unit of ability being cast)) greater than or equal 50.00
        • Then - Actions
          • Animation - Play (Target unit of ability being cast) stand animation
          • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and keep the color
          • Set Fainted = NO
        • Else - Actions
          • Do nothing
My World Editor is in other language than English so I have been forced to translate it. I guess more or less it’s understandable. If not – just write.

It isn’t hard to guess why this isn’t working. Of course it’s because of ‘Fainted’ variable. It does change globally not MUI. I don’t know how to change that and I will appreciate any help that someone will give me. Someone of you probably would tell "hell, just delete that darn variable and this will work well". Well, let's say. But if I'll do that the death animation will repeat at any damage I will cause to unit.

I look forward for your responses and please – don’t be too hard on newbie :>.

PS: If there's something wrong with title of this thread or something else just tell and I'll change it.
PS2: I did searched for any threads like that but I didn't found them. If there is already one(I still don't think so) just be so kind and give me link to it. Maybe I just somehow missed it.

Regards, Voltare.
 
Level 1
Joined
May 1, 2011
Messages
4
I did readed about MUI but not about Hashtables. Good to know. At this time I can't test it out but soon I will. I'll have some troubles with it for sure, so don't close this thread if you can(I address this request to any Moderator). I will edit this post soon. Thanks for really fast response.
 
Level 7
Joined
Jul 1, 2008
Messages
1,024
hmm well im not at expert but you might be able to do it without having to use any variables? I havnted tested it yet but maybe this would work?

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Percentage Life of (Triggering unit)) Less than or equal to 25.00
      • (Owner of (Triggering unit)) Not equal to Neutral Passive
    • Actions
      • Unit - Change ownership of (Triggering unit) to Neutral Passive and Retain color
      • Animation - Play (Triggering unit)'s Death animation
Then:

  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
      • (Unit-type of (Target unit of ability being cast)) Equal to Footman
      • (Percentage life of (Target unit of ability being cast)) Greater than or equal to 50.00
      • (Owner of (Target unit of ability being cast)) Equal to Neutral Passive
    • Actions
      • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Retain color
      • Animation - Reset (Target unit of ability being cast)'s animation
Obviously replace footman and holylight with your own objects. This probably leaks but unless your maps huge it shouldnt lag. EDIT: Nice idea, abit the the priests ressurection ability, hope your map goes well. You also might want to make the unit that feints invulnerable otherwise it could be killed accidently by Area of Effects spells.
 
Level 1
Joined
May 1, 2011
Messages
4
So simple. You are an genious man, truly genious. I'm quite ashamed that I didn't thought about it but sometimes even not complicated things need more then one head.

Nice idea, abit the the priests ressurection ability, hope your map goes well. You also might want to make the unit that feints invulnerable otherwise it could be killed accidently by Area of Effects spells.

Well, thanks for your words. About that invulnerable trigger - yes, I thought about it. But in the end, think about that - isn't it more realistic to make just unit die if someone accidently kills it? I guess it is. Thats why I leave this thing without any invention.
Many many thanks for your response. Everything is workin' well. You are great!

@Maker - Your idea was more complicated but I think it wasn't bad at all. The only problem was and is that I don't have trigger called "Hashtable". It could be useful for future ideas but I can't use it. The problem is that I currently have installed 1.21b version of Warcraft 3 and in order to use Hashtables I need newer patch. You'll probably ask why? Well, I'm using extended editor called 'JASS NewGen' in order to edit maps. Mainly because it gives me ability to create as many trees(objects overall) as Warcraft 3 engine can handle. I didn't found yet any update for this great project, so I'm working on last patch that is able to use maps from JASS NewGen.

Well in fact - if anyone know any solution for it and know how to make work JASS NewGen with newest patches I would be very grateful for response.
 
Level 7
Joined
Jul 1, 2008
Messages
1,024
lol thx I always go for the simpler option cos im lazy :p Have you tried the triggers ingame yet? I did a quick test and for some reason I couldnt get the second one to work so assume you've had mor luck with it.

As for the invunerability, sometimes even after you've changed a units owner they continue to attack that unit so surely your feinted unit's just gunna die anyway meaning feints useless? You could set it so the unit becomes invulnerable for 1 second so it clears all current attacking units then set it vulnerable again.
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
Using JNGP doesn't mean you can't use hashtables. Update the game, and you can get hashtables - but it won't work normally in JNGP. You cannot use hashtables in GUI. So you need to use customscript.
 
Level 1
Joined
May 1, 2011
Messages
4
As for the invunerability, sometimes even after you've changed a units owner they continue to attack that unit so surely your feinted unit's just gunna die anyway meaning feints useless? You could set it so the unit becomes invulnerable for 1 second so it clears all current attacking units then set it vulnerable again.

You are right but for me it's working well because I have some things set. Main thing is that I made Player 9(I guess) as a neutral one in few ways. Without my changes your way would be really helpful. Anyway everything is working well. Thanks again for your help.

Using JNGP doesn't mean you can't use hashtables. Update the game, and you can get hashtables - but it won't work normally in JNGP. You cannot use hashtables in GUI. So you need to use customscript.

I guess I did forgot about customscript. You are right, of course but if I want to use it in GUI I need newer patch. The problem is that if I'll update the game, maps from JASS NewGen won't start. This editor just makes maps for older patch(1.21b in that case) and thats my problem. I think I don't really need the JASS Checker from this editor but mainly I care about limits extension. Thats why I want to make JASS NewGen work with some newer patches.

EDIT: I tried now updating the game and after this new 1.26a patch everything somehow is working well. I don't belive but it does. Thanks for your answers. Thread can/should be closed.
 
Last edited:
Status
Not open for further replies.
Top