Spell Help:Copycat

trigger_newb

Active Member
Reaction score
3
hi forums long time no see, i recently got back into mapping again so u might see me here and there :)

On topic:
I'm trying to create this spell copycat: the most important things to know about this spell is that:
- it creates 2 locust units (copycats) that are always 175 distance away from the caster (1 to the left of it and 1 to the right of it)
- they are ALWAYS 175 distance away from the caster (1 to the left and 1 to the right)
- they are ALWAYS facing the same angle of the caster unit
- it copies every thing the caster is doing: the walking animation, casting spells, attacking
- the 2 locust units (copycats) are copies of the casting unit, with changed color tints

The codes:
Code:
Copycat
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Copycat 
    Actions
        Set Copycat_Caster = (Triggering unit)
        Set Copycat_Point = (Position of Copycat_Caster)
        Set Copycat_Left = (Copycat_Point offset by 100.00 towards ((Facing of Copycat_Caster) + 90.00) degrees)
        Set Copycat_Right = (Copycat_Point offset by 100.00 towards ((Facing of Copycat_Caster) + 270.00) degrees)
        Unit - Create 1 Copycat for (Owner of Copycat_Caster) at Copycat_Left facing (Facing of Copycat_Caster) degrees
        Set Copycat_West = (Last created unit)
        Hero - Set Copycat_West Hero-level to (Hero level of Copycat_Caster), Show level-up graphics
        Unit - Create 1 Copycat for (Owner of (Triggering unit)) at Copycat_Right facing (Facing of Copycat_Caster) degrees
        Set Copycat_East = (Last created unit)
        Hero - Set Copycat_East Hero-level to (Hero level of Copycat_Caster), Show level-up graphics
        Trigger - Turn on Copycats Move <gen>
        Trigger - Turn on Copycats Command Check <gen>
        Countdown Timer - Start Copycat_Timer as a One-shot timer that will expire in 30.00 seconds
This starts the spell, summons copycats, and turns on other triggers that help run the spell.
Code:
Copycats Move
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Set Copycat_Point = (Position of Copycat_Caster)
        Set Copycat_Left = (Copycat_Point offset by 100.00 towards ((Facing of Copycat_Caster) + 90.00) degrees)
        Set Copycat_Right = (Copycat_Point offset by 100.00 towards ((Facing of Copycat_Caster) + 270.00) degrees)
        Unit - Move Copycat_West instantly to Copycat_Left, facing (Facing of Copycat_Caster) degrees
        Unit - Move Copycat_East instantly to Copycat_Right, facing (Facing of Copycat_Caster) degrees
        Animation - Play Copycat_East's walk animation
        Animation - Play Copycat_West's walk animation
This is what keeps the copycats continuously the same distance away from and facing the same angle as the caster. I also have a feeling this trigger doesn't allow the copycats to attack.
Code:
Copycats Attack
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacking unit) Equal to Copycat_Caster
    Actions
        Unit - Order Copycat_East to Attack (Attacked unit)
        Unit - Order Copycat_West to Attack (Attacked unit)
orders copycats to attack same unit
Code:
Copycats Point
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Triggering unit) Equal to Copycat_Caster
    Actions
        Set Copycat_Point_Caster = (Target point of issued order)
        Set Copycat_Point_Left = (Copycat_Point_Caster offset by 100.00 towards 90.00 degrees)
        Set Copycat_Point_Right = (Copycat_Point_Caster offset by 100.00 towards 270.00 degrees)
        Unit - Order Copycat_West to Move To Copycat_Point_Left
        Unit - Order Copycat_East to Move To Copycat_Point_Right
Basically it's supposed to queue the walking animation, i'm not quite sure why i did this lol. You have to look at this and the next code
Code:
Copycats Command Check
    Events
        Time - Every 1.00 seconds of game time
    Conditions
        (Distance between Copycat_Point and Copycat_Point_Caster) Equal to 0.00
    Actions
        Unit - Order Copycat_East to Stop
        Unit - Order Copycat_West to Stop
Basically, when the caster unit reaches his point of issued order, the copycats are to stop, endnig their walking animation
Code:
Copycat End
    Events
        Time - Copycat_Timer expires
    Conditions
    Actions
        Unit - Remove Copycat_East from the game
        Unit - Remove Copycat_West from the game
        Trigger - Turn off Copycats Move <gen>
        Trigger - Turn off Copycats Command Check <gen>
After 30 seconds, copycat spell ends.

What I have right:
- the copycats are always moving with the caster (this is actually it)

Problem:
- I can't get the units to attack period
- I am not sure how to correctly detect commands (casting spells, moving, and attacking) and relay them to the copycats

Like i mentioned after the second set of codes, I think the problem is that the action unit: move unit instantly breaks unit commands and movement. But even if that is case, I have no idea how to make this spell work.
I know that I have lots of leaks, but please dont mind them yet, I just want to focus getting the skill right first, then ill clean it up later

What I need help with:
- the problems
- ideas on how I can better create this spell in GUI (last resort JASS) as I can understand it, but it takes me a long ass time to do it correctly.

Thanks in advance.

P.S. - I just attached a map, yes it has emijlr3's attribute system v4 - i attached it for fun :) And i'm sorry the map is superbig, I wanna fit lots and lotsa stuff in it lol.
 

Attachments

  • Songy RPG.w3x
    100.6 KB · Views: 266

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
For instant unit moving without disruption, try adding these lines into the Map Header.
JASS:

function MoveUnit takes unit WhichUnit, location WhichPoint returns nothing
    call SetUnitX (WhichUnit,GetLocationX(WhichPoint))
    call SetUnitY (WhichUnit,GetLocationY(WhichPoint))
endfunction

Then whenever you want to move a unit, use something like this:
Trigger:
  • Custom Script: call MoveUnit (GetTriggerUnit(),udg_Point)

wherein Point is the point you want to move the unit to.

Problem 2: Store any orders given to the main unit, including their targets, into a hashtable. Load those values and give the relevant orders to the copycat units, making sure move/attack-move etc. actions target an offset of the initial targeted point.
I realised there's pretty much no need for the MoveUnit function in this case.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i believe to move a unit instantly without disruption in gui you can just pause the unit before the move then unpause it after
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I thought Pausing = Disrupting. E.g. Channeling stops when paused, right? Right? I really don't know XD
 

Grags_1977

Ultra Cool Member
Reaction score
32
Copied from Trigger Editor

A paused unit stops and performs no orders, but remembers it's orders and continues them upon being unpaused

Though I think you're probably right on the channeling.
 

trigger_newb

Active Member
Reaction score
3
For instant unit moving without disruption, try adding these lines into the Map Header.
JASS:
function MoveUnit takes unit WhichUnit, location WhichPoint returns nothing
    call SetUnitX (WhichUnit,GetLocationX(WhichPoint))
    call SetUnitY (WhichUnit,GetLocationY(WhichPoint))
endfunction

Then whenever you want to move a unit, use something like this:
Trigger:
  • Custom Script: call MoveUnit (GetTriggerUnit(),udg_Point)

wherein Point is the point you want to move the unit to.

Problem 2: Store any orders given to the main unit, including their targets, into a hashtable. Load those values and give the relevant orders to the copycat units, making sure move/attack-move etc. actions target an offset of the initial targeted point.
I realised there's pretty much no need for the MoveUnit function in this case.

i think ur jass thing will work but can u teach me how to use the x and y coordinates in the w.e?
im gonna go find a tut on hash tables

EDIT: i think u guys should try out the map, the movement works right but the animations are just cancelled and i wnat to keep the movement effects

EDIT 2: OH I get the JASS script, it doesn't require for me to do anything except input the variable lol. That's genius good stuff - and I just read a tut on hash tables and I think ill try something with it. Ill repost it when I'm done
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Unless you only have 1 unit, yes, yes they are. They make MUI a lot easier to handle.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top