• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] Chance Spell

Status
Not open for further replies.
Level 8
Joined
Jul 10, 2018
Messages
383
Hi i'm looking to know how to make a spell that has a chance to Damage near people with effects like the one in Custom Hero Survival/Custom Hero Defense
not good in Doing spells so if you provide a Code I will appreciate that! :)

And an Item chance spell.
 
Hi i'm looking to know how to make a spell that has a chance to Damage near people with effects like the one in Custom Hero Survival/Custom Hero Defense
not good in Doing spells so if you provide a Code I will appreciate that! :)


Generally, to affect units in an area, you have to use this action:
  • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
    • Loop - Actions
However, unit groups and locations leak, so you need to do something like this:

  • Actions
    • Set temp_point = (Target point of ability being cast)
    • Set temp_group = (Units within 512.00 of temp_point)
    • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_temp_group)
    • Custom script: call RemoveLocation(udg_temp_point)
To make something have a chance of happening, you just have to put it inside of a condition like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
    • Then - Actions
    • Else - Actions
In the above example, whatever is in the "Then" block has a 35% chance of happening. Anything in the "Else" block has a 75% chance of happening.

The full trigger would look something like this:
  • Untitled Trigger 007
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My AoE
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set temp_point = (Target point of ability being cast)
          • Set temp_group = (Units within 512.00 of temp_point)
          • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call DestroyGroup(udg_temp_group)
        • Else - Actions
And an Item chance spell.
What do you mean by this?
 
Level 8
Joined
Jul 10, 2018
Messages
383
Generally, to affect units in an area, you have to use this action:
  • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
    • Loop - Actions
However, unit groups and locations leak, so you need to do something like this:

  • Actions
    • Set temp_point = (Target point of ability being cast)
    • Set temp_group = (Units within 512.00 of temp_point)
    • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_temp_group)
    • Custom script: call RemoveLocation(udg_temp_point)
To make something have a chance of happening, you just have to put it inside of a condition like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
    • Then - Actions
    • Else - Actions
In the above example, whatever is in the "Then" block has a 35% chance of happening. Anything in the "Else" block has a 75% chance of happening.

The full trigger would look something like this:
  • Untitled Trigger 007
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My AoE
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set temp_point = (Target point of ability being cast)
          • Set temp_group = (Units within 512.00 of temp_point)
          • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call DestroyGroup(udg_temp_group)
        • Else - Actions

What do you mean by this?
Just like the ability chance spell I want it on item too.
 
Level 8
Joined
Jul 10, 2018
Messages
383
Generally, to affect units in an area, you have to use this action:
  • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
    • Loop - Actions
However, unit groups and locations leak, so you need to do something like this:

  • Actions
    • Set temp_point = (Target point of ability being cast)
    • Set temp_group = (Units within 512.00 of temp_point)
    • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_temp_group)
    • Custom script: call RemoveLocation(udg_temp_point)
To make something have a chance of happening, you just have to put it inside of a condition like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
    • Then - Actions
    • Else - Actions
In the above example, whatever is in the "Then" block has a 35% chance of happening. Anything in the "Else" block has a 75% chance of happening.

The full trigger would look something like this:
  • Untitled Trigger 007
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My AoE
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set temp_point = (Target point of ability being cast)
          • Set temp_group = (Units within 512.00 of temp_point)
          • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call DestroyGroup(udg_temp_group)
        • Else - Actions

What do you mean by this?
Just a question why didin't yo use the Variables you created?
 
Level 8
Joined
Jul 10, 2018
Messages
383
Generally, to affect units in an area, you have to use this action:
  • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
    • Loop - Actions
However, unit groups and locations leak, so you need to do something like this:

  • Actions
    • Set temp_point = (Target point of ability being cast)
    • Set temp_group = (Units within 512.00 of temp_point)
    • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_temp_group)
    • Custom script: call RemoveLocation(udg_temp_point)
To make something have a chance of happening, you just have to put it inside of a condition like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
    • Then - Actions
    • Else - Actions
In the above example, whatever is in the "Then" block has a 35% chance of happening. Anything in the "Else" block has a 75% chance of happening.

The full trigger would look something like this:
  • Untitled Trigger 007
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My AoE
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set temp_point = (Target point of ability being cast)
          • Set temp_group = (Units within 512.00 of temp_point)
          • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call DestroyGroup(udg_temp_group)
        • Else - Actions

What do you mean by this?
The spell doesn't work can you make me a one?
 
Level 8
Joined
Jul 10, 2018
Messages
383
Generally, to affect units in an area, you have to use this action:
  • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
    • Loop - Actions
However, unit groups and locations leak, so you need to do something like this:

  • Actions
    • Set temp_point = (Target point of ability being cast)
    • Set temp_group = (Units within 512.00 of temp_point)
    • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_temp_group)
    • Custom script: call RemoveLocation(udg_temp_point)
To make something have a chance of happening, you just have to put it inside of a condition like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
    • Then - Actions
    • Else - Actions
In the above example, whatever is in the "Then" block has a 35% chance of happening. Anything in the "Else" block has a 75% chance of happening.

The full trigger would look something like this:
  • Untitled Trigger 007
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My AoE
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set temp_point = (Target point of ability being cast)
          • Set temp_group = (Units within 512.00 of temp_point)
          • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call DestroyGroup(udg_temp_group)
        • Else - Actions

What do you mean by this?
Heres the code of my Spell
  • Chance spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Critical Strike
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Target unit of ability being cast))) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
        • Else - Actions
 
Heres the code of my Spell
  • Chance spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Critical Strike
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Target unit of ability being cast))) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
        • Else - Actions

Critical strike can't be used with a spell event. You will need to trigger the Critical Strike ability, which is a much more complicated endeavour =/

You need a Damage Engine for this sort of stuff. Damage Engine 3.8.0.0
 
Status
Not open for further replies.
Top