Skip to content

Commit 6f964e8

Browse files
Macilcoelckers
authored andcommitted
add changeskill command
1 parent 9ca3082 commit 6f964e8

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

docs/console.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,11 @@ <h2>Other commands and cvars</h2>
23612361
of a music lump or file on disk (which need not have been specified with the
23622362
-file parameter).
23632363
</div>
2364+
<div class="c" id="changeskill">changeskill <i>skill</i></div>
2365+
<div class="b">Changes the current skill of the game. The skill change will take
2366+
effect at the next map change. The skill must be a number. The default skill
2367+
levels range from 0 to 4 inclusive.
2368+
</div>
23642369
<div class="c" id="chase">chase</div>
23652370
<div class="b">Turns the chasecom on and off. This command also works while
23662371
watching demos, so you can bind it to a key and watch demos in the third
@@ -3177,6 +3182,7 @@ <h4>C</h4>
31773182
<a href="#centerview">centerview</a><br />
31783183
<a href="#changemap">changemap</a><br />
31793184
<a href="#changemus">changemus</a><br />
3185+
<a href="#changeskill">changeskill</a><br />
31803186
<a href="#chase">chase</a><br />
31813187
<a href="#chase_dist">chase_dist</a><br />
31823188
<a href="#chase_height">chase_height</a><br />

src/console/c_cmds.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,39 @@ CCMD (changemap)
408408
}
409409
}
410410

411+
CCMD (changeskill)
412+
{
413+
if (!players[consoleplayer].mo || !usergame)
414+
{
415+
Printf ("Use the skill command when not in a game.\n");
416+
return;
417+
}
418+
419+
if (!players[consoleplayer].settings_controller && netgame)
420+
{
421+
Printf ("Only setting controllers can change the skill.\n");
422+
return;
423+
}
424+
425+
if (argv.argc() == 2)
426+
{
427+
int skill = atoi(argv[1]);
428+
if (skill < 0 || skill >= AllSkills.Size())
429+
{
430+
Printf ("Skill %d is out of range.\n", skill);
431+
}
432+
else
433+
{
434+
NextSkill = skill;
435+
Printf ("Skill %d will take effect on the next map.\n", skill);
436+
}
437+
}
438+
else
439+
{
440+
Printf ("Usage: changeskill <skill>\n");
441+
}
442+
}
443+
411444
CCMD (give)
412445
{
413446
if (CheckCheatmode () || argv.argc() < 2)

0 commit comments

Comments
 (0)