1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to make units travel in diff. directions

Discussion in 'World Editor Help Zone' started by makeranj, Oct 18, 2016.

  1. makeranj

    makeranj

    Joined:
    Aug 29, 2016
    Messages:
    56
    Resources:
    0
    Resources:
    0
    Yeah, how?
    so what I meant was like this
    C=Caster
    I=Arrow

    how to make arrows go like this?, preferably if the arrows go a little closer(damaging enemies of course).


    \ I /
    \ I /
    \ I /
    \ I /
    C
     
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,717
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Make a dummy unit in the OE with the right model for the arrow. Give it the ability 'locust', which makes it untargetable and unselectable. When you want to make an arrow, create one of the dummy units for the right player facing the right direction. To move it (periodically in some sort of loop probably) use:
    • Set Temp_Point = <some point, however you get it>
    • Unit - Move <arrow unit> to Temp_Point
    • Custom script: call RemoveLocation(udg_Temp_Point) //write udg_ plus your variable name, capitalization matters, use _ for spaces

    The above clears the point leak that would naturally occur if you did something like "Center of (Playable map area)". For damaging you will have to use the "cause unit to damage unit" function on groups, and clearing their leaks is similar. We use DamagedGroup to keep track of which units have already taken damage from the spell and don't pick them again.
    • -------- When the spell is first cast --------
    • Unit Group - Clear DamagedGroup
    • -------- In the periodic move trigger --------
    • Set TempGroup = Units within R of TempPoint matching (Matching unit is not in group TempGroup) equal to true AND (matching unit is an enemy blah blah...)
    • Unit Group - Pick every unit in TempGroup and do (actions)
      • Loop - Actions
        • Unit - Cause <arrow unit> to damage (picked unit) for D damage of attack type Spells and damage type Normal
        • Unit - Add (picked unit) to DamagedGroup
    • Custom script: call DestroyGroup(udg_TempGroup)

    If you are not going to be saving the group to use later you can instead do:
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick all units within R of TempPoint matching (Matching unit is not in group TempGroup) equal to true AND (matching unit is an enemy blah blah...) and do Actions
      • Loop - Actions
    • -------- Nothing else to do, it cleans itself up automatically --------
     
  3. makeranj

    makeranj

    Joined:
    Aug 29, 2016
    Messages:
    56
    Resources:
    0
    Resources:
    0
    what should i set in temp_point? like position of caster to target point? or with polar offset?.
     
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,717
    Resources:
    1
    Spells:
    1
    Resources:
    1
    If you tried for even 15 seconds you would know what you have to do. But yes, polar offset since you know a starting point (the caster's position) and a target angle (either angle to the target point or just the facing angle of the caster).