UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[Tutorial] Zombie History Debugging

broken avatar :(
Created 10 years ago
by SparkyMcSparks
0 Members and 1 Guest are viewing this topic.
2,251 views
broken avatar :(
×
broken avatar :(
Former Treyarch Developer
Location: usSherman Oaks, CA
Date Registered: 23 May 2014
Last active: 2 years ago
Posts
37
Respect
Forum Rank
Legless Crawler
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
VR Enthusiast
×
SparkyMcSparks's Groups
UGX V.I.P.
UGX V.I.P.
What is Zombie History?
Every time a Zombie is instructed to do something it is logged in the Zombie History for each individual zombie. Normally this is seen through a debugger, but I made a function to print it out in-game.

How Do I View Zombie History?
You'll want to add this line somewhere in your scripts, even the map script is fine:
Code Snippet
Plaintext
array_thread( GetSpawnerArray(), ::add_spawn_function, ::zombie_history_print );

Here is the function I wrote that you'll need to copy and paste, I put it in _zombiemode_utility.gsc since almost every script includes it:
Code Snippet
Plaintext
zombie_history_print()
{
/#
self endon( "death" );

if ( !IsDefined( self.zombie_history ) )
{
self.zombie_history = [];
}

last_zombie_history_size = 0;

while ( true )
{
max_prints = GetDvarInt( "zombie_history_debug" );

if ( self.zombie_history.size != last_zombie_history_size )
{
last_zombie_history_size = self.zombie_history.size;
prints = 0;

for ( x = self.zombie_history.size; x > 0; x-- )
{
if ( IsDefined( self.zombie_history[ x ] ) && prints < max_prints )
{
thread print3d_at_pos( self.zombie_history[ x ], undefined, "update_zombie_history_" + prints, ( 0, 0, 64 + prints * 10 ) );
prints++;
}
}
}

wait ( 0.05 );
}
#/
}

Then after, you'll want to toggle the DVAR "zombie_history_debug" to any number of history events you want to see. It'll print the most recent at the bottom, like the console.





How Can I Log My Own Events?
Stock scripts already log events for you, but if you want to log your own you'd want to do something like:
Code Snippet
Plaintext
self zombie_history( "zombie_assure_node -> failed to find a good entrance point" );

Call it on a Zombie AI and the first and only parameter is a message (usually is the function name the log is in and some helpful description about what is happening).
broken avatar :(
×
broken avatar :(
Location: usbuffalo
Date Registered: 16 August 2013
Last active: 11 months ago
Posts
927
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Giggity.
Signature
maps:
Undead Town
http://ugx-mods.com/forum/index.php?topic=2294.0 (Release)
Origins 1922
http://ugx-mods.com/forum/index.php?topic=2659.0
[WIP] mapping 39%, weapons 85%, scripts 65%
[/url]
×
RamboBadass's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
RamboBadass's Contact & Social LinksAsk merambobadassRamboDaGreat
cool thanks man !!!

 
Loading ...