Game Development Community

Torque setting logos count cheat code

by Skye T · in Torque 3D Professional · 02/13/2016 (5:07 am) · 1 replies

Hi , I have a basic game which requires collecting all the logos to go to the next stage. For testing purposes, I'm trying to write a cheat code in default.bind.cs
But I have no idea how to do that.
How do I set logoCount=0 and link from logo item.cs?

Please help me

About the author

Recent Threads

  • Torque game engine GUI

  • #1
    02/17/2016 (7:57 am)
    Hey Skye!

    Generally speaking, gameplay code is handled on the server side of things, so you'll need to have a keybind or function that can be called on the client side that informs the server of what's going on.

    To do that, you'll want to look at commandToServer and serverCmd* functions in the scripts. There are a bunch of examples, but the basic setup would be this:

    function activateCheating()
    {
       commandToServer('startCheating');
    }

    And then in the server scripts somewhere, you'd have:

    function serverCmdStartCheating(%client)
    {
       //do the cheat logic here
    }

    The way the commandToServer(and commandToClient) work is they send a net event to the respective target and automagically call a serverCmd[theFunctionWePassedIn]() with the first var in the serverCmd arguments being the client that sent it.

    This way, you can set whatever values you need to when you press a button or whatnot.