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

Members Online

»
2 Active | 26 Guests
Online:

LATEST FORUM THREADS

»
Rainbow HELP....
CoD4 MP Mapping
help pls
CoD2 Scripting

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, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Teleport on Melee (Bash)
csocsi96
General Member
Since: Aug 9, 2010
Posts: 70
Last: Apr 21, 2013
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Sep. 16, 2012 02:41 am
Hello everyone,

I just made a teleporting script on Melee.

When I press the melee button, i got teleported where my crosshair was to.

But sometimes, when i am aiming at a wall, it teleports me into the wall. Can you help me pls, how to make the script working properly?
I don't know how to get out from the walls when i stuck in.

Here is my script:

Code:

teleportalas()
{
	self endon("disconnect");
	self.teleport_have=true;
	self iprintlnbold("^1Célozz, Basholj, Teleportálj!");
	
	for(;;)
	{
		if(self meleebuttonpressed() && isalive(self))
		{
			vec=anglestoforward(self getplayerangles());
			trace=bullettrace(self geteye()+(0,0,18),self geteye()+(20000*vec[0],20000*vec[1],20000*vec[2]+18),false,self);
			//hely=self geteye()+(0,0,18)+(20000*vec[0],20000*vec[1],20000*vec[2]+18);
		
			self setorigin(trace["position"]);
			self.teleport_have=false;
			return;
		}
		wait 0.05;
	}
}



Sometimes i got stucked into the ground too, but i raised the teleport location higher (0,0,18) so when i teleport myself to the ground i works. But still stucks into the walls.

Help please!
Share |
megazor
General Member
Since: Sep 17, 2009
Posts: 5
Last: Oct 25, 2012
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Sunday, Sep. 16, 2012 04:14 am
Ask Tally, IzNoGod or me to write playerTrace().

By now our team can only suggest you the following code:

Code:
self setorigin( trace["position"]+(trace["normal"][0]*18, trace["normal"][1]*18, trace["normal"][2]*18) );
Share |
Mitch*
General Member
Since: Jan 23, 2007
Posts: 24
Last: Nov 10, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Sep. 16, 2012 05:03 am
Try this:

1. Trace forward using getEye()
2, Remove a little forward dir from trace location. For example 30.
3. Trace down using position from step 2.

Code example:
Code:

TeleportMe()
{
	self endon("disconnect");
	self endon("killed_player");	

	while(!self meleebuttonpressed())
		wait(0.05);

	self setorigin(self traceTarget());
}

traceTarget()
{
	forward=anglestoforward(self getplayerangles());
	trace=bullettrace(self geteye()+ (0, 0, 18), self geteye()+maps\mp\_utility::vectorScale(forward, 100000) + (0, 0, 18), false, self);
	origin = trace["position"] - maps\mp\_utility::vectorScale(forward, 30);
	trace=bullettrace(origin, origin - (0,0,100000), false, self);

	return trace["position"];
}


edited on Sep. 16, 2012 05:04 am by Mitch*
Share |
csocsi96
General Member
Since: Aug 9, 2010
Posts: 70
Last: Apr 21, 2013
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Sep. 16, 2012 09:43 am
Thank you, it works! [jumping]
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»