Quick tutorial on making it so that players can pickup and use weapons found in the level.
Step 1. Stripping the player of his current weapons on Spawn:
- This step is not required, but will allow you to have all players spawn with fists.
To create this:
- Right click in kismet and go to new event,player, player spawned
- Change max triggers on the player spawned node to 0
- Hold O and then press mouse 1 to shortcut spawn an unknown object variable (this will be the player that has spawned)
- Attach the unknown object variable to the instigator output of the player spawned node
- Right click in kismet and go to new action, pawn, give inventory
- Set the target input to the unknown object variable we created earlier
- Select the give inventory node and Change the Inventory list to give the weapon you want players to start with
- Set Clear Existing and Force replace to true by checking those boxes.
Step 2 - Equip the player when he touches a new weapon
2. This is how we give players their new weapon.
*** Picking up some weapons not intended for your class will break certain classes!!*** - We may fix this in a patch soon
To create this:
- Find the weapon you want to give to players in the content browser and drag it into the level
- Select this weapon in the level and rightclick -> convert to mover
- With your mover actor selected, open kismet and right click. At the bottom you will see "New Event using InterpActor.." Select the Touch option here.
- Create a Give inventory node as described above, remember to set the inventory list to the weapon you want to give to the player
- Attach the touched event from the interp actor to the input of our give inventory
- Create a new unknown object variable as described above
- Attach this object variable to the instigator output of the player spawned and the target of the give inventory
- Right click in kismet and go to new action, Toggle, Togglehidden
- With your mover actor in the level selected, right click in kismet and create a "new object variable using InterpActor.."
- Create two change collision nodes by right clicking in kismet and going to new action, Actor, change collision
- Set one change collision node to Collision Type - COLLIDE_NoCollision , set the other to "Touchallbutweapons"
- Set the targets of the togglehidden and both collision nodes to the interp actor object variable we created
- Connect the output of the give inventory node to inputs of hide on the toggle hidden and in on the collision node we set to Collide_NoCollision
- Right click in kismet and go to New Event, level loaded
- Connect the level reset output to the input of the change collision we set to "Touchallbutweapons", and the unhide input of the toggle hidden
And we're done!
Repeat this process for many weapons to create a mode where players spawn with just their fists and then can pickup weapons in the map to fight each other as seen in the example map - AOCTD-Gladiator