User Tools

Site Tools


4rpl:commands:setunitbuildware

This is an old revision of the document!


Index

:!: Available in version 1.3 and later.

SetUnitBuildWare

SetUnitBuildWare(<-unit <-unitBuildWare)

:WARNING: :WARNING:
DO NOT apply this every frame when having a constructing unit swap construction ware types! This causes (effectively) a 2nd construction to occur for the same unit.
It also causes game simulation oddities.
You MUST surround this API with once endonce.

Description

Sets the build ware type of the unit. 0 = energy, 1 = anticreeper, 2 = arg, 3 = liftic.

Examples

SetUnitBuildWare(self 1)

Bug avoiding example

if(GetUnitConstructing(self))
	#--Custom construction:
	GetUnitConstructingData(self) ->curBuild
	if(<-curBuild.0 gt(300))
		if(<-curBuild.0 gt(350))
			once SetUnitBuildWare(self 3) endonce
		else
			once SetUnitBuildWare(self 2) endonce
		endif
	else
		once SetUnitBuildWare(self 0) endonce
	endif
	return
endif

Index

4rpl/commands/setunitbuildware.1695576238.txt.gz · Last modified: 2025/02/14 14:56 (external edit)