Talk:Left 4 Dead 2/Scripting

From Valve Developer Community
Jump to navigation Jump to search

Quick Notes

director_debug 1 shows special max > 1 if
c1_ambient_mall loaded with map prefix c1
possible need to pack .nut to get to work with necessary prefix for map name
Also possible that strictly <SPECIAL>limit = X is not enough
needs more testing
--ThaiGrocer 13:42, 27 February 2010 (UTC)

Vscript Variables

I compiled a list of all of the variables read by the Director in the server binary. Here's The List. It could use some organization before being placed on the wiki. I also skipped the mutation variables since they're already known through the mutation .nut files. Most of them are self explanatory--if there's any questions about how some are used I might be able to look some of them up. --ProdigySim 01:48, 28 July 2010 (UTC)

That's a great looking list. I'm wondering about one thing, though. Official scripts used variables like ZombieSpawnInFog and it is either TRUE or FALSE. Why is it an INT in the binary? Is it because of the language itself? Thanks a lot for this! --ThaiGrocer 16:51, 28 July 2010 (UTC)
I don't even remember making that list, haha. Yes, it's probably just a semantics thing. As an int, false is 0 and true is everything else. --ProdigySim 07:17, 6 December 2010 (UTC)

Other functions

Does anyone know if there's any more functions than those used on official scripts? 'Cause it lacks a lot of event calls e.g. OnPlayerDeath. --Winded

I've been looking through the binary a little bit, and I don't really see anything else. The scripting language is set up so they can just call script functions by name whenever they want. This means calling functions in scripts is only added when it's convenient for Valve's mutations/scripting. Map makers can call functions from entity inputs, though. So there's that. If I find anything super useful in the binaries I'll be sure to shout about it. --ProdigySim 07:23, 6 December 2010 (UTC)
Forgot to mention--a less-than-ideal substitute to event calls would be the Update() function, which runs on every game frame. Not the greatest thing to do, but with some trickery you'll be able to code a lot of things without causing too much CPU usage. --ProdigySim 07:26, 6 December 2010 (UTC)