• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Quick Trigger Debug needed

Status
Not open for further replies.
Level 4
Joined
Aug 9, 2012
Messages
84
IF the below in GUI leaks or is really inefficient, can someone please convert it into vJASS so it's more fluid? It's 16-17 lines of code. I'm quite inexperienced in writing actual code, so that's why I ask(ed).

Anyway . . . How can I make this better?

  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Set Player_CamSpell[(Player number of (Triggering player))] = (Owner of (Target unit of ability being cast))
      • Set Unit_Cam[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[(Player number of (Triggering player))]
      • Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Triggering player))]) over 0.00 seconds[/hidden]
Do I have to change:

Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Triggering player))]) over 0.00 seconds

TO

Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Owner of (Target unit of ability being cast)))]) over 0.00 seconds

?

It's a cool Item Spell idea I made up to where when 'High Proof Alcohol' (my Item) is thrown at / used on an enemy player / unit, their camera goes out of whack due to being drunk from the fumes, and when it wears out, it sets that affected player's camera back the way it was.

The only thing I know is 99% of it works like it's supposed to, but when it comes to resetting the affected player's camera back the way it was, it doesn't.

IF someone can tell me exactly what's wrong and exactly what to change (granted it's OK in GUI,) that would be great.

Otherwise, I need it in vJASS.



Thank You in advance.
 
can u plz post the triggers.

edit: ok thanks

first thing is this isnt MUI. i dont think it can be since u use the camera thing. so MPI is the best to go.

this leaks.
  • (Position of Unit_Cam[(Player number of (Triggering player))])
put this at the top of ur trigger
  • Custom script: local integer udg_tempInt = GetPlayerId( GetOwningPlayer(GetTriggerUnit())) + 1
then make a temp integer called tempInt and change all of the
  • (Player number of (Triggering player))
to
  • tempInt
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Avoid parentheses as much as you can.

How?

Instead of using 10 times (Triggering Unit) set (Triggering Unit) to a Unit variable, and use that variable 10 times instead. You'll see how Parentheses dissapear making the code a lot cleaner and easier yo read, also shorter, faster, and smoother.
 
Avoid parentheses as much as you can.

How?

Instead of using 10 times (Triggering Unit) set (Triggering Unit) to a Unit variable, and use that variable 10 times instead. You'll see how Parentheses dissapear making the code a lot cleaner and easier yo read, also shorter, faster, and smoother.

Thats y i told him to store it into variables lol. thanks for explaining y to do that haha
 
Level 4
Joined
Aug 9, 2012
Messages
84
Thank You very much. I will see what this does. But as I pointed out in my most recent edit:

When you say change:

(Player number of (Triggering player))

Does that refer to near the ending of this?

Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Triggering player))]) over 0.00 seconds

Or could this work too?

Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Owner of (Target unit of ability being cast)))]) over 0.00 seconds

Thank You
 
im saying get rid of it. i said replace it with tempInt in those and place the custom local script i showed u at the top of ur trigger.

also the problem with y it doesnt reset correctly is this.

  • Set Player_CamSpell[(Player number of (Triggering player))] = (Owner of (Target unit of ability being cast))
    • Set Unit_Cam[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast
which player do u want the camera to move around for ? the caster or the target ?
 
Level 4
Joined
Aug 9, 2012
Messages
84
Having sent a PM and you saying to stay in thread here (because I'm still getting used to the thread rules) I still don't get it.

And I want the target being affected, not the caster casting the spell.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Your trigger

  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Set Player_CamSpell[(Player number of (Triggering player))] = (Owner of (Target unit of ability being cast))
      • Set Unit_Cam[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[(Player number of (Triggering player))] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[(Player number of (Triggering player))] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[(Player number of (Triggering player))]
      • Camera - Pan camera for Player_CamSpell[(Player number of (Triggering player))] to (Position of Unit_Cam[(Player number of (Triggering player))]) over 0.00 seconds[/hidden]

Suggested Trigger:

  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Set PLAYER = (Triggering Player)
      • Set INTEGER = Player Number of PLAYER
      • Set UNIT = Target Unit of Ability Being Cast
      • Set PLAYER2 = Owner ofer UNIT
      • Set INTEGER2 = Player Number of PLAYER2
      • Set Unit_Cam[INTEGER2] = (Target unit of ability being cast)
      • Set Player_CamSpell[INTEGER] = PLAYER2
      • Camera - Sway the camera target for Player_CamSpell[INTEGER] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[INTEGER] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[INTEGER] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[INTEGER] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[INTEGER] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[INTEGER] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[INTEGER] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[INTEGER] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[INTEGER]
      • Camera - Pan camera for Player_CamSpell[INTEGER] to (Position of Unit_Cam[INTEGER]) over 0.00 seconds[/hidden]
See the difference?

Note: Triggering Player stands for Owner of Triggering Unit in Generic Unit Events
 
only problem is that isnt MPI. so if another unit casts the spell it wont work
Also u dont clean the point leak

this is MPI and cleans the leak
  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Custom script: local integer udg_tempInt = GetPlayerId( GetOwningPlayer( GetSpellTargetUnit())) + 1
      • Custom script: local location udg_tempPoint
      • Set tempPoint = (Position of Unit_Cam[tempInt])
      • Set Player_CamSpell[tempInt] = (Owner of (Target unit of ability being cast))
      • Set Unit_Cam[tempInt] = (Target unit of ability being cast)
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[tempInt]
      • Camera - Pan camera for Player_CamSpell[tempInt] to tempPoint over 0.00 seconds
      • Custom script: call RemoveLocation( udg_tempPoint)
      • Custom script: set udg_tempPoint = null
 
Level 4
Joined
Aug 9, 2012
Messages
84
You forgot to show the TempInt Variable, which I still don't know what that's supposed to relate to, be it a player number of (something) or an actual integer of some sort.
 
i do show the tempInt variable look at the first custom script. if u want u can do it like this also.
  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Custom script: local integer udg_tempInt
      • Custom script: local location udg_tempPoint
      • Set tempInt = (Player number of (Owner of (Target unit of ability being cast)))
      • Set tempPoint = (Position of Unit_Cam[tempInt])
      • Set Player_CamSpell[tempInt] = (Owner of (Target unit of ability being cast))
      • Set Unit_Cam[tempInt] = (Target unit of ability being cast)
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[tempInt]
      • Camera - Pan camera for Player_CamSpell[tempInt] to tempPoint over 0.00 seconds
      • Custom script: call RemoveLocation( udg_tempPoint)
      • Custom script: set udg_tempPoint = null
it still does the exact same as the one i posted above.
tempInt is an integer
tempPoint is a point
 
Level 4
Joined
Aug 9, 2012
Messages
84
No, you show tempInt being used but not set . . . That's why I asked what it was supposed to be set to. Looks like this is 'it.'

Question is, which one works better? Looks like there's less for the game to read in your second version.
 
Level 4
Joined
Aug 9, 2012
Messages
84
UPDATE: That's because you never used it in posting how the trigger should look, the right way when it's done. Look back at your most recent example you gave me, not the first one . . . I'm just now noticing that too it was never used, by neither of us. I just duplicated what you did so it would be right. So since it's not being used, where does it go exactly?

------------

Why not use that? Because I didn't shorten it to 'Int'? I mean, is there really a problem between Int and spelling it out as Integer? I'm only copying what you did, but not in the sense I short-handed it like you did. If it doesn't affect the code then it doesn't need to be changed. It's just a variable's name.

Let me know . . .
 
Last edited:
Level 4
Joined
Aug 9, 2012
Messages
84
Oh, alright, well, it's little stuff like that which confuses me, heh. I'll make it TempInt then.

And remove this line too, right?

Set TempPoint = (Position of Unit_Cam[TempInteger])

Just making sure since it's technically not in use.
 
Level 4
Joined
Aug 9, 2012
Messages
84
Keep these two?

Custom script: local integer udg_TempInteger

Custom script: local location udg_TempPoint

?

Or just the second one . . . Why were they set in there in the first place? You just forgot to clean up in your last example?

Thank You.
 
like i said lol i just copied what u had and edited it i didnt remove the useless stuff.

  • High Proof Alcohol
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to High Proof Alcohol
    • Actions
      • Custom script: local integer udg_tempInt
      • Set tempInt = (Player number of (Owner of (Target unit of ability being cast)))
      • Set Player_CamSpell[tempInt] = (Owner of (Target unit of ability being cast))
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 320.00 and velocity 7.00
      • Wait 10.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 250.00 and velocity 4.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 300.00 and velocity 6.00
      • Wait 4.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 220.00 and velocity 3.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 280.00 and velocity 3.00
      • Wait 3.00 game-time seconds
      • Camera - Sway the camera target for Player_CamSpell[tempInt] with magnitude 180.00 and velocity 1.00
      • Camera - Sway the camera source for Player_CamSpell[tempInt] with magnitude 200.00 and velocity 1.00
      • Wait 3.00 game-time seconds
      • Camera - Stop swaying/shaking the camera for Player_CamSpell[tempInt]
      • Camera - Pan camera for Player_CamSpell[tempInt] to tempPoint over 0.00 seconds
 
Status
Not open for further replies.
Top