• 🏆 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!

[General] Few Tricky things

Status
Not open for further replies.
Level 8
Joined
Sep 10, 2013
Messages
372
These are a few things I would like to know:

1- Is there a way for me to trigger a spell to target a random enemy in a group or a region, or a random enemy belonging to a certain player in a group or a region?

2- What passive skills would be better to use as background for trigger-based passive skills? Defensive and offensive?
(I used Pillage with 0 gold gain and 0 accumulation step and it caused the game to crash on the first attack by the unit that has that ability)

3a- How can I regulate a spell chance, or any chance, by triggers? Let's say that I want a 10% chance for an attack or a spell cast to heal the attacker or caster by a certain amount, or a random chance every few seconds that a dummy units casts a spell.

3b - If I want an item to do like 3a, I think I need to add the condition: Attacker/Caster equal to Hero Manipulating Item, is that right?

4- How can I make items that can be used to cast spells without charges? (Let's say an item that can cast divine shield with a cooldown of 120 seconds) I made the 'item ability' and all. I also double checked that the item has that ability
 
Level 12
Joined
May 22, 2015
Messages
1,051
1 - Yes. I believe there is a Random unit from (myUnitGroup) GUI function for that.

2 - I don't know what is best, but I have had success using the hero attribute bonus ability. Change it to non-hero ability, set levels to 1, change icon and tooltip. It is nice because it also has the option to hide the icon. Though, for hidden icons, an item ability will be less to load since it has less modified fields. Very minor most of the time, though.

3a - Do a "real comparison" in the conditions of a trigger or an If statement. One of the values you can put for a real is "Random real from x to y". For random % chance, do a random real from 0 to 100 and check if it is less than the % chance you want to use.

3b - It kind of depends. I am not exactly sure what you would want to check. If it is an effect when you attack when you carry a certain item, you should have a condition like "(Attacking unit) has item of type (super special attack item)".

4 - There is a field near the top of the "Stats" fields called "Actively Used". Set it to "True". If it has charges or disappears when you use it, there is a field further down called "Number of charges" and another called "Perishable". Number of charges is the number of charges (lol) and perishable indicates if the item should disappear when it runs out of charges.
 
Level 14
Joined
Nov 17, 2010
Messages
1,265
3a: Hero Manipulating Item refers to the hero that picks up or drops an item I believe. If you want a 10% chance for something to happen if the hero is carrying that item you have to use an if/then/else that does a boolean comparison that says Hero has item of type (your item) equal to true.
If this is true then you can use the real comparison to calculate the percentage chance like SAUS said
 
Level 8
Joined
Jan 28, 2016
Messages
486
What SAUS said is pretty much bang on point.

As for #2, I was going to suggest my personal favourite, Evasion, by setting the chance to zero. Other than those, there are a few abilities that don't have any data fields and essentially do nothing. The only two I can thing of at the moment are Flying Machine Bombs and Moon Glaives but there might be a few more.

For #3b, if it's an attack-based event that is meant trigger an item ability then what SAUS has is fine. If it's for a spell however you wouldn't need to check if the Hero has the item because how else would he cast the spell? Right? Also it should be the same procedure as a normal spell trigger.
  • Item Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Your Item Ability>
    • Actions
      • -------- Add your actions here --------
 
For #2, I always go with Moon Glaive or Storm Hammers. They do nothing on their own and serve only as a visual indicator that an upgrade is affecting the unit. I know you can level up Moon Glaive and it'll return the correct ability level if you reference it through triggers. Aura of Blight also does nothing afaik (AoB heals Undead units. 0.01 is 1% fyi). Additionally, if you want to attach special effects that respond to team colour, use an ability like Mana Regeneration (Fountain of Mana ability) or the armor bonus item abilities, but don't forget to set all data values to 0 and targets to none. (If the team colour doesn't appear to change initially, you can force it to switch to the correct colour via triggers.)

For #3, do an if statement that check if a real number is lower than or equal to 10 on a range of 0 to 100. If true, then the chance has 'procced'.
 
Last edited:
Level 8
Joined
Sep 10, 2013
Messages
372
Thank you all for replying to me. I love your suggestions and I'll put them to work :)
 
Status
Not open for further replies.
Top