Game scavenge progress display: Difference between revisions
Jump to navigation
Jump to search

m (Changed parameters of {{this is a}} to comply with the updated version. This action was performed by a bot.) |
No edit summary |
||
Line 1: | Line 1: | ||
{{LanguageBar}} | |||
[[File:Progress display.png|thumb]] | [[File:Progress display.png|thumb]] | ||
{{CD|CScavengeProgressDisplay}} | {{CD|CScavengeProgressDisplay}} | ||
{{ | {{This is a|point entity|name=game_scavenge_progress_display|game=Left 4 Dead 2}} When turned on it displays the number of gas cans poured into {{ent|point_prop_use_target}} entities in the current round on the upper part of the screen as <code><number_of_cans_filled> / <Max></code>. Number of filled cans cannot be decreased using available inputs but it's possible with vscripts. Turning it off and back on won't nullify the amount. | ||
== Keyvalues == | == Keyvalues == | ||
Line 8: | Line 9: | ||
== Inputs == | == Inputs == | ||
{{ | {{I|TurnOn|Turn the display on.}} | ||
{{ | {{I|TurnOff|Turn the display off.}} | ||
{{ | {{I|SetTotalItems|Set the target (or total) number of scavenge items.|param=integer}} | ||
== Vscript Enhancement == | == Vscript Enhancement == | ||
Line 61: | Line 62: | ||
== See also == | == See also == | ||
* | * {{ent|point_prop_use_target}} | ||
* | * {{ent|weapon_scavenge_item_spawn}} |
Revision as of 13:58, 18 October 2024


![]() |
---|
CScavengeProgressDisplay |
game_scavenge_progress_display
is a point entity available in Left 4 Dead 2. When turned on it displays the number of gas cans poured into point_prop_use_target entities in the current round on the upper part of the screen as
<number_of_cans_filled> / <Max>
. Number of filled cans cannot be decreased using available inputs but it's possible with vscripts. Turning it off and back on won't nullify the amount.
Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Max (Max) <integer>
- Number of items to collect.
Inputs
- TurnOn
- Turn the display on.
- TurnOff
- Turn the display off.
- SetTotalItems <integer >
- Set the target (or total) number of scavenge items.
Vscript Enhancement
Script example to increment/decrement or reset the counter. When this script is used as this entity's Entity script it sets FireUser1 input to increment the counter, FireUser2 to decrement the counter and FireUser3 to reset the counter to 0.
Todo: should work in versus and coop gamemodes but needs more testing
local function add_to_scav_counter(val, index) {
local current_count = NetProps.GetPropIntArray(terror_gamerules, "m_iScavengeTeamScore", index);
local new_count = 0;
if(val != null) {
new_count = current_count + val;
}
if(new_count >= 0 && new_count < 64) {
NetProps.SetPropIntArray(terror_gamerules, "m_iScavengeTeamScore", new_count, index);
}
}
local add_to_counter_functions_by_gamemode = {
function versus(val) {
local team = NetProps.GetPropInt(terror_gamerules, "m_bAreTeamsFlipped");
add_to_scav_counter(val, team);
}
function coop(val) {
add_to_scav_counter(val, 0);
}
}
local gamemode = Director.GetGameModeBase();
if(!(gamemode in add_to_counter_functions_by_gamemode)) {
printl("Unsupported gamemode for game_scavenge_progress_display script");
return;
}
terror_gamerules <- Entities.FindByClassname(null, "terror_gamerules").weakref();
AddToCounter <- add_to_counter_functions_by_gamemode[gamemode];
function IncrementScavCounter() {
AddToCounter(1);
}
//won't decrease already gotten points in versus maybe todo ?
function DecrementScavCounter() {
AddToCounter(-1);
}
function ResetScavCounter() {
AddToCounter(null);
}
function OnPostSpawn() {
self.ConnectOutput("OnUser1", "IncrementScavCounter"); //FireUser1 increments by 1
self.ConnectOutput("OnUser2", "DecrementScavCounter"); //FireUser2 decrements by 1
self.ConnectOutput("OnUser3", "ResetScavCounter"); //FireUser3 sets the counter to 0
}
|