|
|
#1 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
Altering player movement
Hey All,
I am currently building a map that is trying to recreate some aspects of the game chess. Specically, I am trying to make it such that each time a person is allowed to move, and presses the forward key for example, the game will move that player forward exactly one square/unit (which of course will be defined by the size of the source map that I build). Similarly, if a person were to want to move to the right, then the program would both rotate 90 degrees and translate the requisite unit length. In short, is there anyway to alter the game code such that player translation always moves a stereotyped amount and that player rotation is always 90 degrees in the specified direction (preferably this would appear as a smooth rotation rather than an instantaneous one). Thanks for all help in advance! |
|
|
|
|
|
#2 |
![]() Join Date: Aug 2011
Reputation: 0
Posts: 17
|
Yes you can code that, anything is possible.
No, I don't know how, you'd have to figure it out yourself. As a side note, you didn't need to use that fancy grammar and those big words, it doesn't make you look any smarter, just trying to be friendly here. :P |
|
|
|
|
|
#3 |
![]() Join Date: Sep 2010
Reputation: 35
Posts: 455
|
You clearly have no idea what you're talking about. Big words and fancy grammar? He doesn't use any complex words at all, just the right ones needed to get his point across. No, it doesn't make him look smarter, but that was never the intention. Your post, on the contrary, makes you sound very unintelligent. Don't encourage people on the internet to use even worse spelling/grammar techniques.
|
|
|
|
|
|
#4 | |
![]() Join Date: Sep 2010
Reputation: 0
Posts: 51
|
Quote:
|
|
|
|
|
|
|
#5 |
![]() Join Date: May 2007
Reputation: 7
Posts: 748
|
This could probably be done in Hammer.
A path_track for each checker section on the board, Each chess piece (either a model or brush) is parented to a func_tracktrain. A point_viewcontrol (flags in the viewcontrol can stop the actaul player from moving) that can be moved and parented to any chess piece. A ton of logic_case, logic_compair, logic_relay for each chess piece and problably a few for each path_track. It might take a while to do and might be very long winded but im a mapper and not a coder. I think you can use vehicle_viewcontroller to control the func_tracktrain movments. IE when the play presses "W" the train moves to the first path_track and stops. If the player presses "A" the train rotates on the path_track. I think that can be done by messing with its orientation. I;d need to look into it some more but i think its posible... The only problem i can foresee is if this is for anyother game apart from Garry's mod then you will need to modify the game code to allow multiple intances of acive point_viewcontrol (if its for MP, SP is not a problem.) |
|
|
|
|
|
#6 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
Thanks for the advice, looks like it might work. Any other thoughts from anyone?
|
|
|
|
|
|
#7 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
Does anyone know if it is possible to create a console alias that will do the trick? I'm thinking it might be possible to play with the +right and -right (and + left - left) in such a way that once a button is pressed, -command occurs x seconds later.
|
|
|
|
|
|
#8 | ||
![]() Join Date: Aug 2011
Reputation: 0
Posts: 17
|
Quote:
Quote:
Sometimes I don't see why I argue on the internet, I'm slowly realizing that I'm not always right
|
||
|
|
|
|
|
#9 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
bumpity bump....anyone else with any ideas?
|
|
|
|
|
|
#10 |
![]() Join Date: Mar 2012
Reputation: 204
Posts: 895
|
Gamemovement.cpp is all you need for movement mechanics.
|
|
|
|
|
|
#11 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
Cool, and that contains something that regulates how much one key press down per movement equals?
|
|
|
|
|
|
#12 |
![]() Join Date: Aug 2004
Reputation: 67
Posts: 1,144
|
No, but I suggest just overriding with a new class and starting with the main entry points for movement add your desired movement code and work from there, the gamemovement is bloated with hl2 movement code, your movement desires are much simpler so you don't need it all.
|
|
|
|
|
|
#13 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
Going through the actual .cpp and not exactly sure where to start, any tips/hints?
|
|
|
|
|
|
#14 |
|
Join Date: May 2012
Reputation: 0
Posts: 6
|
You could just throw a few new con commands that teleport the player via a raytrace, and rotate the player via their Euler angles. Though I don't see too many problems with wholly editing the movement base.
I'd say leaving the ability to use standard movement is a great thing for debugging purposes. (Especially when viewing the map as a whole) |
|
|
|
|
|
#15 |
|
Join Date: Nov 2011
Reputation: 0
Posts: 8
|
I've been playing around with the in_main.cpp, specifically the line of code that determines what happens when a key is pressed, anyone have any insights as to the areas that might be useful to modify?
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|