Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 78 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: buttonpressed()
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Sep. 16, 2010 07:09 pm
Hi guys,
currently working on something that might get you boosted when jumping against a wall (wall double jump or something, dunno how to call it), but i need to monitor the jump button in air, or at least the space button.

How do i do this without rebinding it? As i dont want people to leave my mod with non-working spacebars...
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Friday, Oct. 1, 2010 06:12 pm
Bump
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Oct. 1, 2010 06:42 pm
Well...this script would work in Cod4... i'm not so sure about Cod2.... only thing is you would have to land on the ground somewhere(higher even) for it to continue on.... but idk if the functions exist in Cod2 or not(i don't have the game and never modded for it)... but maybe you could use it for a starting point.

Code:
jumpMonitor()
{
self endon("disconnect");

	while(1)
	{
		wait .05;
		if(!isAlive(self))
			return;

		initialPoint = self.origin[2];
		highestPoint = initialPoint;
		if(!self isOnGround())
		{
			while(!self isOnGround())
			{
				if(self.origin[2] > initialPoint)
					highestPoint = self.origin[2];
				wait .05;
			}
			if(highestPoint > initialPoint)
				self iprintln("You jumped and landed");
		}
	}
}


edited on Oct. 1, 2010 02:42 pm by _INSANE_
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Friday, Oct. 1, 2010 10:13 pm
Well, thank you, but i think you misread.
I already have the boosting routine figured out (in my head), all it needs is a trigger button, preferably the jump key.
Buttonpressed() works for cod4, but not for cod2 (console only maybe?)

So i am looking for some buttonpressed() function for cod2 without menu binds/other binds.
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Oct. 1, 2010 10:59 pm
this would monitor if you were on the ground...then left the ground...and went higher... which would mean you jumped.

Maybe just edit it to not wait till you land on the ground again if you dont want. or just nvm.

edited on Oct. 1, 2010 07:00 pm by _INSANE_
Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Oct. 2, 2010 07:50 am
If you want to make the player jump off a wall (a double jump of a kind), then you'll need to run a bullet trace and check if the player is not touching the ground (INSANE's script) and if the player is facing and close enough to a wall for a double jump.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Saturday, Oct. 2, 2010 09:05 am
The not on ground script is already working, the bullettrace isnt the problem either.
I want the double jump to happen when the player presses the jump button, but i cant find any script to monitor that button.

So basically im asking for a buttonpressed() script, like the title already states :P
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Oct. 2, 2010 11:24 am
The only possible method I can think of is to rebind a player's spacebar to also send a menu response when pressed.

This of course requires that the player has the spacebar bound to jump and as not used the key for something else.

I
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Oct. 2, 2010 05:54 pm
idk if this is any helpful but in cod4 they have a function like this :

"buttonpressed( button_name );"

you can probably use that if it works in cod2. you might also want to change the players angles so that once they do the double jump they arent facing the wall and they turn around. theres also another function for that.

"getplayerangles();"

i guess u can change it to

level.player getplayerangles() + ( 0, 180, 0 );

idk. just a thought.

Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Saturday, Oct. 2, 2010 07:24 pm
IzNoGoD writes...
Quote:
...
Buttonpressed() works for cod4, but not for cod2 (console only maybe?)
...

So maybe ill try to port the buttonpressed script to cod2, or, try to double bind a key.

But as someone already told me double binding a key doesnt work, i will need some help...

Maybe rebinding the key in air, as players only tend to exit when they are onground? (rebinding it to jump when the player is onground)
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»