HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Camera trigger not working

09-05-2010, 05:52 PM#1
nome
Well, I have a trigger that it's supposed to follow the player unit and rotate and everything..
It works only for the "choose hero" part of the map.. (which is the first part)
but when the chosen hero is created and placed where it belongs, right after being chosen, the camera get's locked or something. It just stay in the "hero selection" area of the map..
I'll paste the code here.. I hope someone can help me with this..

Trigger

Trigger:
Set Camera 1
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Collapse Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentCamera[(Player number of (Picked player))] Equal to 1
Collapse Then - Actions
Camera - Apply Camera 001 <gen> for (Picked player) over 0.00 seconds
Camera - Set (Picked player)'s camera Rotation to (Facing of PlayersHero[(Player number of (Picked player))]) over 0.00 seconds
Camera - Lock camera target for (Picked player) to PlayersHero[(Player number of (Picked player))], offset by (0.00, 0.00) using The unit's rotation
Else - Actions
Collapse Player Group - Pick every player in Player Group - Player 2 (Blue) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentCamera[(Player number of (Picked player))] Equal to 1
Collapse Then - Actions
Camera - Apply Camera 001 <gen> for (Picked player) over 0.00 seconds
Camera - Set (Picked player)'s camera Rotation to (Facing of PlayersHero[(Player number of (Picked player))]) over 0.00 seconds
Else - Actions
Collapse Player Group - Pick every player in Player Group - Player 3 (Teal) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentCamera[(Player number of (Picked player))] Equal to 1
Collapse Then - Actions
Camera - Apply Camera 001 <gen> for (Picked player) over 0.00 seconds
Camera - Set (Picked player)'s camera Rotation to (Facing of PlayersHero[(Player number of (Picked player))]) over 0.00 seconds
Else - Actions
Collapse Player Group - Pick every player in Player Group - Player 4 (Purple) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentCamera[(Player number of (Picked player))] Equal to 1
Collapse Then - Actions
Camera - Apply Camera 001 <gen> for (Picked player) over 0.00 seconds
Camera - Set (Picked player)'s camera Rotation to (Facing of PlayersHero[(Player number of (Picked player))]) over 0.00 seconds
Else - Actions

09-05-2010, 07:48 PM#2
Anitarf
Is it possible that the values of the CurrentCamera or PlayersHero arrays are set incorrectly? Otherwise, I do not see what could be wrong.

By the way, when doing the "pick every player in player group" action, don't do it for a player group that contains only one player, do it for a player group that contains all four players. That way, you don't need four copies of the code.
09-05-2010, 09:50 PM#3
nome
fixed, re-made everything
but thanks anyway!
09-07-2010, 05:59 AM#4
Bribe
>> By the way, when doing the "pick every player in player group" action, don't do it for a player group that contains only one player, do it for a player group that contains all four players. That way, you don't need four copies of the code.

Not only, but he is leaking four forces ("player groups") 100 times per second, ouch.

nome, can you post what your current code looks like? I want to make sure you are not still causing thousands of memory leaks per minute.
09-07-2010, 04:10 PM#5
nome
This one is runned first, when the hero is chosen, after it's created..
Trigger:
Assassin H
Set PlayersHero[(Player number of (Owner of (Last created unit)))] = (Last created unit)
Player Group - Add (Owner of (Triggering unit)) to CameraGroup
Trigger - Turn on Set Camera 1 <gen>
Camera - Lock camera target for (Owner of (Last created unit)) to PlayersHero[(Player number of (Owner of (Last created unit)))], offset by (0.00, 0.00) using The unit's rotation
Unit - Add classification of A peon-type unit to (Last created unit)
-------- - --------
If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Dialog - Show (Clicked dialog) for Player 1 (Red)) else do (Do nothing)
If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Dialog - Show (Clicked dialog) for Player 2 (Blue)) else do (Do nothing)

Trigger:
SetCamera 1
Collapse Events
Time - Every 0.03 seconds of game time
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of players in CameraGroup) Greater than 0
Collapse Then - Actions
Collapse Player Group - Pick every player in CameraGroup and do (Actions)
Collapse Loop - Actions
Camera - Set (Picked player)'s camera Rotation to (Facing of PlayersHero[(Player number of (Picked player))]) over 0.00 seconds
Camera - Lock camera target for (Picked player) to PlayersHero[(Player number of (Picked player))], offset by (0.00, 0.00) using The unit's rotation
Collapse Else - Actions
Trigger - Turn off (This trigger)