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

Spoil Ability help

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hi there!

I have a spell "Spoil". It is a buff than helps to gain additional money from duying unit.

But in my trigger it doesn't check that duyind unit has a specific buff... look:

  • Spoil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spoil
    • Actions
      • Set Spoil_Caster = (Triggering unit)
      • Set Spoil_Target = (Target unit of ability being cast)
      • Set Spoil_Caster_Level = (Level of Spoil_Caster)
      • Set Spoil_Target_Level = (Level of Spoil_Target)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spoil_Caster_Level - Spoil_Target_Level) Greater than -9
          • (Spoil_Caster_Level - Spoil_Target_Level) Less than 9
        • Then - Actions
          • Set Spoil_Real = 1.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (90 x (Integer(Spoil_Real)))
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set Spoil_Real = 0.10
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (90 x (Integer(Spoil_Real)))
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
      • Set Spoil_Caster = No unit
      • Set Spoil_Target = No unit
      • Set Spoil_Real = 0.00
      • Set Spoil_Caster_Level = 0
      • Set Spoil_Target_Level = 0
  • Spoiled Units List
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff Spoil ) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Darkhunter
              • (Unit-type of (Triggering unit)) Equal to Enforcer
              • (Unit-type of (Triggering unit)) Equal to Furbolg
              • (Unit-type of (Triggering unit)) Equal to Murloc
              • (Unit-type of (Triggering unit)) Equal to Razormane
              • (Unit-type of (Triggering unit)) Equal to Succubus
              • (Unit-type of (Triggering unit)) Equal to Tuskarr
              • (Unit-type of (Triggering unit)) Equal to Zombie
        • Then - Actions
          • Player - Add (Random integer number between 100 and 132) to (Owner of (Killing unit)) Current gold
          • Trigger - Turn off (This trigger)
        • Else - Actions
Any help please
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
^ I used to have the same problem :)). I suggest that u should add the unit which has spoil buff to an unit group and remove it from that unit group if it doesnt have that buff any more. When a unit dies, check if that unit is inside the unit group and then do something :D.
 
Level 10
Joined
Mar 17, 2012
Messages
582
^ I used to have the same problem :)). I suggest that u should add the unit which has spoil buff to an unit group and remove it from that unit group if it doesnt have that buff any more. When a unit dies, check if that unit is inside the unit group and then do something :D.

you got the point! thanks! It should work also for mass spoil!

Also, the caster isn't always the killing unit. So how do you track that?
In the first trigger, you have too many actions that can be minimized. Take those unneeded things out of the If/Then/Else.

what unneeded things are you talking about?
 
Level 10
Joined
Mar 17, 2012
Messages
582
In the If/Then/Else, in the Then and Else they have the same action. The only difference is the value you set before them. Take them out of the If/Then/Else and place them after it to be able to merge them, thus making your trigger more efficient.


wait a minute, I don't get it...
This skill works by that principle:
If level difference between caster and target is more than 9 levels then a chance of spoil success is 9% instead of 90%.

So first of all first of all system checks level difference
(Spoil_Caster_Level - Spoil_Target_Level) Greater than -9
(Spoil_Caster_Level - Spoil_Target_Level) Less than 9
if yes - chance is 90%
if not - system takes this 10 remaining % and gives 10% chance to success.

If spoil fails - there plays a special effect of red colored firework, and green color in case of success.

Now after all that tell me what part of my trigger is unneeded :)
 
The repetitive actions that you place in the Then/Else. Either way, condition false or not, it does the same. If you have special effect as a difference, still no.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Random integer number between 1 and 100) Less than or equal to (90 x (Integer(Spoil_Real)))
  • Then - Actions
  • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
  • Unit - Add Spoil dummy to (Last created unit)
  • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
  • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
  • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
  • Special Effect - Destroy (Last created special effect)
  • Trigger - Turn on Spoiled Units List <gen>
  • Else - Actions
  • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
  • Special Effect - Destroy (Last created special effect)
^That one. Put it out of the larger If/Then/Else.

EDIT: And if this doesn't seem obvious, remove the copy of this trigger above in the larger 'Else'.
 
Level 10
Joined
Mar 17, 2012
Messages
582
^That one. Put it out of the larger If/Then/Else.

EDIT: And if this doesn't seem obvious, remove the copy of this trigger above in the larger 'Else'.

But then if level difference will be greater than 9 - spoil will never work!
I need it to have 9% chance of success if level difference is more than 9 levels.

Here is a new trigger:

  • Spoil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spoil
    • Actions
      • Set Spoil_Caster = (Triggering unit)
      • Set Spoil_Target = (Target unit of ability being cast)
      • Set Spoil_Caster_Level = (Level of Spoil_Caster)
      • Set Spoil_Target_Level = (Level of Spoil_Target)
      • Set Player_Number_int = (Player number of (Owner of Spoil_Caster))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spoil_Caster_Level - Spoil_Target_Level) Greater than -9
          • (Spoil_Caster_Level - Spoil_Target_Level) Less than 9
        • Then - Actions
          • Set Spoil_Real = 1.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (90 x (Integer(Spoil_Real)))
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add Spoil_Target to Spoil_Group[Player_Number_int]
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set Spoil_Real = 0.10
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (90 x (Integer(Spoil_Real)))
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add Spoil_Target to Spoil_Group[Player_Number_int]
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
  • Spoiled Units List
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Spoil_Group[Player_Number_int]) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Darkhunter
              • (Unit-type of (Triggering unit)) Equal to Enforcer
              • (Unit-type of (Triggering unit)) Equal to Furbolg
              • (Unit-type of (Triggering unit)) Equal to Murloc
              • (Unit-type of (Triggering unit)) Equal to Razormane
              • (Unit-type of (Triggering unit)) Equal to Succubus
              • (Unit-type of (Triggering unit)) Equal to Tuskarr
              • (Unit-type of (Triggering unit)) Equal to Zombie
        • Then - Actions
          • Player - Add (Random integer number between 100 and 132) to (Owner of Spoil_Caster) Current gold
          • Trigger - Turn off (This trigger)
        • Else - Actions
But what will be if there will be 2 spoilers? :ogre_icwydt:
 
You should also watch out for converting reals under 1.0 to integers.
Example when you convert 0.10 to integer it returns 0. Now if you pick random number between 1 and 100 less than or equal to 90 x 0.10 then that will never fire.
Also if your spoil real is always specifically set to 0.10 and 1.00 just get rid of the variable as it only slows things down since it is only used once.

Anything used twice or more should also be stored into a temp variable. Example: triggering unit / last created unit.
 
Level 10
Joined
Mar 17, 2012
Messages
582
You should also watch out for converting reals under 1.0 to integers.
Example when you convert 0.10 to integer it returns 0. Now if you pick random number between 1 and 100 less than or equal to 90 x 0.10 then that will never fire.
Also if your spoil real is always specifically set to 0.10 and 1.00 just get rid of the variable as it only slows things down since it is only used once.

Anything used twice or more should also be stored into a temp variable. Example: triggering unit / last created unit.

I removed Spoil_Real at all :) thx)

You would leave the SpoilVars in their positions. Kindly go overrr Dimfs tutorial about ITEs.

I don't know why but I don't understand you...((
Why are you trying to force me to read dimf's tutorial every time? Every time I read it - I don't find what I need...

P.S. I'm from Ukraine, so sometimes I can not to understand your jargonisms)

Also, the caster isn't always the killing unit. So how do you track that?

But what will be if there will be 2 spoilers? :ogre_icwydt:

have any ideas?
 
Either indexing with a caster target relationship, IDK otherwise.
Ok another time: the If Then Else inside the 9/-9 (larger ITE) in 'Then' and 'Else' has the same actions. Put it out of the Then/Else and separate them from the larger one.

Why? Either way, only your real variable is changed and everything does the same action. Leave the real variable alone.
 
Level 10
Joined
Mar 17, 2012
Messages
582
Either indexing with a caster target relationship, IDK otherwise.
Ok another time: the If Then Else inside the 9/-9 (larger ITE) in 'Then' and 'Else' has the same actions. Put it out of the Then/Else and separate them from the larger one.

Why? Either way, only your real variable is changed and everything does the same action. Leave the real variable alone.

okay, I deleted my Real variable and now my triger looks fine (I think so):

  • Spoil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spoil
    • Actions
      • Set Spoil_Caster = (Triggering unit)
      • Set Spoil_Target = (Target unit of ability being cast)
      • Set Spoil_Caster_Level = (Level of Spoil_Caster)
      • Set Spoil_Target_Level = (Level of Spoil_Target)
      • Set Player_Number_int = (Player number of (Owner of Spoil_Caster))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spoil_Caster_Level - Spoil_Target_Level) Greater than -9
          • (Spoil_Caster_Level - Spoil_Target_Level) Less than 9
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to 90
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add Spoil_Target to Spoil_Group[Player_Number_int]
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to 10
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of Spoil_Caster) at (Position of Spoil_Target) facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Spoil dummy to (Last created unit)
              • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield Spoil_Target
              • Unit - Cause Spoil_Caster to damage Spoil_Target, dealing 1.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksgreen.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add Spoil_Target to Spoil_Group[Player_Number_int]
              • Trigger - Turn on Spoiled Units List <gen>
            • Else - Actions
              • Special Effect - Create a special effect attached to the overhead of Spoil_Target using Fireworksred.mdx
              • Special Effect - Destroy (Last created special effect)
Look: if difference between level of caster and target is less than 9 - then there are 90% chance for spoil to success.
if difference is more than 9 levels - then chance to success is 10% and 90% chance to fail.

Isn't it so? :ogre_icwydt:
 
Status
Not open for further replies.
Top