Boost / Throw?

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
acedlol
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: August 7th, 2011, 10:41 am

Boost / Throw?

Post by acedlol » October 31st, 2011, 5:47 pm

Im looking for the best way to script to throw/launch a player when they enter a trigger. (or another way :>)

A really good working one is in the map mp_wireframe_r4, where if you step on something it will literally "throw" you or launch you up a slide. I think there is some serious potential for this, not only in aim maps for promod people, but to try and get some new maps for codjumper.

There are several possible ways, however I would like your guidance as I'm not sure which one would be the best way for doing this.

MoveGravity( <initial velocity>, <time> ) ? Seems the obvious choice, however don't see how to change direction? :D

MoveX( <xvalue>, <time>, <acceleration time>, <deceleration time> ) Perhaps move to a point just beyond the trigger at ridiculous speed? Its more complicated.

Or perhaps a completely different way?

I'm asking here because I have so many projects on the go such as aim maps, an invisiblemen map, a minigames map, and perhaps even some different styled jump maps, and so little time to do any of them due to real life. So if anybody has a working script or knows a sure way to do it, it would be greatly appreciated :>

Vartazian
CJ Worshipper
CJ Worshipper
Posts: 286
Joined: June 10th, 2011, 9:14 pm

Re: Boost / Throw?

Post by Vartazian » October 31st, 2011, 7:45 pm

my new map is almost done, and it has 2 scripts like this ^^ but i didn't make them, i got them from a friend :D

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Boost / Throw?

Post by IzNoGoD » October 31st, 2011, 11:33 pm

use the damage thingy.
It gives a big amount of damage with a positive aimed vector, so the player gets propelled upwards.
LMGTFY!

Its not a glitch... Its the future!

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Boost / Throw?

Post by <LT>YosemiteSam[NL] » November 1st, 2011, 12:34 am

waywaaaard made jump pads in CoD2 I think it works pretty much the same in CoD4.
Ask him.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Boost / Throw?

Post by megazor » November 1st, 2011, 6:22 am

MoveGravity( <initial velocity>, <time> ) ? Seems the obvious choice, however don't see how to change direction
'initial velocity' is to be a vector, so you can change direction.

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Boost / Throw?

Post by IzNoGoD » November 1st, 2011, 9:37 am

megazor wrote:
MoveGravity( <initial velocity>, <time> ) ? Seems the obvious choice, however don't see how to change direction
'initial velocity' is to be a vector, so you can change direction.
Ye, but you cannot change direction+you have to link a player+it doesnt stop when you hit anything.
LMGTFY!

Its not a glitch... Its the future!

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Boost / Throw?

Post by megazor » November 1st, 2011, 10:43 am

why cant i change direction? u mean after having been launched? you are right then. well, damage is much better, i personally use it. but sometimes its so funny when you are going through walls, i do that to players on my server :)

Rich
CJ Wannabe
CJ Wannabe
Posts: 18
Joined: October 24th, 2010, 11:52 pm

Re: Boost / Throw?

Post by Rich » November 1st, 2011, 5:36 pm

I'm making a map with ramps and boosters, I use FinishPlayerDamage().

acedlol
CJ Wannabe
CJ Wannabe
Posts: 5
Joined: August 7th, 2011, 10:41 am

Re: Boost / Throw?

Post by acedlol » December 28th, 2011, 12:17 pm

Rich wrote:I'm making a map with ramps and boosters, I use FinishPlayerDamage().
Aah, thats helpful. So you would use a trigger, when trigger is activated, you would do this

self FinishPlayerDamage

But how do you inflict damage without hurting them, and I dont understand what form the vector should be in. Could you give me an example ? :D

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Boost / Throw?

Post by waywaaaard » December 28th, 2011, 12:47 pm

should do the trick

Code: Select all

 
self waittill("trigger", player);
                player playsound("jump_pad");
                for(i = 0; i < 9; i++){
                        power = 150;
                        player.health = player.health + power;
                        eInflictor = player;
                        eAttacker = player;
                        iDamage = power;
                        iDFlags = 0;
                        sMeansOfDeath = "MOD_PROJECTILE";
                        sWeapon = "panzershreck_mp";
                        vPoint = ( player.origin + (0,0,-1) );
                        vDir = vectornormalize( player.origin - vPoint );
                        sHitLoc = "none";
                        psOffsetTime = 0;
 
                        player finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
                }
                wait(0.5);
 
or if you want to use a target height (script_origin connected to the trigger)

Code: Select all

 
bounce_jump(){
        while(1){
                self waittill("trigger", player);
                tar = self.target;
                
                target = getEnt(tar, "targetname");
                height = 0;
                count = 0;
                
                while((player.origin[2] < target.origin[2])){
                        power = 75;
                        player.health = player.health + power;
                        eInflictor = player;
                        eAttacker = player;
                        iDamage = power;
                        iDFlags = 0;
                        sMeansOfDeath = "MOD_PROJECTILE";
                        sWeapon = "panzershreck_mp";
                        vPoint = ( player.origin + (0,0,-1) );
                        vDir = vectornormalize( player.origin - vPoint );
                        sHitLoc = "none";
                        psOffsetTime = 0;
 
                        player finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
 
                        height = player.origin[2];
                        count++;
                        wait(0.01);
                        if(player.origin[2] >= target.origin[2]){
                                break;
                        }
                        
                }
                wait(0.5);
        }
}
 
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

freak720
CJ Wannabe
CJ Wannabe
Posts: 9
Joined: April 21st, 2010, 6:16 pm

Re: Boost / Throw?

Post by freak720 » February 16th, 2012, 11:24 pm

Hey i tried to take that code for my map, but it won't work...i'm not that familiar in scripting so perhaps i made a mistake...i made a trigger_multiple: targetname = trigger1

and my gsc file looks like that:

Code: Select all

main()
{
        maps\mp\_load::main();

   thread trigger1();

    ambientPlay("ambient_crossfire");

    game["allies"] = "marines";
    game["axis"] = "opfor";
    game["attackers"] = "axis";
    game["defenders"] = "allies";
    game["allies_soldiertype"] = "desert";
    game["axis_soldiertype"] = "desert";
   
    setdvar( "r_specularcolorscale", "2" );
   
    setdvar("compassmaxrange","1800");
}

trigger1() {

trigger = getent ("trigger1", "targetname");
self waittill("trigger", player);
                player playsound("jump_pad");
                for(i = 0; i < 9; i++){
                        power = 150;
                        player.health = player.health + power;
                        eInflictor = player;
                        eAttacker = player;
                        iDamage = power;
                        iDFlags = 0;
                        sMeansOfDeath = "MOD_PROJECTILE";
                        sWeapon = "panzershreck_mp";
                        vPoint = ( player.origin + (0,0,-1) );
                        vDir = vectornormalize( player.origin - vPoint );
                        sHitLoc = "none";
                        psOffsetTime = 0;
 
                        player finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
                }
                wait(0.5);
}
or without this line: trigger = getent ("trigger1", "targetname");
both won't work.

best regards

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Boost / Throw?

Post by Drofder2004 » February 16th, 2012, 11:55 pm

Code: Select all

self waittill(

Code: Select all

trigger waittill
Image
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

freak720
CJ Wannabe
CJ Wannabe
Posts: 9
Joined: April 21st, 2010, 6:16 pm

Re: Boost / Throw?

Post by freak720 » February 17th, 2012, 1:02 am

Thank you very much drofder it's working now but only for 1 time do you know why? What have I to change that a player can more than just 1 time use that boost?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Boost / Throw?

Post by Drofder2004 » February 18th, 2012, 1:10 am

Code: Select all

trigger1() {
 
   trigger = getent ("trigger1", "targetname");
 
   while(1)
   {
      self waittill("trigger", player);
      player playsound("jump_pad");
      for(i = 0; i < 9; i++)
      {
         power = 150;
         player.health = player.health + power;
         eInflictor = player;
         eAttacker = player;
         iDamage = power;
         iDFlags = 0;
         sMeansOfDeath = "MOD_PROJECTILE";
         sWeapon = "panzershreck_mp";
         vPoint = ( player.origin + (0,0,-1) );
         vDir = vectornormalize( player.origin - vPoint );
         sHitLoc = "none";
         psOffsetTime = 0;
 
         player finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
      }
 
      wait(0.5);
   }
}
Image
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

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests