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

Members Online

»
0 Active | 52 Guests
Online:

LATEST FORUM THREADS

»
Call of Duty®: WWII
CoD WW2 General
SOF2 Prefabs map
SoFII Mapping
coduo mapping tools
CoDUO 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 subscribe
Author Topic: Teleport on Melee (Bash)
csocsi96
General Member
Since: Aug 9, 2010
Posts: 75
Last: Aug 24, 2014
[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: 75
Last: Aug 24, 2014
[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

»
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

»