getactorclass

From ZDoom Wiki
Jump to: navigation, search

This function, along with the string array, returns the class name for any Doom 1 & 2 spawnable thing in the form of a string.

str Class[105] = {

"ShotgunGuy",
"ChaingunGuy",
"BaronOfHell",
"ZombieMan",
"DoomImp",
"Arachnotron",
"SpiderMastermind",
"Demon",
"Spectre",
"DoomImpBall",
"Clip",
"Shell",
"Cacodemon",
"Revenant",
"Bridge",
"ArmorBonus",
"Stimpack",
"Medikit",
"Soulsphere",
"Shotgun",
"Chaingun",
"RocketLauncher",
"PlasmaRifle",
"BFG",
"Chainsaw",
"SuperShotgun",
"Rock1",
"Rock2",
"Rock3",
"Dirt1",
"Dirt2",
"Dirt3",
"Dirt4",
"Dirt5",
"Dirt6",
"PlasmaBall",
"RevenantTracer",
"SGShard1",
"SGShard2",
"SGShard3",
"SGShard4",
"SGShard5",
"SGShard6",
"SGShard7",
"SGShard8",
"SGShard9",
"SGShard0",
"GreenArmor",
"BlueArmor",
"Cell",
"BlueCard",
"RedCard",
"YellowCard",
"YellowSkull",
"RedSkull",
"BlueSkull",
"ArchvileFire",
"StealthBaron",
"StealthHellKnight",
"StealthZombieMan",
"StealthShotgunGuy",
"LostSoul",
"Archvile",
"Fatso",
"HellKnight",
"Cyberdemon",
"PainElemental",
"WolfensteinSS",
"StealthArachnotron",
"StealthArchvile",
"StealthCacodemon",
"StealthChaingunGuy",
"StealthDemon",
"StealthDoomImp",
"StealthFatso",
"StealthRevenant",
"ExplosiveBarrel",
"CacodemonBall",
"Rocket",
"BFGBall",
"ArachnotronPlasma",
"Blood",
"BulletPuff",
"Megasphere",
"InvulnerabilitySphere",
"Berserk",
"BlurSphere",
"RadSuit",
"Allmap",
"Infrared",
"ClipBox",
"RocketAmmo",
"RocketBox",
"CellPack",
"ShellBox",
"Backpack",
"Gibs",
"ColonGibs",
"SmallBloodPool",
"BurningBarrel",
"BrainStem",
"ScriptedMarine",
"HealthBonus",
"FatShot",
"BaronBall"

};

function int GetActorClass (int tid)
{
	for (int i=0; i<105; i++)
		if (ThingCountName (Class[i], tid))
			return Class[i];
	
	return 0;
}

For custom DECORATE actors, you only need to increase the array size to account for your extra actors and add them to the array.

Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox