Center of Map Issue

Pigger

New Member
Reaction score
13
These triggers, which are extremely simple and easy to follow, have nothing to do with the center of the map. Yet when they run, the lightning effect is first created at the center of the map and then placed where it is supposed to go.

Code:
Lightning
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grapple 
    Actions
        Lightning - Create a Drain lightning effect from source (Position of Caster1) to target (Position of Caster1)
        Wait until (((Playable map area) contains GrappleHook) Equal to True), checking every 0.10 seconds
        Trigger - Turn on MoveIt <gen>
Code:
MoveIt
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set CasterPos2 = (Position of Caster1)
        Set GrappleHookLoc = (Position of GrappleHook)
        Lightning - Move (Last created lightning effect) to source CasterPos2 and target GrappleHookLoc

Variable:
Caster1 - Casting unit of the spell, variable is set to that in a different trigger (no need to post it)
GrappleHook - A dummy unit created in another trigger, created at the position of Caster1 (Has nothing to do with this [I think])
CasterPos2 & GrappleHookLoc - Stated in the second trigger.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
You could try setting a point variable to the position of Caster1, then creating the lightning at the variable.
 

Azylaminaz

Vox Populi
Reaction score
91
The only reason it is being created at the middle is because it doesm't have a defined location, meaning the variable hasn't been set yet.

Can you please post the trigger the defines the variable?
 

Pigger

New Member
Reaction score
13
You could try setting a point variable to the position of Caster1, then creating the lightning at the variable.

Just tried it and it still creates the lightning at the center of the map, linked to the position of caster1.
 

Pigger

New Member
Reaction score
13
The only reason it is being created at the middle is because it doesm't have a defined location, meaning the variable hasn't been set yet.

Can you please post the trigger the defines the variable?

Code:
Grapple Init
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grapple 
    Actions
        Set PointVarCaster1 = (Position of Caster1)
        Set GrappleSnagged = False
        Set Caster1 = (Casting unit)
        Set CasterPosition = (Position of Caster1)
        Set TargetPoint = (Target point of ability being cast)
        Set Distance = (Distance between CasterPosition and TargetPoint)
        Set Angle = (Angle from CasterPosition to TargetPoint)
        Set N = 0.00
        Selection - Clear selection for (Owner of Caster1)
        Wait 0.01 seconds
        Selection - Select Caster1 for (Owner of Caster1)
        Unit - Pause Caster1
        Animation - Play Caster1's attack animation
        Unit - Turn collision for Caster1 Off
        Trigger - Turn on GrappleHook <gen>

It sets multiple other variables for a few other triggers, but the ones needed for the first two are there.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Code:
Set PointVarCaster1 = (Position of Caster1)
Set GrappleSnagged = False
Set Caster1 = (Casting unit)

This could cause a problem. You set the point variable, then change the unit itself. That might clear the point, causing it to revert to the center of the map.
 

Azylaminaz

Vox Populi
Reaction score
91
The variable is defined after the effect is created, you could either define it first, or add a .03 wait or so before creating the lightning effect.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> The variable is defined after the position is defined.

That's true. Since the two triggers fire at the same time, the one can't use the references of the other.
 

Pigger

New Member
Reaction score
13
The variable is defined after the effect is created, you could either define it first, or add a .03 wait or so before creating the lightning effect.

I put a .03 wait before the creation, and for the first time casting the spell the lightning wasn't created from center to caster, but every time after that it would end up doing the same thing AND leaving the lightning effect there.

This could cause a problem. You set the point variable, then change the unit itself. That might clear the point, causing it to revert to the center of the map.

Switched them around, thanks.

EDIT: Ok, I've managed to make it so that lightning doesn't spawn from center of map to caster when the spell is being cast, but now there is still a problem. After casting the spell and all is fine and dandy, once the triggers are all done, a lightning effect (same one) is then created from the center of the map and connects to the caster, always following him around. I am somewhat assuming that the lightning then gets created at the center because the GrappleHook and GrappleHookLoc are removed, and therefor it just reverts to the center of the map, how to fix that I have no clue :S
 
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