Random loot from dead characters

How to create a mechanic to search dead bodies for random loot


In Far Cry 4 you can search dead bodies for loot. The loot is random. This tutorial generates a random selection of 1 to 3 objects that you collect when you interact with the dead character. The character can be an enemy or ally or neutral (as long as they have the loot kode in their brain).


Place all the objects you wish to have as loot in your world as templates. Unfortunately it is not possible to populate and use an object variable with gallery items, they need to be in your world in some form or other.

Create a logic cube. Call it random loot generator

page 1

WHEN DO [global][numvar: random][=][random number][1][to][3][as integer]

3 being the total number of objects you are choosing from

WHEN DO [global][numvar:loot no][=][random number][1][to][3][as integer]

1 being the smallest amount of objects you will collect, 3 being the most

WHEN DO [call page][2]

page 2

This is where you will set up your object array. Each object should have the following lines, with each object being assigned to a different random number.

WHEN [global][numvar:random][=][1] DO [global][objvar:loot][=][IWP:acorn]
…WHEN DO [global][textvar:lootname][=][text:An acorn]

Create a logic cube called my loot

This works out who is looting the body and starts the looting

WHEN [interacted] DO [boolvar:loot check][=][true]
…WHEN DO [objvar:player][=][it]

This establishes what loot, and how much loot is going to be given

WHEN [boolvar:loot check] DO
…WHEN [started to] DO [numvar:loot no][=][global][numvar:loot no]
…WHEN [countdown timer][hold time][2][loop][and][not][boolvar:finished]
…/…WHEN DO [started to] DO [objvar:my loot][=][global][objvar:loot]
…/…/…WHEN DO [textvar:my loot][=][global][textvar:loot name]
…/…/…WHEN DO [objvar:player][pick up][objvar:my loot]
…/…/..WHEN DO [numvar:loot collected][increment by][1]
…/…WHEN [duration timer][2] DO [display][textvar:my loot][screen center]

This says when the player has collected all my loot go to page 2 (which has no kode, so the interact highlight disappears and you can no longer interact with the body)

WHEN [numvar:loot collected][=][numvar:loot no] DO
…WHEN [countdown timer][2] DO [boolvar:finished][=][true]
WHEN [boolvar:finished]
…WHEN [countdown timer][2] DO [switch page][2]

In your character brains

Make sure all the characters you want to search for loot have destroy after death off.

WHEN [started to][is dead] DO [boolvar:dying][=][true]
WHEN [boolvar:dying] DO
…WHEN [countdown timer][4] DO [push brain][IWP:my loot]

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: