How to make a person move in direction of a grenade?
Moderator: Core Staff
How to make a person move in direction of a grenade?
How do you make a person move in the same way/direction a grenade would if they threw it; if necessary, how to make a special weapon file / grenade that when used it causes them to be attached to the nade or whatever.
-
- PC Team
- Posts: 2369
- Joined: March 30th, 2008, 4:21 pm
- Location: South England
- Contact:
Re: How to make a person move in direction of a grenade?
Im not quite sure what you mean, but in promod there is a little "ready up" period, where u can have a certain mod called "warm up" mode or something, there you can follow your nade in mid air to see where it is going.xeno wrote:How do you make a person move in the same way/direction a grenade would if they threw it; if necessary, how to make a special weapon file / grenade that when used it causes them to be attached to the nade or whatever.
PeħÄuÄe@CoDJumper.com: put your cock away, you sick man
Matty@CoDJumper.com: hahaha
PeħÄuÄe@CoDJumper.com: (while i whip mine out)
Matty@CoDJumper.com: lol
PeħÄuÄe@CoDJumper.com: just kidding
PeħÄuÄe@CoDJumper.com: ... i don't have one
Matty@CoDJumper.com: hahaha
PeħÄuÄe@CoDJumper.com: (while i whip mine out)
Matty@CoDJumper.com: lol
PeħÄuÄe@CoDJumper.com: just kidding
PeħÄuÄe@CoDJumper.com: ... i don't have one
Re: How to make a person move in direction of a grenade?
Well I want to be able to make a person move like a grenade being thrown. How it has the arch motion and such. By attaching/linking the player to the nade or some other method.
-
- PC Team
- Posts: 2369
- Joined: March 30th, 2008, 4:21 pm
- Location: South England
- Contact:
Re: How to make a person move in direction of a grenade?
Yes for that do the thing as i said above, ill try and find you a link on the mod, 1 second.xeno wrote:Well I want to be able to make a person move like a grenade being thrown. How it has the arch motion and such. By attaching/linking the player to the nade or some other method.
http://www.filefront.com/9469714/AM4PAM ... dmiralMOD/
here is a mod you can download, haven't tested it, but im sure it will work.
PeħÄuÄe@CoDJumper.com: put your cock away, you sick man
Matty@CoDJumper.com: hahaha
PeħÄuÄe@CoDJumper.com: (while i whip mine out)
Matty@CoDJumper.com: lol
PeħÄuÄe@CoDJumper.com: just kidding
PeħÄuÄe@CoDJumper.com: ... i don't have one
Matty@CoDJumper.com: hahaha
PeħÄuÄe@CoDJumper.com: (while i whip mine out)
Matty@CoDJumper.com: lol
PeħÄuÄe@CoDJumper.com: just kidding
PeħÄuÄe@CoDJumper.com: ... i don't have one
Re: How to make a person move in direction of a grenade?
Well, it's for cod1. Not cod4, so don't know if that will work.
-
- Core Staff
- Posts: 2214
- Joined: February 6th, 2006, 3:18 pm
- Location: Germany/Bayern
Re: How to make a person move in direction of a grenade?
Get the script and just try it out. I guess it could work most likely.xeno wrote:Well, it's for cod1. Not cod4, so don't know if that will work.
THAT HANDS WERE NOT TRACED!
visit my blog: Link
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: How to make a person move in direction of a grenade?
The script was actually quite easy when I created a private test mod, but I cannot find my scripting for it
The idea is very simple:
Create a loop to detect grenades being thrown.
when the frag is found, create a new loop to monitor the origin of the frag (I created a quick array that basically stored all the values of the frag origin)
Then just force the player origin to follow the frag using a little maths to detect direction. (anglestoup and anglestoforward, I think)
Then force those angles upon the player.
I may try recreate the code, it didnt take me long last time...
The idea is very simple:
Create a loop to detect grenades being thrown.
when the frag is found, create a new loop to monitor the origin of the frag (I created a quick array that basically stored all the values of the frag origin)
Then just force the player origin to follow the frag using a little maths to detect direction. (anglestoup and anglestoforward, I think)
Then force those angles upon the player.
I may try recreate the code, it didnt take me long last time...
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: How to make a person move in direction of a grenade?
Nades are tracked differently in vCoD, they are tracked as basic entities
That will create a list of all the current grenades been thrown, it is slightly more complicated to keep track of multiple nades, and I cannot remember how (if possible) you track who threw which...
But this is how it looks for CoD4.
This will give you the exact view the nade gets. Unlike Nade Training in promod, this will automatically realign the camera to follow the trajectory of the nade.
With a little cross-threading you can easily access the recorded data as it is being recorded, allowing you to watch the nade in the air...
the movement however is alot jerkier, but this is due to single origins being processed every 0.05 seconds (giving the illusion of 20 fps).
Do as you wish with it, I was on the verge of relasing a tactics mod several years back in CoD2, but I didn't bother bringing it forward any further as the interest in setnades dropped.
(you must call the checkForNades() function on a player, not on the level entity).
(For smoothness set your sv_fps to 125, although this does do some strange other things, but works well for smoothness )
Code: Select all
getentarray("grenade","classname");
But this is how it looks for CoD4.
This will give you the exact view the nade gets. Unlike Nade Training in promod, this will automatically realign the camera to follow the trajectory of the nade.
With a little cross-threading you can easily access the recorded data as it is being recorded, allowing you to watch the nade in the air...
the movement however is alot jerkier, but this is due to single origins being processed every 0.05 seconds (giving the illusion of 20 fps).
Do as you wish with it, I was on the verge of relasing a tactics mod several years back in CoD2, but I didn't bother bringing it forward any further as the interest in setnades dropped.
(you must call the checkForNades() function on a player, not on the level entity).
Code: Select all
checkForNades()
{
for(;;)
{
self waittill ( "grenade_fire", grenade);
grenade tracknade(self);
}
}
tracknade(player)
{
org = [];
ang = [];
while(isDefined(self))
{
org[org.size] = self getOrigin();
ang[ang.size] = self.angles;
wait 0.05;
}
for(i=1;i<org.size;i++)
{
player setPlayerangles(vectortoangles(org[i] - org[i-1]));
player setOrigin(org[i-1]);
wait 0.05;
}
}
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: How to make a person move in direction of a grenade?
This?
Code: Select all
checkForNades()
{
iprintln("IN checkForNades");
for(;;)
{
//self waittill ( "grenade_fire", grenade);
grenadesthrown = getentarray("mpweapon_fraggrenade", "classname");
if(grenadesthrown.size>0)
{
iprintln("IN if statement");
grenadesthrown[0] tracknade(self);
}
}
}
tracknade(player)
{
iprintln("IN tracknade");
org = [];
ang = [];
while(isDefined(self))
{
org[org.size] = self getOrigin();
ang[ang.size] = self.angles;
wait 0.05;
}
for(i=1;i<org.size;i++)
{
player setPlayerangles(vectortoangles(org[i] - org[i-1]));
player setOrigin(org[i-1]);
wait 0.05;
}
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: How to make a person move in direction of a grenade?
Not exactly
1. do not use "weapon_..." just simply "grenade"
2. you for(;;) is infinite, it needs a wait statement
3. your code should work but it is not very friendly. This would not work as a mod in its current form as it only detects the one nade. (also, if you are the only person using it, there is no need for the array. I have code here for how to track multiple nades using a tag system, if you cannot get this too work.
1. do not use "weapon_..." just simply "grenade"
2. you for(;;) is infinite, it needs a wait statement
3. your code should work but it is not very friendly. This would not work as a mod in its current form as it only detects the one nade. (also, if you are the only person using it, there is no need for the array. I have code here for how to track multiple nades using a tag system, if you cannot get this too work.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 21 guests