User Tools

Site Tools


crpl:docs:setscriptvar

This is an old revision of the document!


~~DISCUSSION~~ <- CRPL reference <- Script Commands

SetScriptVar

ArgumentsResultNotation
Unit UID, script name, var name, var value i1 s1 s2 d1 –

Description

Sets the named variable on the specified unit script to a value.

Can also set the variables of built-in units like spore towers and emitters.

Payload values for spores and emitters are internal integers, not the floats you would use in the map editor dialog. There is room for 6 digits after the decimal. 1.0 in the dialog would be 1000000 on the internal int. The values in the sample below correlate to 25.0 for the spore payload and 0.8 for the emitter production amount.

Examples

@CreateBullet

:CreateBullet
	"CRPLCore" CurrentX CurrentY CreateUnit ->unit
	<-unit "CRBullet.crpl" AddScriptToUnit
	<-unit "CRBullet.crpl" "targetX" <-targetX SetScriptVar
	<-unit "CRBullet.crpl" "targetY" <-targetY SetScriptVar
	<-unit "CRBullet.crpl" "payload" <-payload SetScriptVar
	<-unit "main" "Custom2" SetImage
	<-unit "main" -0.01 SetImagePositionZ
	<-unit "main" self "barrel" GetImageRotation SetImageRotation 
CreateUnit("SPORETOWER" 0 0) ->sporeTowerUID
SetScriptVar(<-sporeTowerUID 0 "startTime" 3600)
SetScriptVar(<-sporeTowerUID 0 "waveInterval" 3600)
SetScriptVar(<-sporeTowerUID 0 "waveCount" 1)
SetScriptVar(<-sporeTowerUID 0 "sporePayload" 25000000)
CreateUnit("EMITTER" 31 8) ->unit
SetScriptVar(<-unit 0 "productionInterval" 45)
SetScriptVar(<-unit 0 "productionAmt" 800000)
SetScriptVar(<-unit 0 "startTime" 45)
crpl/docs/setscriptvar.1384180726.txt.gz · Last modified: 2014/10/01 15:02 (external edit)