Camera look (with arrow keys)

Argentine

New Member
Reaction score
2
Hello, I am Argentine. I am the author of a single player WC3 3rd person RPG and I am looking for someone who may be able to help me on the project.

One thing I would really like to get implemented as soon as possible is getting the arrow keys to control the player's camera by looking up into the air, left right and down. (All without being able to look too far up or down, or to the left or right) I am very unsure about camera angle triggers (and more unsure about the actual angles themselves)

If possible I also need a trigger to reset the camera to the default (forward) when the character begins moving or enters combat. (takes damage)

Any insight on how to do this would be appreciated. I will be messing around with it for now, and I will edit this post If I find anything out.
 

Conal

Member
Reaction score
12
I think you're looking for first person as apposed to third.

Anyways, the camera angles are your least worries. As far as I know, there's no way to see if a key is held down and would be hard to move the camera over time. One solution could be set viewports and the left/right/up arrows cycle through them depending on their facing angle.

Most first person maps out there simply lock a camera to a unit. Although I have seen a first person shooter that required spamming of spells to change the angle...but it wasn't very intuitive.
 

sLsIDK

New Member
Reaction score
13
I think you're looking for first person as apposed to third.

Anyways, the camera angles are your least worries. As far as I know, there's no way to see if a key is held down and would be hard to move the camera over time. One solution could be set viewports and the left/right/up arrows cycle through them depending on their facing angle.

Most first person maps out there simply lock a camera to a unit. Although I have seen a first person shooter that required spamming of spells to change the angle...but it wasn't very intuitive.

I'm pretty sure there's an event that triggers when a key is pressed, and an event when it is let go, but it's only for like five keys (the arrows keys and I think another, but I may be wrong). I have no experience with cameras and arrow keys but I can try to help if you wish. I'd rather have some one who knows what they are doing help you instead.
 

Argentine

New Member
Reaction score
2
When I said 3rd person... I meant 3rd person (in world of warcraft you can be in third person and move the camera around your character by holding the left mouse button. This is the type of effect i want to duplicate.

You can move the camera with the arrow keys with the proper triggers and variables.

You set a variable for each key press called "up, left, right, down"

You then make triggers

Event
A player presses the up arrow key.
conditions -
actions -
set up = true

Then another trigger for:

Event
A player releases the Up arrow key
conditions -
actions -
set up = false


Repeat these two triggers for left right and down.

Now set a trigger for the events for moving the camera

event- every 0.1 seconds
conditions - up = true
action - move camera blah blah blah (this is the part i need help with....)


event- every 0.1 seconds
conditions - down = true
action - move camera blah blah blah (this is the part i need help with....)


event- every 0.1 seconds
conditions - left = true
action - move camera blah blah blah (this is the part i need help with....)


event- every 0.1 seconds
conditions - right = true
action - move camera blah blah blah (this is the part i need help with....)


I am sure with some if/then/else triggers i would beable to tell the camera.. turn a certain amount unless you are turned a certain amount already, so the player can't look too far to any direction. I just dont know how. Yet..
 

Shura

New Member
Reaction score
45
Your periodic trigger should look something like this:
Trigger:
  • trigger
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • up Equal to True
          • vertical Greater than or equal to -80.00
        • Then - Actions
          • Set vertical = (vertical - 5.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • down Equal to True
          • vertical Less than or equal to -20.00
        • Then - Actions
          • Set vertical = (vertical + 5.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • right Equal to True
          • horizontal Less than or equal to 100.00
        • Then - Actions
          • Set horizontal = (horizontal + 10.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • left Equal to True
          • horizontal Greater than or equal to -100.00
        • Then - Actions
          • Set horizontal = (horizontal - 10.00)
        • Else - Actions
      • Set temp_point = (Position of Target Unit)
      • Camera - Pan camera for Player 1 (Red) to temp_point over 0.00 seconds
      • Camera - Rotate camera ((Facing of Your Unit) + (horizontal - 90.00)) degrees around temp_point for Player 1 (Red) over 0.00 seconds
      • Camera - Set Player 1 (Red)'s camera Angle of attack to vertical over 0.00 seconds
      • Custom script: call RemoveLocation (udg_temp_point)
 

Argentine

New Member
Reaction score
2
I tried doing this trigger (exactly how you had it) and the camera is detatching from the hero and floating away.... :) :banghead:

maybe i'm doing something wrong with my variables or something is interfering with my normal trigger to make the camera 3rd person in the first place.
 

Shura

New Member
Reaction score
45
This trigger would cover everything you would need for a third-person camera. Try disabling your other trigger.
 

Argentine

New Member
Reaction score
2
The trigger you posted won't work (the way i have it) I don't know if perhaps I am doing something wrong?

Trigger:
  • camera look
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Up[(Player number of (Picked player))] Equal to True
              • verticle Greater than or equal to -80.00
            • Then - Actions
              • Set verticle = (verticle - 5.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • down[(Player number of (Picked player))] Equal to True
              • verticle Less than or equal to -20.00
            • Then - Actions
              • Set verticle = (verticle + 5.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Right[(Player number of (Picked player))] Equal to True
              • horizontal Less than or equal to 100.00
            • Then - Actions
              • Set horizontal = (horizontal + 10.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Left[(Player number of (Picked player))] Equal to True
              • horizontal Greater than or equal to -100.00
            • Then - Actions
              • Set horizontal = (horizontal - 10.00)
            • Else - Actions
          • Set TempPoint[(Player number of (Picked player))] = (Position of player_hero[(Player number of (Picked player))])
          • Camera - Set Player 1 (Red)'s camera Distance to target to 725.00 over 0.10 seconds
          • Camera - Set Player 1 (Red)'s camera Angle of attack to 335.00 over 0.10 seconds
          • Camera - Set Player 1 (Red)'s camera Height Offset to 160.00 over 0.10 seconds
          • Camera - Set Player 1 (Red)'s camera Rotation to (Facing of player_hero[(Player number of Player 1 (Red))]) over 0.10 seconds
          • Custom script: call RemoveLocation (udg_TempPoint)


I fixed the custom script error with
Trigger:
  • Custom script: call RemoveLocation (udg_TempPoint[GetConvertedPlayerId(GetEnumPlayer())])


EDIT: Okay i made your trigger and the "direction arrow pressed = true/false" triggers as the only triggers enabled in the map and it still does nothing. The hero doesn't twitch, that was because of my other "up,left,right,down" is pressed = true triggers. I fixed that. Here is the map below the triggers are clearly labeled "camera blah blah" on top for you to see what they are.
 

Shura

New Member
Reaction score
45
TempPoint shouldn't be an array, you can use the same variable for every player. Also, if you want the camera to be applied for every character, you will need to make 'vertical' and 'horizontal' arrays. You would use the player number as the index. Also, is the camera supposed to be locked to a unit? And are you going to be using the arrow keys to adjust the camera or move the units?
 

Argentine

New Member
Reaction score
2
The map is for a single player game.

The camera must be locked to the player's unit.

I want to use the arrow keys to move the camera, but only to rotate the camera as if the player was trying to look up, left, right or down (with the camera)

However: I want to make the camera only able to rotate a short distance in any direction.

(I fail at camera triggers, i know this, sorry.)
 

Argentine

New Member
Reaction score
2
Thanks :)

You sir, have just written the perfect camera system for my RPG :)

With your permission i'de like to give you credit in the map's credits when it reaches beta.:thup:

(EDIT: This problem has been solved.)
 

Argentine

New Member
Reaction score
2
(Had a problem but I Fixed it)

Oh and I wasn't really asking if you want to be given credit for the triggering of the camera, I was just asking your permission :) Because I would like to give you credit for it. It's not right for me to take all the credit for a trigger I didn't make. Especially since the camera angles of any game really make or break the game play experience. Just ask the makers of Diablo games.
 

sLsIDK

New Member
Reaction score
13
Oh and I wasn't really asking if you want to be given credit for the triggering of the camera, I was just asking your permission

wat.

Again I don't care, take it, use it, claim it as your own, do whatever you want, or don't, and give me credit, I really don't care, I made this for you to use.
 

Argentine

New Member
Reaction score
2
I'm giving you credit, but I was wondering if you could fix it a bit so that the camera is much closer to the player_hero.
 

sLsIDK

New Member
Reaction score
13
Camera - Set Player 1 (Red)'s camera Distance to target to ((Target Z of current camera view) + 550.00) over 0.10 seconds

Just change that to whatever you want, it's located here:

Trigger:
  • camera look
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • verticle Less than or equal to -20.00
              • verticle Greater than or equal to -80.00
            • Then - Actions
              • Set verticle = (verticle + (UpDown x 5.00))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • horizontal Greater than or equal to (0.00 - HorzMax)
              • horizontal Less than or equal to HorzMax
            • Then - Actions
              • Set horizontal = (horizontal + (LeftRight x 10.00))
            • Else - Actions
          • Set TempPoint[0] = (Position of player_hero[(Player number of Player 1 (Red))])
          • Camera - Lock camera target for Player 1 (Red) to player_hero[(Player number of Player 1 (Red))], offset by (0.00, 0.00) using Default rotation
          • Camera - Set Player 1 (Red)'s camera Distance to target to ((Target Z of current camera view) + CamDist) over 0.10 seconds <<<<<<<<<<
          • Camera - Set Player 1 (Red)'s camera Angle of attack to verticle over 0.10 seconds
          • Camera - Set Player 1 (Red)'s camera Rotation to ((Facing of player_hero[(Player number of Player 1 (Red))]) + horizontal) over 0.10 seconds
          • Custom script: call RemoveLocation (udg_TempPoint[0])



You may have noticed that the trigger is a bit different, that's because I'm working on making the system more friendly towards configuration and not require 8 triggers and four variables to get up/down and left/right. I have encountered a bug, but I'll fix it when I get the chance, as I have to go.
 

Argentine

New Member
Reaction score
2
Thanks. The issue I have when I try to edit the camera triggers (distances) to make the camera more what I want is I don't really know one simple thing, maybe you can answer this question for me and i'll understand better:

What does a higher or lower angle of attack do to the camera? (explain what raising it does as opposed to lowering it?)

What does high offset do when you raise/lower the number?

Thanks, I know the answers might be obvious but I don't want to just assume I know what I'm doing because I'm sure I don't.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top