Edit: I´m stupid i just had to use the “Element” i defined in the If Statement:
GrowPlantToNextStage(Agent : agent, NextPlantStage : int)<suspends> : void =
Sleep(WaitTimeTillNextStage)
# Go Through all Plant Stages
for(Index := 0..PlantPhases.Length - 1):
# If This Plant is the Plant in the Array i´m Searching
if(Element := PlantPhases[NextPlantStage]):
SpawnPosition:vector3 := vector3{X:=1800.0, Y:=-6676.0, Z:= 1388.0}
# Spawn a creative_prop_asset fron a Array of all creative_prop_assets Plants
SpawnedProp := SpawnProp(Element, SpawnPosition, IdentityRotation())
set PlantStage += 1
spawn {GrowPlantToNextStage(Agent, NextPlantStage)}
How do you insert a creative_prop_asset in the SpawnProp function from a creative_prop_asset array?
This is my current Code and it gives me the Error (“This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context.(3512)”)
GrowPlantToNextStage(Agent : agent, NextPlantStage : int)<suspends> : void =
Sleep(WaitTimeTillNextStage)
# Go Through all Plant Stages
for(Index := 0..PlantPhases.Length - 1):
# If This Plant is the Plant in the Array i´m Searching
if(Element := PlantPhases[NextPlantStage]):
SpawnPosition:vector3 := vector3{X:=1800.0, Y:=-6676.0, Z:= 1388.0}
# Spawn a creative_prop_asset fron a Array of all creative_prop_assets Plants
SpawnedProp := SpawnProp(PlantPhases[NextPlantStage], SpawnPosition, IdentityRotation())
set PlantStage += 1