Jump to content

Coding for Bullet Time (slow motion)?


danjako43

Recommended Posts

I don't know where to start. Can someone instruct me how to do this? I don't know what code GTA IV uses now that Alice (lua code mod) doesn't work for patch 1.0.7.0

 

I heard there's a C++ "scripthook." Can I code bullet time with that? I mean, it'd go like this (in half-assed coding language. This isn't even a code, but it's just to get the general idea, easy with C++, LUA too):

 

 

Import whatever package;Define timescale;Assign V as input button;{If (V is pressed AND timescale = 1.0)timescale = .3;else if (V is pressed AND timescale = .3)timescale = 1.0;}

 

 

I haven't coded in C++ since 6 or so years ago, so don't mind the badness in the code segment.

 

To be honest, I don't even know the "frame" code to get things to work in C++ for GTA IV.

 

Someone help please.

Link to comment
Share on other sites

lindsayslorach

If you havn't done C++ in a few years, could you try C#? Using the .Net ScriptHook, there is an IRC channel you can join, there are a few people in there that can help you (click my signature).

 

Here's what I would do:

 

using System.Windows.Forms;using GTA;namespace SlowMotion{   public class SlowMotionScript : Script   {       private bool slowMotionEnabled = false;       public SlowMotionScript()       {           this.BindKey(Keys.V, this.ToggleSlowMotion);       }       private void ToggleSlowMotion()       {           this.slowMotionEnabled = !this.slowMotionEnabled;           if (this.slowMotionEnabled)           {               Game.TimeScale = 0.3f;           }           else           {               Game.TimeScale = 1f;           }       }   }}

 

 

I havn't tested it, but I think it'll work.

Link to comment
Share on other sites

What's the difference between the two?

 

Why script in .net while there's already C++? Is it for ease of scripting? Or less crashes?

 

Most mods use C++ Scripthook. I don't wanna have .net scripthook AND C++ scripthook in the GTA IV folder. It might get funky when I have alot of mods. conflicts and whatnot.

Link to comment
Share on other sites

 

What's the difference between the two?

 

Why script in .net while there's already C++? Is it for ease of scripting? Or less crashes?

 

Most mods use C++ Scripthook. I don't wanna have .net scripthook AND C++ scripthook in the GTA IV folder. It might get funky when I have alot of mods. conflicts and whatnot.

Nah, it does not and .NET has easier accesible functions to, for example, take a whole group of peds. In ScriptHook you'll need some assembly and sh*t.

 

It's up to you, but you'll find .NET easier to use and getting world peds, cars and object is less of a pain in the butt. That's the problem I now have.

Link to comment
Share on other sites

There are two types of files for the .net scripthook, cs and vb, what's the difference? What are they?

Link to comment
Share on other sites

motorsport71

@danjako43

 

*.vb - for plain VisualBasic.Net scripts

*.cs - for plain C# scripts

*.net - for compiled scripts in any .Net language

*.net.dll - for compiled scripts in any .Net language

 

 

This is straight from Hazardx's .net scripthook documentation, here's the link. It'll probably help.

 

http://www.gtaforums.com/index.php?showtopic=392325&st=0

 

Link to comment
Share on other sites

Is there a list of commands in C#? like what does what?

 

Also, if i want to make a bullet time script, would i need a .cs or a .vb file?

Link to comment
Share on other sites

you start in notepad for example and save it as .cs or .vb, it will act just like a text file, uncompiled script.

Link to comment
Share on other sites

Is there a list of commands in C#? like what does what?

 

Also, if i want to make a bullet time script, would i need a .cs or a .vb file?

Go to "Grand Theft Auto IV\scripts\for Developers" and look in the file called "GTA IV ScriptHook.Net Documentation.chm". You could also use Visual Studio to make coding easier.

 

If you're coding in C#, you'll need to make a .cs file. And if you're coding in Visual Basic.NET, you'll need a .vb file.

Link to comment
Share on other sites

  • 2 months later...

Is there a C++ version?

 

Does LUA work (ALICE)? has it been updated? It's been so long...I love LUA, it's so simple.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.