Keeping a unit incredibly close

Pigger

New Member
Reaction score
13
Oi, me again. I'm working on a spell that needs a unit to stay incredibly close to a unit at all times, almost directly behind it (as in a shadow unit) that will copy every move the guy it is following does.

As in O = Hero
() = Shadow

......(O --> (Arrow meaning movement)

So that half of the shadow unit is "inside" of the hero it follows around.

I hope this is clear enough :S
 

Kenoriga

Ultra Cool Member
Reaction score
34
That seems hard to me... Tried having a the unit model attached to the unit? Maybe it works. (just a guess lol)
 

Psiblade94122

In need of sleep
Reaction score
138
you can try something like this
<NOT MUI, if you want it mui ask me and ill recode>
<this is a general idea, it shuld work, but its too late for me to test atm, why the hell am i still up @.@>
Variables
Host <unit variable> = the hero affected
Shadow <unit variable> = the shadow... thats being the shadow
L and L2 are both point variables
Code:
events
every .05 seconds
conditions
actions
set L = unit position of Host
set L2 = L at a offset of 25 <might be smaller or bigger depening on the size of your unit> at an angle of (unit faceing of host -180)
Unit - move Shadow instantly to L2 faceing (unit faceing of host)
call RemoveLocation (udg_L)
call RemoveLocation (udg_L2)
 

Pigger

New Member
Reaction score
13
Yeah Psi, that's what I was originally thinking, I made a trigger similar to that just to see what would happen. The problem with that is with the move instantly the unit will never play a walk animation or anything, it will just constantly be doing the same thing while the host/hero will be walking normally.

I appreciate the effort (and hope you finally got to sleep lol)

Oh, and .03 would be much better than .05 (I tested both) because .03 goes a lot smoother where as .05 seems a little clunky, just fyi for movin things a lot.

EDIT: Kenoriga, I'm not 100% sure of what you mean by attatching it to the model. If by making a dummy ability with an attachment of a model is what you mean, I have tried and it does not work for what I want. Thanks though :D
 

SaintMorose

New Member
Reaction score
26
Have you tried changing the follow range in Gameplay Constants and then Issuing Follow Orders?
 

Pigger

New Member
Reaction score
13
I was thinking of that, the only problem is, that would end up affecting gameplay for other people and units if they are ever ordered to follow.

I suppose it's the only solution I can think of.
 

Sefiraat

New Member
Reaction score
15
Uhm, i got no idea if this is what you want, but couldnt you make some triggers telling the dummy(shadow) unit to copy the main unit, but when it comes to moving offset the order by -25 opposing the main units facing degree? Im not sure what this will look like :)
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
E: Every Second
A: Order <Sahdow> to move to Hero's Location

That should do it with walking animation.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
Rheias, what you suggest would be like a "Pet". Which would be fun, but a totally different concept.

I think what Pigger wants is like a shadow-partner; a unit that imitates the Hero in every action he does; Something like a shadow of the hero, but is 3D and have an attack. So when the hero moves, the shadow moves, when the Hero attacks, the shadow does the same.

Given that he wants "half" of the shadow to be within the Hero, the only way I can think of is remodel the hero character, including the shadow; like having two sets of "bones" with identical movements, one behind the other. Maybe set with different "skins". Attacks can be done via dummys.
 

Pigger

New Member
Reaction score
13
Rheias, what you suggest would be like a "Pet". Which would be fun, but a totally different concept.

I think what Pigger wants is like a shadow-partner; a unit that imitates the Hero in every action he does; Something like a shadow of the hero, but is 3D and have an attack. So when the hero moves, the shadow moves, when the Hero attacks, the shadow does the same.

Given that he wants "half" of the shadow to be within the Hero, the only way I can think of is remodel the hero character, including the shadow; like having two sets of "bones" with identical movements, one behind the other. Maybe set with different "skins". Attacks can be done via dummys.

@Second Paragraph - Exactly!

So far the only two possibilities that may work are the changing gameplay constants of follow, which would adversly affect the rest of the map, or to edit the model, which I have no expirience in doing :S.

I shall stick to the problem but so far I would like to thank you guys for helping.
 

IceWarrior98

New Member
Reaction score
12
I tried to do this myself but the only problem I come to is that the "shadow" does not play animations. What I did was:

Two Variables Required:
Shadow : Point - The dummy's target position with offset. I made this with arrays for multiple shadows cause i'm cool that way.
Unit : Point - The Units position the shadow is copying
Code:
Shadow
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set SP = (Position of Knight 0045 <gen>)
        Set ST[1] = (SP offset by -25.00 towards (Facing of Knight 0045 <gen>) degrees)
        Set ST[2] = (ST[1] offset by -25.00 towards (Facing of Knight Shadow 0046 <gen>) degrees)
        Set ST[3] = (ST[2] offset by -25.00 towards (Facing of Knight Shadow 0047 <gen>) degrees)
        Set ST[4] = (ST[3] offset by -25.00 towards (Facing of Knight Shadow 0048 <gen>) degrees)
        Set ST[5] = (ST[4] offset by -25.00 towards (Facing of Knight Shadow 0049 <gen>) degrees)
        Unit - Move Knight Shadow 0046 <gen> instantly to ST[1], facing (Facing of Knight 0045 <gen>) degrees
        Unit - Move Knight Shadow 0047 <gen> instantly to ST[2], facing (Facing of Knight Shadow 0046 <gen>) degrees
        Unit - Move Knight Shadow 0048 <gen> instantly to ST[3], facing (Facing of Knight Shadow 0047 <gen>) degrees
        Unit - Move Knight Shadow 0049 <gen> instantly to ST[4], facing (Facing of Knight Shadow 0048 <gen>) degrees
        Unit - Move Knight Shadow 0050 <gen> instantly to ST[5], facing (Facing of Knight Shadow 0049 <gen>) degrees
        Custom script:   call RemoveLocation(udg_ST[1])
        Custom script:   call RemoveLocation(udg_ST[2])
        Custom script:   call RemoveLocation(udg_ST[3])
        Custom script:   call RemoveLocation(udg_ST[4])
        Custom script:   call RemoveLocation(udg_ST[5])
        Custom script:   call RemoveLocation(udg_SP)

Also this makes each shadow follow the one infront of it so they don't look like a stick or something.

I also did this to the dummys (pre-placed dummies for test)

Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Visibility - Disable fog of war
        Visibility - Disable black mask
        Unit - Turn collision for Knight Shadow 0046 <gen> Off
        Animation - Change Knight Shadow 0046 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 20.00% transparency
        Animation - Change Knight Shadow 0047 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 40.00% transparency
        Animation - Change Knight Shadow 0048 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 70.00% transparency
        Animation - Change Knight Shadow 0049 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
        Animation - Change Knight Shadow 0050 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 90.00% transparency

This just makes them sort of see-through and makes the first dummy be able to go inside the real unit. The other dummys don't seem to need it.

shadow5.jpg
shadow3.jpg

shadow2.jpg
 

SaintMorose

New Member
Reaction score
26
Heres an idea that would require a change in the shadow units collision size

Code:
Events
        Unit - A unit owned by <you> Is issued an order targeting a point
    Conditions
        (Issued order) Equal to (Order(move))
    Actions
        Set TempPoint = ((Target point of issued order) offset by -25.00 towards (Facing of (Ordered unit)) degrees)
        Unit - Order <shadowunit> to Move To TempPoint

see if that works?
 

0zaru

Learning vJASS ;)
Reaction score
60
Did you tryied playing the unit animation ? like Play Unit Animation - "move" (I think that that is the animation)
 

IceWarrior98

New Member
Reaction score
12
> Did you tryied playing the unit animation ?
Yes but to make it look good you'd have to make a seperate trigger that detect when the unit the shadow follows moves and i don't want to get into that right now. I just wanted to show what I came up with real quick for someone else to build on, or perhaps dismantle and redo.

EDIT: I just looked up and it looks like Saints got the idea. But you have to remember when it's being move instantly it pretty much cancles the move command because you only told the real unit to move once.

I suppose you can make it so if its out of the specified point to move back into it, but I don't know that can be done using variables or not. I don't have WE open.
 

NapaHero

Back from the dead...
Reaction score
43
Heres an idea that would require a change in the shadow units collision size

Code:
Events
        Unit - A unit owned by <you> Is issued an order targeting a point
    Conditions
        (Issued order) Equal to (Order(move))
    Actions
        Set TempPoint = ((Target point of issued order) offset by -25.00 towards (Facing of (Ordered unit)) degrees)
        Unit - Order <shadowunit> to Move To TempPoint

see if that works?

This will not work because:

You forgot to put in the conditions what is the type of the Ordered Unit, so if any unit that is owned by him moves, the trigger takes effect.

You need to change Ordered Unit by Triggering Unit, so that the trigger can work perfectly.

And remove the TempPoint or it will leak:

Custom script: call RemoveLocation (udg_TempPoint)
 
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