Demo videos

Brief overview of the SkookumScript Unreal Engine 4 Plugin in action.

SkookumScript on Sleeping Dogs at United Front Games

Raul and Dave at United Front Games were nice enough to create this quick demo of SkookumScript in action on Sleeping Dogs. Thanks, guys!


Code used in this demo

Note: The code has been updated to SkookumScript version 3.0—Raul used an older alpha version in the above video.

Explode vehicles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Explode a random unoccupied nearby vehicle
// every 5-15 seconds
!distance_to_player_safe: 5.0
!distance_to_player:      30.0

loop
  [
  !vehicles: Vehicle.get_instances_of_type('Vehicle')

  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // Get rid of invalid/unwanted vehicles
  vehicles.reject
    [ // item is vehicle to test
    item.nil_simobject?
      or item.get_driver.not_nil?
      or [not item.parked?]
      or [not item.distance_actor(@'Player').between?(
        distance_to_player_safe distance_to_player)]
      or [item = @'Player'.get_owned_vehicle]
      or item.get_properties.get_property_symbol('SpawnPriority') = 'Critical'
    ]

  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // Blow up random vehicle
  if vehicles.filled?
    [
    // get random vehicle
    !exploding_vehicle: vehicles.get_any
    // get rid of vehicle list
    vehicles: nil
    exploding_vehicle.trigger_explosion
    ]

  // Wait between 5 and 15 seconds
  _wait(@@random.uniform_range(5 15))
  ]

Simplified code

The code could be even simpler—especially if the code to create a list of vehicles is put in its own Vehicle.get_empty_near_player() method:

Explode vehicles (simplified)
1
2
3
4
5
6
7
8
9
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Blow up 1 random unoccupied nearby vehicle every 5-15 seconds
loop
  [
  Vehicle.get_empty_near_player.get_any_or_nil%trigger_explosion

  // Wait between 5 and 15 seconds
  _wait(@@random.uniform_range(5 15))
  ]

Here is the code for a Vehicle.get_empty_near_player() method:

Vehicle@get_empty_near_player()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
() List{ThisClass_}
  [
  // Get all instances of vehicles and get rid of all invalid vehicles
  Vehicle.get_instances_of_type('Vehicle')
    .reject
    [ // item is vehicle to test
    item.nil_simobject?
      or item.get_driver.not_nil?
      or [not item.parked?]
      or [not item.distance_actor(@'Player').between?(5 30)]  // Safe + farthest
      or [item = @'Player'.get_owned_vehicle]
      or item.get_properties.get_property_symbol('SpawnPriority') = 'Critical'
    ]
  ]