Key tracking
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Key tracking
Hey guys. Have a difficult question but maybe somebody knows..
How to force inventory item to track pushed buttons?
For example - I want to create a kind of jet pack. It might be activated when I press jump key two times or just once if player's physics is PHYS_Falling. When it's active, player hanging in the air. If I press key related to Walk Forward function - player flies forward, if Backwards - player flies backward and so on. Jump and Crouch keys must change players height above the ground.
How to make this?
How to force inventory item to track pushed buttons?
For example - I want to create a kind of jet pack. It might be activated when I press jump key two times or just once if player's physics is PHYS_Falling. When it's active, player hanging in the air. If I press key related to Walk Forward function - player flies forward, if Backwards - player flies backward and so on. Jump and Crouch keys must change players height above the ground.
How to make this?
Unreal. Alter your reality..forever...
- papercoffee
- Godlike
- Posts: 10453
- Joined: Wed Jul 15, 2009 11:36 am
- Personal rank: coffee addicted !!!
- Location: Cologne, the city with the big cathedral.
- Contact:
Re: Key tracking
Isn't there something similar in the Mod Siege ?
I didn't play this Mod ...but I could see there is a jet-pack available.
I didn't play this Mod ...but I could see there is a jet-pack available.
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Re: Key tracking
Dunno i didn't played this mod.
Can you look please?
Can you look please?
Unreal. Alter your reality..forever...
- papercoffee
- Godlike
- Posts: 10453
- Joined: Wed Jul 15, 2009 11:36 am
- Personal rank: coffee addicted !!!
- Location: Cologne, the city with the big cathedral.
- Contact:
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Key tracking
Well, there are some ways to do that.
One of the ways, is checking the flags from the player itself (PlayerPawn class), like bPressedJump, bIsCrouching, bWokeUp, bWasForward, bWasBack, bWasLeft, bWasRight, bEdgeForward, etc... (you can check the PlayerPawn class variables to see all of them).
Another way, is a little more advanced than that and is to create exec functions (simulated with client->server replication statement) and bind that to the key(s) you want, like:
To bind it, you would have to, automatically, search through the player input (client-side), check the one that says "Jump" and add a "|MyExecFunction" to it and save.
This one is what most mods use (including the jetpack in Siege, and my own current mod to fix a certain issue in UT).
As for how to do this exactly, I would rather not unveil it myself because it can be misused as it's about tweaking user files.
So instead, you can download and check how it's done in Siege:
http://www.heiland.co.uk/siege/index.html
(navigate through the upper small menus/links)
One of the ways, is checking the flags from the player itself (PlayerPawn class), like bPressedJump, bIsCrouching, bWokeUp, bWasForward, bWasBack, bWasLeft, bWasRight, bEdgeForward, etc... (you can check the PlayerPawn class variables to see all of them).
Another way, is a little more advanced than that and is to create exec functions (simulated with client->server replication statement) and bind that to the key(s) you want, like:
Code: Select all
replication
{
reliable if (Role < ROLE_Authority)
MyExecFunction;
}
exec simulated function MyExecFunction()
{
//Do stuff
}
This one is what most mods use (including the jetpack in Siege, and my own current mod to fix a certain issue in UT).
As for how to do this exactly, I would rather not unveil it myself because it can be misused as it's about tweaking user files.
So instead, you can download and check how it's done in Siege:
http://www.heiland.co.uk/siege/index.html
(navigate through the upper small menus/links)
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Re: Key tracking
I remember how to make exec functions...worked out with some Unreal 1 mods for server administration..but thats not the way i need
I'll see what's the thing - Siege mod
Thnx for help)
I'll see what's the thing - Siege mod
Thnx for help)
Unreal. Alter your reality..forever...
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Key tracking
Look for the parachute mod, ParaMut I think it was called. You'll get a really nice start for what you want out of it. It monitors falling and kicks in if you start to accelerate down too fast. I've played around a bit with the code from it and it does work well. The parachute itself was ugly as hell and that's why it never caught on.
Alright! I found it locally:
Alright! I found it locally:
So long, and thanks for all the fish
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Re: Key tracking
Thnx Ill try this out)JackGriffin wrote:Look for the parachute mod, ParaMut I think it was called. You'll get a really nice start for what you want out of it. It monitors falling and kicks in if you start to accelerate down too fast. I've played around a bit with the code from it and it does work well. The parachute itself was ugly as hell and that's why it never caught on.
Alright! I found it locally:
About the siege mod..I saw the code of jet pack there, it's good and I can learn out basically how it was made
I have another one question - is it possible to add some stuff to HUD without creation of new HUD type? If I'm just want to add additional meters (such as jet pack fuel limit, height, speed and so on) to the default HUD?
I had an idea to create a kind of power armor which came to me after playing Warhammer 40 000: Dawn Of War and now it appeared again because i finally found models of Space Marines..So I wanted to add a lot implements to HUD (target tracking, shield charge of the armor, add jet pack abilities and other useful stuff)
Unreal. Alter your reality..forever...
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Key tracking
If you want to add stuff to the HUD, you just need to build an HUD mutator.
As for how to make an HUD mutator, an example:
As for how to make an HUD mutator, an example:
Code: Select all
class MyHUDMutator expands Mutator;
simulated function Tick(float Delta)
{
if (!bHUDMutator && Level.NetMode != NM_DedicatedServer )
RegisterHUDMutator();
}
simulated function PostRender(canvas Canvas)
{
//Render your HUD stuff here
//IMPORTANT: Keep this code at the end to not break other HUD mutators
if (NextHUDMutator != None)
NextHUDMutator.PostRender(Canvas);
}
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Re: Key tracking
Got it.
And what is the code that allows call of custom HUD type from inventory item?
And what is the code that allows call of custom HUD type from inventory item?
Unreal. Alter your reality..forever...
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Key tracking
Look at the code for the relics. They have everything you need: a HUD item when picked up, dynamic changing of that icon when needed, and code to enact the HUD mutator.
Check out my sig. Specifically look at the classes "RelicHUDMutator" to see how to code a HUD addition and " RelicInventory" for how to spawn it in the pickup code.
Don't be intimidated by this. It's pretty easy to make a HUD mutator. Often the hardest part is sussing out the placement and accounting for all the different resolutions.
Check out my sig. Specifically look at the classes "RelicHUDMutator" to see how to code a HUD addition and " RelicInventory" for how to spawn it in the pickup code.
Don't be intimidated by this. It's pretty easy to make a HUD mutator. Often the hardest part is sussing out the placement and accounting for all the different resolutions.
So long, and thanks for all the fish
-
- Adept
- Posts: 406
- Joined: Fri Apr 20, 2012 6:38 pm
- Personal rank: Master of Coop
- Location: Odessa, Ukraine
Re: Key tracking
Thanks
About resolutions...I thought about it.
I have pretty old document, from times I played and made mods for Unreal 1 - "The Index of Unreal Script". there was a tutorial "Modifying HUD" in two parts and in examples of that tutorial was source code, which explain position of elements for different resolutions and different types of HUD. So must I overwrite UT default HUD position values to make items on the screen not conflict each other while changing screen resolution?
About resolutions...I thought about it.
I have pretty old document, from times I played and made mods for Unreal 1 - "The Index of Unreal Script". there was a tutorial "Modifying HUD" in two parts and in examples of that tutorial was source code, which explain position of elements for different resolutions and different types of HUD. So must I overwrite UT default HUD position values to make items on the screen not conflict each other while changing screen resolution?
Unreal. Alter your reality..forever...
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Key tracking
The easiest way is to use real estate not currently occupied. Add it above the existing HUD elements or on the sides, etc. Be creative!
So long, and thanks for all the fish