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

[Trigger] I can't get this to work?

Status
Not open for further replies.
Been working at this for a while now and i can't get it to work.. my unit rotates but the target doesn't rotate with it.. is there something wrong with my script?

  • Grapple
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grapple Swing
    • Actions
      • Set GrappleCaster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
      • Set GrappleTarget[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
      • Unit - Move GrappleTarget[(Player number of (Owner of (Target unit of ability being cast)))] instantly to ((Position of GrappleCaster[(Player number of (Owner of (Casting unit)))]) offset by 500.00 towards (Facing of GrappleCaster[(Player number of (Owner of (Casting unit)))]) degrees), facing (Position of GrappleCaster[(Player number of (Owner of (Casting unit)))])
      • Unit - Pause GrappleTarget[(Player number of (Owner of (Target unit of ability being cast)))]
      • Trigger - Turn on Spin <gen>
      • Wait 5.00 seconds
      • Trigger - Turn off Spin <gen>
      • Unit - Unpause GrappleTarget[(Player number of (Owner of (Target unit of ability being cast)))]
(Initially off)
  • Spin
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit - Move GrappleTarget[(Player number of (Owner of (Target unit of ability being cast)))] instantly to ((Position of GrappleCaster[(Player number of (Owner of (Casting unit)))]) offset by 500.00 towards ((Facing of GrappleCaster[(Player number of (Owner of (Casting unit)))]) + 18.00) degrees), facing ((Facing of GrappleCaster[(Player number of (Owner of (Casting unit)))]) - 180.00) degrees
      • Unit - Make GrappleCaster[(Player number of (Owner of (Casting unit)))] face ((Facing of GrappleCaster[(Player number of (Owner of (Casting unit)))]) + 18.00) over 0.25 seconds
 
Level 4
Joined
Jun 10, 2009
Messages
67
Idk and I dont have the time atm to fix this for you, but your spell leaks, you know that right? For example; you must pause the unit before you MOVE it, you must also set the point of where the units shall be moved as Variables, and then destroy them.

If I have the time later, I'll fix this for you :thumbs_up:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I would use 0.03 seconds (to make it go more smoothly), the +18° is good at 0.03 sec.
It doesn't work, because you have used "(Owner of (Target unit of ability being cast))".
Use for each integer A or something...
(if you use Integer A, make sure that you null all variables after the spell is done).

Another hint is to use a special effect trail and something that links both units.
And remove the leaks, this will cause a lot of lag!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Thing is bro, you can't use 0.03 seconds wait, minimum is like 0.27 i think

Wait is a random number between "(Your Number and Your number +0.10)" (yep, checked it with an easy system).
The "Every X second of game time", however, is not a wait and it is correct.
Therefore 0.03 is a major difference (since it is about 8x faster than his system).

Edit: ohh and a wait can never go below 0.20, then it is a random number between 0.20 and 0.30 ^^
(my numbers are approximates, it can occasionaly go over the +0.10 seconds, but that doesn't happen a lot).

Actually, 0.03 seconds (and numbers around that) are often used in spells, some examples are knockback, black hole, jump and others (everything that uses movements).
 
-sigh- apocolypse it seems you have no idea what i'm doing...

I'm using a variable to identify the units.. The part where it grabs the unit works just fine.. but making the unit spin isn't working.. and i only have the +18 there for a limited time i'm going to fix it later im just creating a rough sketch then chipping on it to make it work right
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
-sigh- apocolypse it seems you have no idea what i'm doing...

I'm using a variable to identify the units.. The part where it grabs the unit works just fine.. but making the unit spin isn't working.. and i only have the +18 there for a limited time i'm going to fix it later im just creating a rough sketch then chipping on it to make it work right

First of all:
It is "ap0calypse"

Second:
I know exactly what you are doing and you're doing it wrong, read my damn post!
I know what variables are and why you identify them, but it doesn't work, does it? (otherwise you wouldn't post this thread).

You have used "(Owner of (Unit))" in the Second trigger, which doesn't work there!

Instead of that, you should add a loop in the second trigger that goes from 1 to the number of players.
Then you should change all your "Owner of (Unit)'s" by "Integer A".
To make sure it doesn't screw up, null the variables at the end of the spell.

Ohh and use hidden-tags for the trigger, please.
 
Level 4
Joined
Mar 14, 2009
Messages
98
One question. Who's the "Casting Unit" in the second trigger? It doesn't seem to have a spell-related event to me.

Ap0calypse was telling you to do something like this:
  • Spin
  • Events
  • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Unit - Move GrappleTarget[(Integer A)] instantly to ((Position of GrappleCaster[(Integer A)]) offset by 500.00 towards ((Facing of GrappleCaster[(Integer A)]) + 18.00) degrees), facing ((Facing of GrappleCaster[(Integer A)]) - 180.00) degrees
        • Unit - Make GrappleCaster[(Integer A)] face (Facing of GrappleCaster[(Integer A)] + 18.00) over 0.03 seconds
0.03 seconds is much, much more smoother-looking than 0.25 seconds. :D

Oh, and for this to work, you're not supposed to turn off the second trigger until all units are done with the grappling thing. Also, once units are done grappling, you have to set the respective variables to null so that they won't continue spinning.

One last note, though you probably already know this, this is only multi-player instanceable. It won't work if a player owns more than one unit that can grapple.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
One question. Who's the "Casting Unit" in the second trigger? It doesn't seem to have a spell-related event to me.

Ap0calypse was telling you to do something like this:
  • Spin
  • Events
  • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Unit - Move GrappleTarget[(Integer A)] instantly to ((Position of GrappleCaster[(Integer A)]) offset by 500.00 towards ((Facing of GrappleCaster[(Integer A)]) + 18.00) degrees), facing ((Facing of GrappleCaster[(Integer A)]) - 180.00) degrees
        • Unit - Make GrappleCaster[(Integer A)] face (Facing of GrappleCaster[(Integer A)] + 18.00) over 0.03 seconds
0.03 seconds is much, much more smoother-looking than 0.25 seconds. :D

Oh, and for this to work, you're not supposed to turn off the second trigger until all units are done with the grappling thing. Also, once units are done grappling, you have to set the respective variables to null so that they won't continue spinning.

One last note, though you probably already know this, this is only multi-player instanceable. It won't work if a player owns more than one unit that can grapple.

Thank you, at least you understand what I'm trying to say ^^
I meant to say that there is indeed no ability-event in the second trigger and therefore casting unit does not work...
 
Status
Not open for further replies.
Top