Author Topic: Cheats using scripts?  (Read 2128 times)

0 Members and 1 Guest are viewing this topic.

Cheats using scripts?
I'm currently working on making some missions, before actually diving into modding. However, I'm using the cheats a lot to test the missions safely (and yes, to have some fun now and again). However, it's a pain to have to type "www.freespace2.com" each time. Is it possible to create a script that either enables the cheats, or create custom cheats? This is specifically for invulnerability and destroy the targeted ship. A cheat menu, similar to the command menu, would be nice.

I have some knowledge of Lua, but not in combination with FS2 Open, so I have no idea where to start. I've read the pages in the wiki, but can find no references as to how I can get a reference to the player or targeted ship, and set it to be invulnerable, or destroy it.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Cheats using scripts?
You can just set up an event in FRED to make the player invulnerable when you press one.

Same goes for making your target invulnerable, or blowing up your target, but those will be slightly more complicated (you might have to use argument lists, which you might not be familiar with yet).

No LUA required.

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Cheats using scripts?
I'll admit though, a small mod to bring up a cheat enabling menu could be really nice to have around at this point.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
Re: Cheats using scripts?
You can just set up an event in FRED to make the player invulnerable when you press one.

Same goes for making your target invulnerable, or blowing up your target, but those will be slightly more complicated (you might have to use argument lists, which you might not be familiar with yet).

No LUA required.

While that might work, it would be better if it wasn't embedded into a mission, as I would have to add that to every mission, and then remove it when I'm finished, which I might overlook.

 

Offline Mito [PL]

  • 210
  • Proud Member of Slavicus Mechanicus
Re: Cheats using scripts?
You could just call these events "CHEAT 1", "CHEAT 2", etc. so they would be perfectly visible in Events editor...
How do you kill a hydra?

You starve it to death.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Cheats using scripts?
Alternatively, debug builds (including fast debug builds, which recent nightlies have, which have debug functionality with release optimization so that they don't run super-slow) allow you to use cheats (and some special debugging commands) without having to type an enabling code. They also have a debug console which gives access to further functionality which can be useful when developing a mission.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Alternatively, debug builds (including fast debug builds, which recent nightlies have, which have debug functionality with release optimization so that they don't run super-slow) allow you to use cheats (and some special debugging commands) without having to type an enabling code. They also have a debug console which gives access to further functionality which can be useful when developing a mission.

Thank you. I just figured out how to open the debug console. I must have done something wrong the first time I used the debug build, because the cheats or console somehow didn't work back then. Though I am getting a few warnings, but those can be ignored I guess.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Though I am getting a few warnings, but those can be ignored I guess.
The whole point of doing development in debug builds is to fix warnings; of course, if you're only working on a mission and the warnings are with somebody else's mod, there's not much you can do about them, but if the warnings are being generated by your mission, you shouldn't ignore them.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Though I am getting a few warnings, but those can be ignored I guess.
The whole point of doing development in debug builds is to fix warnings; of course, if you're only working on a mission and the warnings are with somebody else's mod, there's not much you can do about them, but if the warnings are being generated by your mission, you shouldn't ignore them.

I'm aware of that, but in this case they were warnings caused by FS1-Port. It had something to do with incorrect detail levels for certain ships, and happened when those ships were being loaded, either by FRED or the game.

Obviously, if they were caused by my missions, I would try to solve them  :nervous::nod:.