Kismet wrote: ↑Fri Oct 20, 2023 5:45 am
1. You use
Spawn(class<>,..., A.Location)
. And I expected if I change coordinates then the weapon to be created at the specified location (eg.
Spawn(class<>,..., vect(x, y, z))
). But the weapon always spawns in inventory. I ask because Spawn function doesn't have inventory-specific information.
See code in my first post: GiveWeapon() asks (spawns) for a new weapon, SpawnNotify gives back another, and GiveWeapon() puts it into player's inventory.
Kismet wrote: ↑Fri Oct 20, 2023 5:45 am
2. After we spawned (with
Spawn()
) a new TournamentWeapon, our SpawnNotify class doesn't call SpawnNotification() for this new weapon. Why? I thought Spawn() function must generate for each "spawn" event.
I guess that notification is disabled for this instance while processing event SpawnNotification(). Otherwise an endless loop might be created.
Kismet wrote: ↑Fri Oct 20, 2023 5:45 am
3. I made a mutator, which creates (spawns) my SpawnNotify instance in PreBeginPlay() function. But weapons that are generated on the ground doesn't call SpawnNotification(). Why?
Probably they exist before your SpawnNotify is created. You can test that by adding a log-all-actors-of-interest in an Auto State of SpawnNotify.
But you may catch them by Mutator's CheckReplacement().
Kismet wrote: ↑Fri Oct 20, 2023 5:45 am
4. SpawnNotification is triggered both when weapon is issued at player respawn, and when weapon picked up first time. But in respawn weapon's property Owner is set to None. Why?
Idk. Is it also None when not using replacement?
The owner is set by this chain: DeathMatchPlus.GiveWeapon(newWeapon) calls newWeapon.GiveTo(pawn Other) what calls parent's Inventory.GiveTo(pawn Other) what calls Pawn.AddInventory(self) what finally calls NewItem.SetOwner(Self).
Probably it helps if you set the owner in SpawnNotification:
Code: Select all
if (NewWeapon != "")
{
Result = spawn(Class<Actor>(DynamicLoadObject(NewWeapon, class'Class')), , , A.Location);
if (Result != None)
{
Result.SetOwner(A.Owner);
A.Destroy();
return Result;
}
Kismet wrote: ↑Fri Oct 20, 2023 5:45 am
5. You say that you set ActorClass manually in UnrealEd, but I didn't find this property in your sample map. Besides property ActorClass is not marked as
var()
. How do you change it in UnrealEd? (just to know about UnrealEd; I set it in uc-files)
- SpawnNotify.ActorClass.jpg (35.85 KiB) Viewed 796 times