Skip to content

Instantly share code, notes, and snippets.

@csiki
Created Oct 6, 2021
Embed
What would you like to do?
#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