Hey guys!
I'm working on something here.
I have a custom pawn, and you see, I want this pawn to look exactly like us. So I've set his owner as us, the player, and made his skin according to us.
Now the problem here is, I want the pawn to have our inventory as well.
Is there a way I can make it so the pawn has our inventory by cloning our own inventory? and without deleting our own inventory?
THANKS.
Cloning Inventory?
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Cloning Inventory?
Sure, just iterate through inventory and spawn a copy on the actor you want to receive it. Pinata code will tell you how to iterate the inventory and then normal pickup code will show you how to add it to inventory.
I'm kinda interested where you are going with this.
I'm kinda interested where you are going with this.
So long, and thanks for all the fish
Re: Cloning Inventory?
Considering you are speaking about the Inventory (and not the Weapons), you simply have to copy the Inventory list of the PlayerPawn to your custom Pawn.
That's a good way to start:
Please remember that most Pawns will not be able to use the Inventory as a PlayerPawn is supposed to.
That's a good way to start:
Code: Select all
local Inventory Inv, Copy;
for(Inv=Owner.Inventory; Inv!=None; Inv=Inv.Inventory ) {
Copy = spawn(Inv.Class,Self);
if(Copy != none) {
Copy.RespawnTime = 0.0;
Copy.bHeldItem = true;
Copy.bTossedOut = false;
// Here you can adjust specific values just as ammo
Copy.GiveTo(Owner);
}
}
Website, Forum & UTStats
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************