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

[Solved] Cast flamestrike excluding caster from the range

Status
Not open for further replies.
Level 1
Joined
Jul 23, 2018
Messages
2
Tried to look for something similar but no luck. I'm doing a basic IA which do certain spells at certain moments.

Usually, for 'Unit is issued order targeting a point' actions, i take the position (point variable) of the enemy and order the unit cast targeting that position (works fine).

The problem comes with the point variable. When i order the unit cast the spell, obviously takes the point as the center of the AOE. That's a problem when the enemy is closer to the caster and the spell can damage the caster too.

What i need is move the position of the point variable to avoid damage the caster when the enemy is close. I know i should do something with offsets, but i have no idea what

I attached a image 'explaining' what i want

This is an example of what i have...

  • Cast FlameStrike Example
    • Acontecimientos
    • Condiciones
    • Acciones
      • -------- Vanilla World Edit In Spanish --------
      • -------- ------------------------------------------- --------
      • -------- In my map, i set two unit variables. Each one represent the selected hero (It's a 1v1 map). I use them for many things --------
      • -------- (I'm just picking two specific unit for this example) --------
      • -------- ------------------------------------------- --------
      • Set Caster = Mago sanguinario 0000 <gen>
      • Set Enemy = Rey de la Montaña 0001 <gen>
      • -------- ------------------------------------------- --------
      • -------- Setting points --------
      • -------- ------------------------------------------- --------
      • Set Caster_Point = (Position of Caster)
      • Set Target_Point = (Position of Enemy)
      • -------- ------------------------------------------- --------
      • -------- (200 is the default range for flamestrike) --------
      • -------- (Mayor que would be 'Greater than') --------
      • -------- (To keep the example simple, let's assume that the ability is always ready to use) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si: Condiciones
          • (Distance between Caster_Point and Target_Point) Mayor que 200.00
        • Entonces: Acciones
          • -------- Cast Llamarada (Flamestrike) with no problem --------
          • Unidad - Order Caster to Humano mago sanguinario - Llamarada Target_Point
        • Otros: Acciones
          • -------- Here is where i don't know what to do. I'm sure i'm have to do something with offsets. But no idea what calculate --------
      • -------- Removing Point Leaks --------
      • Custom script: call RemoveLocation (udg_Caster_Point)
      • Custom script: call RemoveLocation (udg_Target_Point)
Any idea? Thanks for reading.
 

Attachments

  • draw.png
    draw.png
    11.4 KB · Views: 33
Level 39
Joined
Feb 27, 2007
Messages
5,014
You'll replace your distance comparing if block to this one. Just changed the condition and moved a couple of your other lines around

Code:
If (distance between Caster_Point and Target_Point) less than FS_AOE_RADIUS //200.00?

Then do:
Set TempPoint = Caster_Point offset by FS_AOE_RADIUS towards (angle between Caster_Point) and (Target_Point)) degrees
call RemoveLocation(udg_Target_Point) //this happens inside the if block now)
Set TargetPoint = TempPoint
endif

//Cast spell on TempPoint
Instead you could ahve your AI units back up to a safe location before casting flamestrike. Might look cool might be a lot of units constantly moving. You might also want to add another minimum radius inside of which the AI thinks it's okay to hit itself if nothing else would work.
 
Level 13
Joined
Oct 12, 2016
Messages
769
On a related note, have you tried setting Flame Strike to "Not Self" in the object editor? Would that help?
I mean, if you don't want the caster to damage itself.
You can even set it to damage "Enemies" only.
 
Status
Not open for further replies.
Top