IO System: Difference between revisions

From Zombie Panic! Official Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 26: Line 26:
|+ Commands
|+ Commands
|-
|-
! Command !! Description
! Example !! Description !! Arguments
|-
|-
| FireOutput "my_target" "MyInput" "MyValue" 5.0 || Fires an output from the target entity
| FireOutput "my_target" "MyInput" "MyValue" 5.0 || Fires an output from the target entity || FireOutput <target> <input> <value> <float>
|-
|-
| ASCall "MyFunction()" || Fires an AngelScript function {{Note|AngelScript is not supported in current version, so this is unsupported.}}
| ASCall "MyFunction()" || Fires an AngelScript function {{Note|AngelScript is not supported in current version, so this is unsupported.}} || ASCall <string>
|-
|-
| Wait 2.5 || Waits until next line gets fired.
| Wait 2.5 || Waits until next line gets fired. || Wait <float>
|-
|-
| Break {param} if "MyValue" || Stops the function. The lines after the break will be ignored.
| Break {param} if "MyValue" || Stops the function. The lines after the break will be ignored. || Break <value> if <value>
|-
|-
| if EntityName == "apple" || An if statement block
| if EntityName == "apple" || An if statement block || if <value> <type> <value>
|-
|-
| elseif EntityName is "orange" || Ditto, same as if, but for elseif
| elseif EntityName is "orange" || Ditto, same as if, but for elseif || elseif <value> <type> <value>
|-
|-
| else || Ditto.
| else || Ditto. || else
|-
|-
| end || Ends the if/else/elseif statement blocks
| end || Ends the if/else/elseif statement blocks || end
|-
|-
| PrintToConsole "Message here"  || Prints a message to the host console
| PrintToConsole "Message here"  || Prints a message to the host console || PrintToConsole <string>
|-
|-
| PrintToChat "Message here" || Prints a message to everybody's chat
| PrintToChat "Message here" || Prints a message to everybody's chat || PrintToChat <string>
|-
|-
| GiveItem 0 "item_name" || Gives a specific item to the player.
| GiveItem 0 "item_name" || Gives a specific item to the player. || GiveItem <int> <string>
|-
|-
| Participated 0 "ID_Name" || Tells which player participated a certain event.
| Participated 0 "ID_Name" || Tells which player participated a certain event. || Participated <int> <string>
|-
|-
| AddToSpawnList Ammo "item_name" 5 || Adds an item to the spawn list.
| AddToSpawnList Ammo "item_name" 5 || Adds an item to the spawn list. || AddToSpawnList <Ammo/Items/Weapons> <string> <int>
|-
|-
| SpawnItems || Spawns the items from the AddToSpawnList (and purges the list after)
| SpawnItems || Spawns the items from the AddToSpawnList (and purges the list after) || SpawnItems
|}
|}



Latest revision as of 19:49, 7 January 2026

IO System was introduced in Zombie Panic! Zombie Panic! to simplify some unnecessary entities for Objective maps. IO System also supports some minor scripting, but not much as it was never designed with that in mind.


Functions & Commands

Global Functions
Function Description
Function OnMapStart() Called when the map has just been loaded
Function OnRoundStart() Called when the round starts
Function OnMapEnd() Called when the map ends.
Function OnPlayerSpawned(Player) The player who just spawned
Note:Unsed?
Function OnInputReceived(EntityID, Action, Value) When an input was recived
Function OnOutputSent(EntityID, EntityName, OutputName, OutputValue, OutputDelay) When an entity fires an outout
Function CalculatePlayerAmount(Players) Called on round start, useful for populating AddToSpawnList
Commands
Example Description Arguments
FireOutput "my_target" "MyInput" "MyValue" 5.0 Fires an output from the target entity FireOutput <target> <input> <value> <float>
ASCall "MyFunction()" Fires an AngelScript function
Note:AngelScript is not supported in current version, so this is unsupported.
ASCall <string>
Wait 2.5 Waits until next line gets fired. Wait <float>
Break {param} if "MyValue" Stops the function. The lines after the break will be ignored. Break <value> if <value>
if EntityName == "apple" An if statement block if <value> <type> <value>
elseif EntityName is "orange" Ditto, same as if, but for elseif elseif <value> <type> <value>
else Ditto. else
end Ends the if/else/elseif statement blocks end
PrintToConsole "Message here" Prints a message to the host console PrintToConsole <string>
PrintToChat "Message here" Prints a message to everybody's chat PrintToChat <string>
GiveItem 0 "item_name" Gives a specific item to the player. GiveItem <int> <string>
Participated 0 "ID_Name" Tells which player participated a certain event. Participated <int> <string>
AddToSpawnList Ammo "item_name" 5 Adds an item to the spawn list. AddToSpawnList <Ammo/Items/Weapons> <string> <int>
SpawnItems Spawns the items from the AddToSpawnList (and purges the list after) SpawnItems


Example

This example is directly from zp_haunted.io file

Function OnRoundStart()
{
	FireOutput "bookbtn0" "DeActivate" "" 1.0
	FireOutput "bookbtn1" "DeActivate" "" 1.0
}

Function OnOutputSent( EntityID, EntityName, OutputName, OutputValue, OutputDelay )
{
	if EntityName is "wpn_give"
		// Give the player the shotgun
		GiveItem {OutputValue} "weapon_dbarrel"
	end

	if EntityName is "me_book"
		FireOutput "bookbtn1" "Activate" "" 1.0
	end

	if EntityName is "book_place1"
		FireOutput "bookbtn0" "Activate" "" 1.0
	end

	// The player participated in finding the anomalies
	if EntityName is "anomaly0"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	elseif EntityName is "anomaly1"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	elseif EntityName is "anomaly2"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	elseif EntityName is "anomaly3"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	elseif EntityName is "anomaly4"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	elseif EntityName is "anomaly5"
		Participated {OutputValue} "HOUSEOFHORRORS"
		FireOutput "book_check" "IncreaseValue" "" 0.0
	end

	// Our book was set, and we found all anomalies!
	if EntityName is "book_set_snd"
		FireOutput "world_ending" "StartShake" "" 0.0
		FireOutput "end_fog" "StartFog" "" 1.0
		FireOutput "anomaly_ach" "GiveAchievement" "" 3.0
	end
}