UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: MJPWGaming on June 20, 2015, 10:14:20 pm

Title: Time Warping Power Up?
Post by: MJPWGaming on June 20, 2015, 10:14:20 pm
Hi I had this idea where if you got a power up that turned everything black and white (sf_use_bw 1) and reduce the zombies timescale? Not the players just the zombies.
Title: Re: Time Warping Power Up?
Post by: DidUknowiPwn on June 21, 2015, 12:58:53 am
Can't slow down time for a specific entity, you can just slow the zombies down using their run variable.
Title: Re: Time Warping Power Up?
Post by: MZslayer11 on June 21, 2015, 02:37:17 am
Could you do what pwn said and slow down the running, walking, grabbing, swiping Anims for the zombies so it looks like slow motion? Not sure if its possible to change the speed of an existing anim, I'm just spitballing here.
Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 21, 2015, 03:57:51 am
Can't slow down time for a specific entity, you can just slow the zombies down using their run variable.

That could work, probably even better. I cant write scripts good though (thats why I come here).

Could you do what pwn said and slow down the running, walking, grabbing, swiping Anims for the zombies so it looks like slow motion? Not sure if its possible to change the speed of an existing anim, I'm just spitballing here.

Interesting. Maybe.

Double Post Merge: June 22, 2015, 01:06:55 am
So I waited a good while for a reply but nothing. I followed this tut to where you can speed up your player for a limited time.

http://ugx-mods.com/forum/index.php?topic=296.0 (http://ugx-mods.com/forum/index.php?topic=296.0)

I was thinking you could add in a timescale piece not too sure. Also need to know how to add in the black and white.

Code Snippet
Plaintext
speed( drop_item, player_won )
{
    level notify ("powerup speed");
    level endon ("powerup speed");
    self iPrintLnBold("^7Speed!!!");
    self setmovespeedscale(2.0);
    wait  15;
self iPrintLnBold("^7NO MORE SPEED!");
    self setmovespeedscale(1.0);
}
Title: Re: Time Warping Power Up?
Post by: Eternal_Fire on June 22, 2015, 09:52:51 am
Dunno about slowing down the zombies but for the black and white thing, i would assume the code should look like this.
Code Snippet
Plaintext
colour_change( drop_item, player_won )
{
    level notify ("powerup colour_change");
    level endon ("powerup colour_change");
    self iPrintLnBold("^7Black And White");
    self SetClientDvars("sf_use_bw", "1");
    wait  15;
self iPrintLnBold("^Normal Colour");
    self SetClientDvars("sf_use_bw", "0");
}

I know that stuffy has a made a script for the nanoswarm grenade from exo zombies which slows them down, so you could ask him
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 22, 2015, 10:36:15 am
Code Snippet
Plaintext
	zombie.moveplaybackrate	
zombie.traverseplaybackrate
zombie.animplaybackrate

Are var's you can set on zombies to defined the playbackspeed of their animations.
So default is 1 and if you lower it, the anim will play slower. I added a similar var to melee.gsc to slow down the melee-anims and that's about it..
Title: Re: Time Warping Power Up?
Post by: Harry Bo21 on June 22, 2015, 12:14:43 pm
also you need to allow for staminup, if you have it
Title: Re: Time Warping Power Up?
Post by: liamsa669 on June 22, 2015, 12:48:48 pm
Hi I had this idea where if you got a power up that turned everything black and white (sf_use_bw 1) and reduce the zombies timescale? Not the players just the zombies.
use the same method as "verruct runners", but instead of rounds, have it check if a variable is set for the powerup, Also export the run animation u want to use and re import it, just change the framerate to be like 15 instead of 30. That would slow the animation down by 2x its normal time
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 22, 2015, 02:40:27 pm
use the same method as "verruct runners", but instead of rounds, have it check if a variable is set for the powerup, Also export the run animation u want to use and re import it, just change the framerate to be like 15 instead of 30. That would slow the animation down by 2x its normal time

Like i mentioned a few posts above, you really dont need to do all that just set these var's to 0.5 and the anim will play at half the speed.. set them at 0.01 to basicly freeze the zombies etc etc..
That's all, these var's are in the game by default..


Code Snippet
Plaintext
	zombie.moveplaybackrate	
zombie.traverseplaybackrate
zombie.animplaybackrate

Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 22, 2015, 10:22:25 pm
Like i mentioned a few posts above, you really dont need to do all that just set these var's to 0.5 and the anim will play at half the speed.. set them at 0.01 to basicly freeze the zombies etc etc..
That's all, these var's are in the game by default..


Code Snippet
Plaintext
	zombie.moveplaybackrate	
zombie.traverseplaybackrate
zombie.animplaybackrate


Thanks! I typed it in and got a bad syntax. I probably typed it wrong.

Code Snippet
Plaintext
time_warp( drop_item, player_won )
{
level notify ("warp");
level endon ("warp");
self iPrintLnBold("^7Time Warp!!!");
self setzombie.moveplaybackrate(0.5);
self setzombie.traverseplaybackrate(0.5);
self setzombie.animplaybackrate(0.5);
self SetClientDvars("sf_use_bw", "1");
wait  60;
self iPrintLnBold("^7NO MORE WARP!");
self setzombie.moveplaybackrate(1);
self setzombie.traverseplaybackrate(1);
self setzombie.animplaybackrate(1);
self SetClientDvars("sf_use_bw", "0");
}
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 22, 2015, 10:38:56 pm
You need to set it to every zomb seperate. And also new ones that spawn in. You prob want to run something like this in a loop:


Code Snippet
Plaintext
Zombs = getaiarray( "axis" );
For( i=0;i<zombs.size;i++)
{
  If( !isdefined( zombs[i].slowmo ) )
  {
     Zombs[i].slowmo = true;
     Zombs[i] thread slow_me_down();
  }
}

And then to slow them down:
Code Snippet
Plaintext
Slow_me_down()
{
 Self.animplaybackrate = 0.3;
... etc
}

Typed this on my phone so, not tested but to give you an idea..
Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 22, 2015, 11:07:13 pm
You need to set it to every zomb seperate. And also new ones that spawn in. You prob want to run something like this in a loop:


Code Snippet
Plaintext
Zombs = getaiarray( "axis" );
For( i=0;i<zombs.size;i++)
{
  If( !isdefined( zombs[i].slowmo ) )
  {
     Zombs[i].slowmo = true;
     Zombs[i] thread slow_me_down();
  }
}

And then to slow them down:
Code Snippet
Plaintext
Slow_me_down()
{
 Self.animplaybackrate = 0.3;
... etc
}

Typed this on my phone so, not tested but to give you an idea..

Typed it like this and still bad syntax. Im sorry Im not too good on scripts haha

Code Snippet
Plaintext
time_warp( drop_item, player_won )
{
level notify ("warp");
level endon ("warp");
self iPrintLnBold("^7Time Warp!!!");

zombs = getaiarray( "axis" );
For( i=0;i<zombs.size;i++)
{
If( !isdefined( zombs[i].slowmo ) )
{
zombs[i].slowmo = true;
zombs[i] thread slow_me_down();
}
}
self SetClientDvars("sf_use_bw", "1");
wait  60;
self iPrintLnBold("^7NO MORE WARP!");
{
If( !isdefined( zombs[i].slowmo ) )
{
zombs[i].slowmo = false;
zombs[i] thread slow_me_down();
}
}
self SetClientDvars("sf_use_bw", "0");
}

slow_me_down()
{
self.moveplaybackrate = 0.3;
self.traverseplaybackrate = 0.3;
self.animplaybackrate = 0.3;
}
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 23, 2015, 05:46:33 am
You forgot a for() loop at the end, also you use SetClientDvars but you only set one Dvar so you prob should use SetClientDvar ( without the 's' in the end )
But also when you do it like you did, new zombies that spawn in after you grabbed the drop will still be normal speed, and the "sf_use_bw" needs to
be called on all players in the game, if it's a clientdvar.
So try something like this:

Code Snippet
Plaintext
time_warp()
{
level notify ("warp");
level endon ("warp");
self iPrintLnBold("^7Time Warp!!!");

players = get_players();
for( i=0 ; i<players.size ; i++ )
{
players[i] SetClientDvar("sf_use_bw", "1");
}

time = 60;

while( time > 0 )
{
zombs = getaiarray( "axis" );
for( i=0 ; i<zombs.size ; i++ )
{
If( !isdefined( zombs[i].slowmo ) )
{
zombs[i].slowmo = true;
zombs[i] thread slow_me_down( true );
}
}

wait 0.5;
time-=0.5;
}

self iPrintLnBold("^7NO MORE WARP!");

zombs = getaiarray( "axis" );
for( i=0 ; i<zombs.size ; i++ )
{
zombs[i] thread slow_me_down( false );
}

players = get_players();
for( i=0 ; i<players.size ; i++ )
{
players[i] SetClientDvar("sf_use_bw", "0");
}
}

slow_me_down( slowmo )
{
if( slowmo )
{
self.moveplaybackrate = 0.3;
self.traverseplaybackrate = 0.3;
self.animplaybackrate = 0.3;
}
else
{
self.slowmo = undefined;
self.moveplaybackrate = 1;
self.traverseplaybackrate = 1;
self.animplaybackrate = 1;
}
}
Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 23, 2015, 07:52:50 pm
You forgot a for() loop at the end, also you use SetClientDvars but you only set one Dvar so you prob should use SetClientDvar ( without the 's' in the end )
But also when you do it like you did, new zombies that spawn in after you grabbed the drop will still be normal speed, and the "sf_use_bw" needs to
be called on all players in the game, if it's a clientdvar.
So try something like this

I got a bad syntax error from that too :(
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 23, 2015, 09:05:10 pm
I got a bad syntax error from that too :(

wtf, i've had this b4 with code that was written on a mobile Phone. Weird..
I just tried and got a bad syntax too. I didn't actually change the script, but i did rewrite it on my pc and now it works for me. When you copy it over, you can see it's the exact same script ??? ???

Code Snippet
Plaintext
time_warp()
{
level notify ("warp");
level endon ("warp");
self iPrintLnBold("^7Time Warp!!!");

players = get_players();
for( i=0 ; i<players.size ; i++ )
{
players[i] SetClientDvar("sf_use_bw", "1");
}

time = 60;

while( time > 0 )
{
zombs = getaiarray( "axis" );
for( i=0 ; i<zombs.size ; i++ )
{
if( !isdefined( zombs[i].slowmo ) )
{
zombs[i].slowmo = true;
zombs[i] thread slow_me_down( true );
}
}

wait 0.5;
time-=0.5;
}

self iPrintLnBold("^7NO MORE WARP!");

zombs = getaiarray( "axis" );
for( i=0 ; i<zombs.size ; i++ )
{
zombs[i] thread slow_me_down( false );
}

players = get_players();
for( i=0 ; i<players.size ; i++ )
{
players[i] SetClientDvar("sf_use_bw", "0");
}
}

slow_me_down( slowmo )
{
if( slowmo )
{
self.moveplaybackrate = 0.3;
self.traverseplaybackrate = 0.3;
self.animplaybackrate = 0.3;
}
else
{
self.slowmo = undefined;
self.moveplaybackrate = 1;
self.traverseplaybackrate = 1;
self.animplaybackrate = 1;
}
}

Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 23, 2015, 09:50:09 pm
wtf, i've had this b4 with code that was written on a mobile Phone. Weird..
I just tried and got a bad syntax too. I didn't actually change the script, but i did rewrite it on my pc and now it works for me. When you copy it over, you can see it's the exact same script ??? ???

iT WORKS! BUT it stays black and white :/
Title: Re: Time Warping Power Up?
Post by: BluntStuffy on June 23, 2015, 09:56:05 pm
iT WORKS! BUT it stays black and white :/

Uhm, not sure.. never used the b/w before myself. Do the zombies return to normal speed? And does the end-text print on screen?
Title: Re: Time Warping Power Up?
Post by: MJPWGaming on June 23, 2015, 10:11:50 pm
Uhm, not sure.. never used the b/w before myself. Do the zombies return to normal speed? And does the end-text print on screen?

Yes all that works :) Except the text is just filler for now (untill I figure out how to add in the shader from my other post in scripting)