Post: [Full Tutorial] How To Make DVAR's Editable In-Game
06-07-2010, 10:24 PM #1
Fionn
Banned
(adsbygoogle = window.adsbygoogle || []).push({}); Ok. I Know I got this idea from someone else. But this is showing you how to make your own editable Dvar's.
First of all , You will need this code at the start of every code.
I am doing JumpHeight here for example.
    doJumpHeight()
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );
for ( ;; ) {


That is needed for every code.
The next part is what button this is binded to.
    self waittill( "dpad_down" );

That is binded to Down on the Dpad. Pretty obvious.

Next , We will get the JumpHeight dvar which is:
    setDvar( "jump_height", "30" );


30 is the default Jump height in which the game starts off with.
We can make this so we can go up 50 or 100 or any number each time down is pressed. I'll do 100 for this.
You can have some text on your screen to show what height your at like:
    self iPrintlnBold("Jump Height now at "30");

(This is only optional though)

So Know , Our code is:
    doJumpHeight()
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );
for ( ;; ) {
self waittill( "dpad_down" );
setDvar( "jump_height", "30" );
self iPrintlnBold("Jump Height now at 30");


This is pretty straight forward from here. We just keep adding how much we want on per press of the button.
So we could do this:
                    self waittill( "dpad_down" );
setDvar( "jump_height", 130 );
self iPrintlnBold("Jump Height now at 130")


So now our full code would be:
    doJumpHeight()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );
for ( ;; ) {
self waittill( "dpad_down" );
setDvar( "jump_height", "30" );
self iPrintlnBold("Jump Height now at 30");

self waittill( "dpad_down" );
setDvar( "jump_height", "130" );
self iPrintlnBold("Jump Height now at 130");

self waittill( "dpad_down" );
setDvar( "jump_height", "230" );
self iPrintlnBold("Jump Height now at 230");
}
}


And we could keep going to the max , which is 999.
Pretty easy and I hope this tutorial would help you.
Here are a list of some other Dvars that could work:
    self setclientDvar( "compassSize", "1" );
self setClientDvar( "g_speed", "999" );
setDvar( "g_gravity ", "800" );
setDvar( "timescale", "1" );


I have not tested these , But I assume these work.

Thanks Fionn.
Last edited by Fionn ; 06-08-2010 at 08:44 PM.

The following 3 users say thank you to Fionn for this useful post:

Grodusk, Killakk, v iBaDGaMeR o
06-08-2010, 03:01 PM #11
shiver
chaos personified
Originally posted by Fionn
    doJumpHeight()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );
for ( ;; ) {
self waittill( "dpad_down" );
setDvar( "jump_height", "30" );
self iPrintlnBold("Jump Height now at 30");

self waittill( "dpad_down" );
setDvar( "jump_height", "130" );
self iPrintlnBold("Jump Height now at 130");

self waittill( "dpad_down" );
setDvar( "jump_height", "230" );
self iPrintlnBold("Jump Height now at 230");
}
}


Sorry. Bad coding :(


You forgot the { at the top too....

Fixed the " error on the last line as well.
Last edited by AlphaDenver ; 06-08-2010 at 06:03 PM.
06-08-2010, 05:53 PM #12
Grodusk
Gym leader
sick shit, thx for sharing Happy
06-08-2010, 06:06 PM #13
Fionn
Banned
No Problem Happy
06-08-2010, 08:02 PM #14
This is nearly as 1337 as me !

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo