• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

HUD, 3rd person camera and keyboard movement

Status
Not open for further replies.
Level 8
Joined
Nov 20, 2008
Messages
445
Posting an example here how to create custom UI on screen(HUD) and an example of how you can code a movement system using keyboard keys(Along with TPC).

EDIT: Updated the map with better HUD(Target frame is in now). Smoother movement system(Along with mouse control). And added a basic way to create a custom attack system(Tho thats just experimenting).

To use:
Left Click - Just rotates the camera around the hero without him following its angle.
Right Click - Rotates the camera around the hero forcing him to always run in its angle.

Selecting a Unit - Shows it in the Target Frame(Still no proper portrait just a placeholder) and if its an enemy it will start the attack. To attack it you just need to be withing given range(in this case 1.5).

Due to locking the camera to prevent moving it out of focus for the hero you can use the mouse scroll to zoom only when you are holding one of the mouse buttons.
 

Attachments

  • RPGStuff.rar
    80.2 KB · Views: 694
Last edited:
Level 8
Joined
Jun 28, 2008
Messages
356
Thanks. I had some problem with the camera jumping instantly 180 degrees to the left sometimes, but I think I see why now. Anyways, the key press/release thing could be done like this:

Have one array
Code:
bool[256] keyState
that has default values to FALSE.
Then the On Key Pressed and On Key Released triggers go like this:

  • onKeyUp
    • Events
      • UI - Player Any Player presses None key Up with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()] = false
  • onKeyDown
    • Events
      • UI - Player Any Player presses None key Down with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()] = true
Then you can track every damn key with just those two triggers, no need for mass variable and mass events for each key.
 
Level 8
Joined
Nov 20, 2008
Messages
445
Yeah you're right. But just as I said this is an example of whats possible. Not really aiming to make it work good(Wont bother untill we properly get Galaxy Scripting). Just testing the possibilities of the editor ^^
 
Level 25
Joined
May 11, 2007
Messages
4,651
Thanks. I had some problem with the camera jumping instantly 180 degrees to the left sometimes, but I think I see why now. Anyways, the key press/release thing could be done like this:

Have one array
Code:
bool[256] keyState
that has default values to FALSE.
Then the On Key Pressed and On Key Released triggers go like this:

  • onKeyUp
    • Events
      • UI - Player Any Player presses None key Up with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()] = false
  • onKeyDown
    • Events
      • UI - Player Any Player presses None key Down with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()] = true
Then you can track every damn key with just those two triggers, no need for mass variable and mass events for each key.

Awesome! Thanks!
 
Level 8
Joined
Nov 20, 2008
Messages
445
So you could look up the terrain and see that it was the same, but couldn't just check the fucking triggers and see that they are not his but decided to just annoy me ehh ?

And for the suckiness i think i already mentioned that those are just examples of what can be done. I didnt even consider making this good and multi player instancable.
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
You took the map from sc2napster and just removed some things.
That is what is looks like. The terrain is identical.

About annoying you:
I am so sorry that I annoy you for stealing other peoples work.

Someone needs a girlfriend:con:
 
Level 8
Joined
Jun 28, 2008
Messages
356
How it comes that terrain and such things are identical as well?
By the way, the scripts suck, they are not even MPI.

They weren't supposed to be MPI, as RaiN said it was just an example so people can build their own systems... But here is the MPI version of mine:

Variable:
Code:
keyState[256][16]

  • onKeyDown
    • Events
      • UI - Player Any Player presses None key Down with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()][(Triggering player)] = true
  • onKeyDown
    • Events
      • UI - Player Any Player presses None key Up with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set keyState[EventKeyPressed()][(Triggering player)] = false
Happy now?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
How do you attack with this system?

Also, found a glitch.

Move forward than hold down the backward button than release forward. You will move without playing the animation.
 
Level 8
Joined
Nov 20, 2008
Messages
445
Yeah, there are still some buggs and I'm gonna post a new map later today with way more functionality like mouse control, the target frame(and unit targeting ofc) and some basic attacking method(tho it currently looks ugly) and ofcourse this system MPI as I see people really whine for stuff like that...
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Lol take ur time. i know most of us want this for 3PS-MMO's and both of those cant be done without heroes, and most of us dont wanna do the triggers for heroes.
 
Level 8
Joined
Nov 20, 2008
Messages
445
Updated the map(You can find it at first post). Removed everything that wasnt done by me(hope people stop whining). Even changed the terrain...
 
Status
Not open for further replies.
Top