PDA

View Full Version : [Tut-Request] Jump-Pad



STAUFFi
24th October 2012, 09:11
Hey Guys, i need Help :(...

I want make a Jump Room
on a Texture in the JUmp Room i can there automatically.
Kung told me i need a trigger and so ?
How i can create it ??
KUNG PLS MAKE A TUT FOR ME AND OTHER PEOPLE :P

Killer.Pro
24th October 2012, 12:07
I would like to help but I don't seem to understand your problem..can you explain it :D

STAUFFi
24th October 2012, 12:20
i want make a room :P
With JUMP POWER (automatically jump) when you press spacer :D

Killer.Pro
24th October 2012, 15:17
Hey,
I made something as you wanted but I want it to be more good so I'll tell you tomorrow..

kung foo man
24th October 2012, 16:22
(I've installed the GD-module now, so we can use upload pictures to the forum now :D)

Preview-Test with 34FPS:

36

mp_jumppad.gsc



bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PROJECTILE", "panzerschreck_mp", undefined, pos, "none", 0 );
self.health = oldhp;
}

jumppad_think()
{
jumppad = self;
while (1)
{
jumppad waittill("trigger", player);

if (!isDefined(player.lastJump))
player.lastJump = 0;

//iprintlnbold(getTime() - player.lastJump);
if (getTime() - player.lastJump <= 1000)
{
wait 0.05;
continue;
}
player.lastJump = getTime();

player iprintlnbold("^1~^7JUMP^1~");
player bounce((0,0,1), 1000);
player bounce((0,0,1), 1000);
player bounce((0,0,1), 1000);
player bounce((0,0,1), 1000);
player bounce((0,0,1), 1000);
player bounce((0,0,1), 1000);
wait 0.05;
}
}

initJumppads()
{
jumppads = getEntArray("jumppad", "targetname");
for (i=0; i<jumppads.size; i++)
jumppads thread jumppad_think();
}

main()
{
initJumppads();
}


mp_jumppad.map as attachment

The IWD (only maps/mp/mp_jumppad.d3dbsp): [I]-> 37 <-

Killer.Pro
25th October 2012, 04:13
-.- I wanted to do the same thing :D well then i'll do it in tutorials :D I have almost same script as kung but mine is opposite -.- isn't it upside down kung?

kung foo man
25th October 2012, 09:02
isn't it upside down kung?


You mean, you have main() on top? I guess thats an old habit made by C/C++ for me. There you can do:
- either write the used functions before they are actually used
- or predefine functions, so the compiler already knows about them (will result in extra-code, I try to circumvent that (only do it for external code))

codscript is "only" a scripting-engine, so it doesnt care about the order. But I guess it is also nice for the reading human: he will know about a function, which is called later (just a guess :D).


Yeah, would be nice for tutorial section :)

Loveboy
14th January 2013, 16:38
kung can you make half of power jump? its too high :D

Jeplaa
14th January 2013, 16:44
Loveboy just remove some lines and that's all :)


player bounce((0,0,1), 1000);

serthy
14th January 2013, 20:19
straight up:
dir = ( 0 , 0 , 1 );
define a dir and jump in the desired direction:
dir = vectorNormalize( jumppad.dir_obect.origin - jumppad.origin );
would look like (teddy = jumppad.dir_obect ):>>>VIDEO<<< (http://beta.xfire.com/videos/5d5d6e)

kung foo man
15th January 2013, 05:57
When i want to watch the video, it says: "Error loading media: File could not be played" on Chrome, and Firefox is just showing a black screen. :confused:

serthy
15th January 2013, 08:47
mhh, its a beta xf video url: http://beta.xfire.com/videos/5d5d6e
maybe classic xf:http://classic.xfire.com/video/5d5d6e/

kat_
5th March 2013, 16:17
multiple trigger(trigger->multiple)
script->origin



main()
{

thread OnPlayerConnect();

}


OnPlayerConnect()
{

jump = getEntArray("TRIGGER_NAME","targetname");
if(isDefined(jump))
for(kat=0;kat<jump.size;kat++)
jump[kat] thread bounceJump();
}


bounceJump()
{
target = getEnt("ORIGIN_NAME","targetname") getOrigin();

while(1)
{
self waittill("trigger", user);
model = spawn("script_model",(0,0,0));
model.origin=user.origin+(randomInt(90),randomInt( 10),0);
model.angles=user.angles;
user linkto(model);
model moveTo(target, 1);
model waittill("movedone");
user unlink();
model delete();
}
}

kung foo man
5th March 2013, 17:49
Hey, you can add
around your code to make it nice:




jump = getEntArray("TRIGGER_NAME","targetname");
if(isDefined(jump))
for(kat=0;kat<jump.size;kat++)
jump[kat] thread bounceJump();

bounceJump()
{
target = getEnt("ORIGIN_NAME","targetname") getOrigin();

while(1)
{
self waittill("trigger", user);
model = spawn("script_model",(0,0,0));
model.origin=user.origin+(randomInt(90),randomInt( 10),0);
model.angles=user.angles;
user linkto(model);
model moveTo(target, 1);
model waittill("movedone");
user unlink();
model delete();
}
}

omnimouz
14th May 2013, 12:41
Anyone able to know why this isn't working on cod4?

Doesn't give me any errors, just does bounce me in the position.

I tried putting "self iprintlnbold("test");" to see if it is using the thread and it shows, but bounces don't work.

kung foo man
14th May 2013, 13:05
My script got "panzerschreck_mp" as weapon, you should replace it with some CoD4-weapon like "deserteaglegold_mp".





bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PROJECTILE", "deserteaglegold_mp", undefined, pos, "none", 0 );
self.health = oldhp;
}




No clue if thats a real stock weapon, I just found that.

omnimouz
14th May 2013, 13:18
bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PISTOL_BULLET", "deserteagle_mp", undefined, pos, "torso_upper"], 0 );
self.health = oldhp;
}


Doesn't work either

serthy
14th May 2013, 13:53
bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PISTOL_BULLET", "deserteagle_mp", undefined, pos, "torso_upper"], 0 );
self.health = oldhp;
}


Doesn't work either

1. your sMeasnOfDeath "MOD_PISTOL_BULLET" needs to be one of them: MOD_PROJECTILE MOD_PROJECTILE_SPLASH MOD_GRENADE MOD_GRENADE_SPLASH
2. syntax error: "torso_upper"]

omnimouz
14th May 2013, 14:07
No syntax error for me using "torso_upper"

"MOD_PISTOL_BULLET" is fine if you're using deagle I thought, as is "MOD_RIFLE_BULLET" for scopes? I also tried with "MOD_PROJECTILE" using rpg_mp but didn't work.

serthy
14th May 2013, 15:04
No syntax error for me using "torso_upper"

"MOD_PISTOL_BULLET" is fine if you're using deagle I thought, as is "MOD_RIFLE_BULLET" for scopes? I also tried with "MOD_PROJECTILE" using rpg_mp but didn't work.

on JUMPPADS u have to use a sMeansOfDeath that will bounce you back! ergo an explosive one (try the splash)!

and the syntax error was the ']' behind your "torso_upper"

omnimouz
14th May 2013, 22:13
Didn't seem to work with that either, have you gotten this working on cod4 and tested it? Assuming since there are no errors, it should be working though..

Tally
15th May 2013, 05:56
on JUMPPADS u have to use a sMeansOfDeath that will bounce you back! ergo an explosive one (try the splash)!

and the syntax error was the ']' behind your "torso_upper"

There is no "torso_upper" bone in COD4. This is a complete list of tags and bones in COD4:


NUMBONES 85
"tag_origin"
"j_mainroot"
"tag_sync"
"pelvis"
"j_hip_le"
"j_hip_ri"
"torso_stabilizer"
"j_hiptwist_le"
"j_hiptwist_ri"
"j_knee_le"
"j_knee_ri"
"j_spinelower"
"back_low"
"j_ankle_le"
"j_ankle_ri"
"j_knee_bulge_le"
"j_knee_bulge_ri"
"j_ball_le"
"j_ball_ri"
"j_spineupper"
"tag_stowed_deploy"
"back_mid"
"j_spine4"
"tag_stowed_backpack"
"j_clavicle_le"
"j_clavicle_ri"
"j_neck"
"j_shoulderraise_le"
"j_shoulderraise_ri"
"tag_inhand"
"tag_stowed_back"
"tag_stowed_lethal"
"tag_stowed_tactical"
"tag_weapon_chest"
"j_shoulder_le"
"j_shoulder_ri"
"neck"
"j_elbow_bulge_le"
"j_elbow_le"
"j_head"
"j_shouldertwist_le"
"shoulder"
"head"
"j_elbow_bulge_ri"
"j_elbow_ri"
"j_shouldertwist_ri"
"j_wrist_le"
"j_wristtwist_le"
"j_head_end"
"j_index_le_1"
"j_jaw"
"j_mid_le_1"
"j_pinky_le_1"
"j_ring_le_1"
"j_thumb_le_1"
"j_wrist_ri"
"j_wristtwist_ri"
"tag_weapon_left"
"j_helmet"
"j_index_le_2"
"j_index_ri_1"
"j_mid_le_2"
"j_mid_ri_1"
"j_pinky_le_2"
"j_pinky_ri_1"
"j_ring_le_2"
"j_ring_ri_1"
"j_thumb_le_2"
"j_thumb_ri_1"
"tag_weapon_right"
"j_index_le_3"
"j_index_ri_2"
"j_mid_le_3"
"j_mid_ri_2"
"j_pinky_le_3"
"j_pinky_ri_2"
"j_ring_le_3"
"j_ring_ri_2"
"j_thumb_le_3"
"j_thumb_ri_2"
"j_index_ri_3"
"j_mid_ri_3"
"j_pinky_ri_3"
"j_ring_ri_3"
"j_thumb_ri_3"


Use one of them instead.

Tally
15th May 2013, 06:05
Anyone able to know why this isn't working on cod4?

Doesn't give me any errors, just does bounce me in the position.

I tried putting "self iprintlnbold("test");" to see if it is using the thread and it shows, but bounces don't work.

This should work in COD4:


bounceJump()
{
target = getEnt( "ORIGIN_NAME", "targetname" );

while( 1 )
{
self waittill( "trigger", user );

if( isPlayer( user ) && user isTouching( self ) )
{
ent = spawn( "script_origin", (0,0,0) );
ent.origin = user.origin+( randomInt(90), randomInt(10), 0 );
ent.angles = user.angles;
user linkto( ent );
ent moveTo( target.origin, 1 );
wait( 1.5 );
user unlink();
ent delete();
}
}
}


Just a couple of notes:

1. In COD4 MP, the motion flag - waittill( "movedone" ) - does not work. Just put in a bog standard wait time.
2. If you are linking a player to a model in COD4, you have to set a model. Usually, the model "tag_origin" is used. This is already compiled into the stock fastfiles, just make sure you precache it. If you don't want to set a model, just use a script_origin.

kung foo man
15th May 2013, 11:39
Though thats not "free", you can't move in air with movement-keys. I've added velocity-functions in my extension for that: http://killtube.org/showthread.php?1373-Extension-Velocity&p=5593

omnimouz
15th May 2013, 19:23
There is no "torso_upper" bone in COD4.

"torso_upper" is used in promod, which is what I'm trying to get it work in

Tally
15th May 2013, 20:01
"torso_upper" is used in promod, which is what I'm trying to get it work in

Sorry, I see this is to register a hit location, in which case torso_upper is a valid sHitLoc. These are the valid sHitLocs in COD4:


getHitLocHeight( sHitLoc )
{
switch( sHitLoc )
{
case "helmet":
case "head":
case "neck":
return 60;
case "torso_upper":
case "right_arm_upper":
case "left_arm_upper":
case "right_arm_lower":
case "left_arm_lower":
case "right_hand":
case "left_hand":
case "gun":
return 48;
case "torso_lower":
return 40;
case "right_leg_upper":
case "left_leg_upper":
return 32;
case "right_leg_lower":
case "left_leg_lower":
return 10;
case "right_foot":
case "left_foot":
return 5;
}
return 48;
}


These are areas in the hit boxes.

EDIT -

Looking at your script again, I see this:


bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PISTOL_BULLET", "deserteagle_mp", undefined, pos, "torso_upper"], 0 );
self.health = oldhp;
}


You have a square brace after "torso_upper" - "torso_upper"]

serthy pointed it out to you, but you blew him off. Best to take notice if someone points out a scripting error. Otherwise we will be here all year.

Earliboy
16th May 2013, 01:08
Its may an idea to remove the Damagefeedback at this part (red screen). Would look more "realistic" (ye, jump pad - realistic :D nvm).

omnimouz
16th May 2013, 01:44
EDIT -

Looking at your script again, I see this:


bounce( pos, power )
{
oldhp = self.health;
self.health = self.health + power;
self finishPlayerDamage( self, self, power, 0, "MOD_PISTOL_BULLET", "deserteagle_mp", undefined, pos, "torso_upper"], 0 );
self.health = oldhp;
}


You have a square brace after "torso_upper" - "torso_upper"]

serthy pointed it out to you, but you blew him off. Best to take notice if someone points out a scripting error. Otherwise we will be here all year.

I noticed it before he even posted.

serthy
16th May 2013, 08:43
I noticed it before he even posted.

yeah, hell, and my crystal ball has shown me that times before you even thought about it...srsly...
bounce() is working as it should, you should only change arguments in there if you know what they do.