I using the code from the Shooter Demo as reference to make a thing in Blueprints, but i got a problem here:
This is what i got now:

*Clear BP

Then i got problems with that lines:
My problem is how manage the spawn or how make that like in the C++ code.
How or for what i give the index of DefaultInventoryClasses[i] ?? and how made that in BP ?
Can some one give me an example of this or what is bad ? if is possible with a screen of the configuration in BP.
Code:
void AShooterCharacter::SpawnDefaultInventory() { if (Role < ROLE_Authority) { return; } int32 NumWeaponClasses = DefaultInventoryClasses.Num(); for (int32 i = 0; i < NumWeaponClasses; i++) { if (DefaultInventoryClasses[i]) { FActorSpawnParameters SpawnInfo; SpawnInfo.bNoCollisionFail = true; AShooterWeapon* NewWeapon = GetWorld()->SpawnActor<AShooterWeapon>(DefaultInventoryClasses[i], SpawnInfo); AddWeapon(NewWeapon); } } ... void AShooterCharacter::AddWeapon(AShooterWeapon* Weapon) { if (Weapon && Role == ROLE_Authority) { Weapon->OnEnterInventory(this); Inventory.AddUnique(Weapon); } }
Code:
/** default inventory list */ UPROPERTY(EditDefaultsOnly, Category=Inventory) TArray<TSubclassOf<class AShooterWeapon> > DefaultInventoryClasses; /** weapons in inventory */ UPROPERTY(Transient, Replicated) TArray<class AShooterWeapon*> Inventory; /** currently equipped weapon */ UPROPERTY(Transient, ReplicatedUsing=OnRep_CurrentWeapon) class AShooterWeapon* CurrentWeapon;
This is what i got now:

*Clear BP

Then i got problems with that lines:
Code:
FActorSpawnParameters SpawnInfo; SpawnInfo.bNoCollisionFail = true; AShooterWeapon* NewWeapon = GetWorld()->SpawnActor<AShooterWeapon>(DefaultInventoryClasses[i], SpawnInfo);
How or for what i give the index of DefaultInventoryClasses[i] ?? and how made that in BP ?
Can some one give me an example of this or what is bad ? if is possible with a screen of the configuration in BP.
Comment