• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Rpg Like Camera Release :D

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2009
Messages
51
Hi :D,
after a few days and a few questions here in the forum, i have finally done my rpg like camera :D
This camera is a 3rd person similiar to wow( world of warcraft)

Futures:
  • Camera is affacted by ground level, wich means if the hero goes up - so is the camera.
  • Ability to Rotate camera right, left. Using the arrow keys.
  • Ability to change angle of attack up, down. Using the arrow keys.
  • A smooth movment.
  • The distancce to target is changeable, by Typing: "V [number from 0 to 9999].
    And also the height is affacted by the distance wich makes your hero always visible, even if you put 3000 distance, unless your already seeing black :D.


Also works by variable: Hero[1~6] (unit variable).
so to add this to map, you can easly import it and just set each player's hero. and it all works.
Here are the codes:

CameraScript:
JASS:
function SetCameraZ takes real z, player p returns nothing
    if GetLocalPlayer() == p then
       set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+z-GetCameraTargetPositionZ()
       call SetCameraField(CAMERA_FIELD_ZOFFSET,z,- 0.01)
       call SetCameraField(CAMERA_FIELD_ZOFFSET,z,0.01)
    endif
endfunction

The Main triggers:

  • OverAll
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Lock camera target for (Picked player) to Hero[(Player number of (Picked player))], offset by (0.00, 0.00) using Default rotation
          • Camera - Set (Picked player)'s camera Distance to target to (Real(CameraDistance[(Player number of (Picked player))])) over 0.10 seconds
          • Camera - Set (Picked player)'s camera Angle of attack to (Real(CameraAngle[(Player number of (Picked player))])) over 0.10 seconds
          • Camera - Set (Picked player)'s camera Rotation to ((Facing of Hero[(Player number of (Picked player))]) + (Real(CameraRotation[(Player number of (Picked player))]))) over 0.50 seconds
          • Set Loc[(Player number of (Picked player))] = (Position of Hero[(Player number of (Picked player))])
          • Custom script: set udg_TerrainHeight[(GetPlayerId(GetEnumPlayer()))+1] = GetLocationZ(udg_Loc[(GetPlayerId(GetEnumPlayer()))+1])
          • Set CameraHeight[(Player number of (Picked player))] = ((Integer(TerrainHeight[(Player number of (Picked player))])) + (CameraDistance[(Player number of (Picked player))] / 4))
          • Custom script: call SetCameraZ (udg_CameraHeight[GetPlayerId(GetEnumPlayer())+1] , Player(GetPlayerId(GetEnumPlayer())))
  • Distance
    • Events
      • Player - Player 1 (Red) types a chat message containing v as A substring
      • Player - Player 2 (Blue) types a chat message containing v as A substring
      • Player - Player 3 (Teal) types a chat message containing v as A substring
      • Player - Player 4 (Purple) types a chat message containing v as A substring
      • Player - Player 5 (Yellow) types a chat message containing v as A substring
      • Player - Player 6 (Orange) types a chat message containing v as A substring
    • Conditions
    • Actions
      • Set CameraDistance[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 3, 6))))
*it's not all triggers, there is also the triggers for controling the camera movment using the arrow keys, sadly it's too much to add and i am short on time at the moment.



i need to credit some people for this, with out them i couldnt have done it, i don't remember who they are exactly so, if u do see this and u know u helped me, just tell me, i'll rep you and write ur name down here :D.

I am interested in making an rpg with this camera, if some one is interested too, tell me.

Link to map, check it out :D:
 

Attachments

  • Rpg_Work.w3x
    151.2 KB · Views: 63
Level 2
Joined
Dec 31, 2005
Messages
10
When moving to a different height theres a lot of violent shaking of the screen :/ Other than that I like it.
 
Level 8
Joined
Jun 20, 2004
Messages
229
using a for loop will run faster and require less function calling than using a group loop. also I noticed you are running a periodic at 0.10 but the height function which fixes the camera height so it is not inaccurate due to terrain smoothing is correcting on the basis your camera is being ran every hundredth of a second and not tenth. changing it to 0.10 on both fields should fix the camera shaking.
 
Status
Not open for further replies.
Top