Skip to content

Instantly share code, notes, and snippets.

@csiki
Created October 6, 2021 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csiki/aa344f7c119e216580c8c5d2d3a916ab to your computer and use it in GitHub Desktop.
Save csiki/aa344f7c119e216580c8c5d2d3a916ab to your computer and use it in GitHub Desktop.
#include "zcommon.acs"
#define KILL_REWARD 100.0
#define EXIT_REWARD 500.0
// these variables are exposed to ViZDoom
global int 0:reward;
global int 1:killCount; // number of monsters killed
global int 2:xpos; // player's position
global int 3:ypos;
script 1 (void)
{ // monster Killed
killCount += 1.0;
reward += KILL_REWARD;
}
script 2 OPEN
{ // episode start
ClearInventory(); // remove pistol
GiveInventory("Shotgun", 1);
GiveInventory("Shell", 50);
}
script 5 ENTER
{ // track user's position
while (1)
{
xpos = GetActorX(0);
ypos = GetActorY(0);
Print(f:GetActorX(0), s:", ", f:GetActorY(0));
delay(1);
}
}
script 3 (void)
{ // hitting the exit button
reward += EXIT_REWARD;
Exit_Normal(0);
}
script 4 DEATH
{ // death
reward -= EXIT_REWARD;
Exit_Normal(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment