Scripting Help

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

Moderator: Core Staff

paintlax21
CJ Donator
CJ Donator
Posts: 52
Joined: August 10th, 2009, 5:20 pm

Scripting Help

Post by paintlax21 » July 28th, 2011, 5:03 pm

I am trying to recreate a map like this:



Basically the user is being pushed forward along a level area and all they can do is strafe left and right and jump. They cannot go back and they are constantly moving forward no matter what. I don't know how to script something like this without moving the floor itself.

All help is appreciated :D

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: Scripting Help

Post by Nekoneko » July 28th, 2011, 5:51 pm

only way to push someone forward in mp i think is to damage him.
Also have slippery floors, then it should be like in mp_sonic.

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Scripting Help

Post by F |Madness| U » July 28th, 2011, 6:28 pm

Couldn't you just do an infinite loop giving each player an X or Y velocity of 100 every 0.01secs whilst they are on the trigger. (The `slide floor` would have to be in exactly the X or Y direction). Don't see why it wouldn't work and pretty easy to script.
-

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: Scripting Help

Post by Nekoneko » July 28th, 2011, 7:01 pm

the only way to give them velocity is by damaging them.
But KS way is probably the lest glitchy one, since it's impossible to move backwards then.

paintlax21
CJ Donator
CJ Donator
Posts: 52
Joined: August 10th, 2009, 5:20 pm

Re: Scripting Help

Post by paintlax21 » July 28th, 2011, 7:27 pm

Is there a way to do it similar to mp_sonic where you hit the trigger and go?

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Scripting Help

Post by F |Madness| U » July 28th, 2011, 8:47 pm

Nekoneko wrote:the only way to give them velocity is by damaging them.
But KS way is probably the lest glitchy one, since it's impossible to move backwards then.
setVelocity() gives them velocity. If you work out the velocity lost every 0.01 secs or so, just do setVelocity(getVelocity() + (X,Y,Z)).
-

User avatar
Opel
CJ Fan
CJ Fan
Posts: 188
Joined: September 15th, 2008, 12:28 pm
Location: Scotland

Re: Scripting Help

Post by Opel » July 28th, 2011, 9:27 pm

SetVelocity is singleplayer only function i believe in cod4.

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: Scripting Help

Post by Nekoneko » July 28th, 2011, 9:48 pm

Oh, sure if that is a single player map.
Thought it should be mp somehow xD

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Scripting Help

Post by F |Madness| U » July 28th, 2011, 10:06 pm

I would've thought its a mp function, seen some cod4 mods with stuff I could only think would be done with setVelocity(). I know it's defeinitely mp function in BO.
-

paintlax21
CJ Donator
CJ Donator
Posts: 52
Joined: August 10th, 2009, 5:20 pm

Re: Scripting Help

Post by paintlax21 » July 29th, 2011, 12:14 am

Can someone give me an example of how I would use this setvelocity script just to see if it does indeed work in MP

EDIT:: setvelocity doens't work on MP, i tested it. can someone help me duplicate the sonic script?

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Scripting Help

Post by _DanTheMan_ » July 29th, 2011, 1:23 am

KillerSam's method would probably be best if you want the player to go around turns and such, but here is the (slightly edited) Sonic script: Pastebin link

Every time you want to boost a player, you would thread the function speed( [player entity here] );
Keep in mind you'll want to edit the [DAMAGE ORIGIN] and [DAMAGE DIRECTION], which are both (x, y, z) vectors.

You may or may not need the admin portion of the script, but when Sonic was made, admin players could not be boosted from damage.

For the slippery part of the slide, you need to find a pre-existing material that lets a player slide on it, or make your own with these settings.
Image

paintlax21
CJ Donator
CJ Donator
Posts: 52
Joined: August 10th, 2009, 5:20 pm

Re: Scripting Help

Post by paintlax21 » July 29th, 2011, 1:37 am

If I want the player to move in the Y direction what would the origin and direction? (0,1,0)?

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Scripting Help

Post by _DanTheMan_ » July 29th, 2011, 1:48 am

The origin would be (0, 0, 0), and yes, the direction (0, 1, 0) should make the player go forward on the Y axis.
Image

paintlax21
CJ Donator
CJ Donator
Posts: 52
Joined: August 10th, 2009, 5:20 pm

Re: Scripting Help

Post by paintlax21 » July 29th, 2011, 2:00 am

I get this error:

Attempted to overrun string in call to va()

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Scripting Help

Post by _DanTheMan_ » July 29th, 2011, 2:11 am

For some reason, I have always gotten that error whenever I use the CJ mod offline, so I don't know how to fix it. You could use a different mod, or maybe someone else knows how to fix it.
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests