Page 1 of 1

Boost / Throw?

Posted: October 31st, 2011, 5:47 pm
by acedlol
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 :>

Re: Boost / Throw?

Posted: October 31st, 2011, 7:45 pm
by Vartazian
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

Re: Boost / Throw?

Posted: October 31st, 2011, 11:33 pm
by IzNoGoD
use the damage thingy.
It gives a big amount of damage with a positive aimed vector, so the player gets propelled upwards.

Re: Boost / Throw?

Posted: November 1st, 2011, 12:34 am
by <LT>YosemiteSam[NL]
waywaaaard made jump pads in CoD2 I think it works pretty much the same in CoD4.
Ask him.

Re: Boost / Throw?

Posted: November 1st, 2011, 6:22 am
by megazor
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.

Re: Boost / Throw?

Posted: November 1st, 2011, 9:37 am
by IzNoGoD
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.

Re: Boost / Throw?

Posted: November 1st, 2011, 10:43 am
by megazor
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 :)

Re: Boost / Throw?

Posted: November 1st, 2011, 5:36 pm
by Rich
I'm making a map with ramps and boosters, I use FinishPlayerDamage().

Re: Boost / Throw?

Posted: December 28th, 2011, 12:17 pm
by acedlol
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

Re: Boost / Throw?

Posted: December 28th, 2011, 12:47 pm
by waywaaaard
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);
        }
}
 

Re: Boost / Throw?

Posted: February 16th, 2012, 11:24 pm
by freak720
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

Re: Boost / Throw?

Posted: February 16th, 2012, 11:55 pm
by Drofder2004

Code: Select all

self waittill(

Code: Select all

trigger waittill

Re: Boost / Throw?

Posted: February 17th, 2012, 1:02 am
by freak720
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?

Re: Boost / Throw?

Posted: February 18th, 2012, 1:10 am
by Drofder2004

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);
   }
}