Archives

All posts for the month February, 2015

While working with UDK (Unreal 3) and Kismet, I came up with some solutions to issues I found which are simpler and neater than the “commonly offered” solutions, purely in Kismet visual scripting.

The following is a health regeneration system which is both relatively simple, works smoothly and has a delay in starting health regeneration after taking damage.

Part 1 – “Have I taken Damage”

First, we need to know when we’ve taken damage, and hence should not be regenerating health in the first place!

Create the following;

  • Player Spawned (New Event / Player / Player Spawned)
  • Take Damage (New Event/ Actor / Take Damage)
  • Attach to Event (New Action / Event / Attach to Event)

For the Take Damage’s options, now set;

  • Damage threshold to 1
  • Max trigger count to zero
  • ReTrigger delay to 0.01
  • Player only to off (yes, off)

Right click on the “Instigator” output of Player Spawned and select “Create New Object Variable”

Let’s then connect them, as follows;

hr1

We can now detect when the player has been damaged – every time he does so, “Take Damage” will now fire. With that done, we need to now set up the system will will use for delaying regeneration based on damage taken, and this will be done by declaring a boolean variable, “Taken Damage”, and set up a delay in regenerating health.

Create the following;

  • Bool (variable) (New Variable, Bool)
  • Bool (action) (New Action, Set Variable, Bool) – two of these (remember, you can copy/paste Kismet objects!)
  • Delay (New Action, Misc, Delay)

Name the Bool’s (variable) as “TakenDamage”, and leave it as false – this declares the Boolean name. We now want to add two instances of checks on this which you can do via – New Variable / Named Variables in Persistent Level / TakenDamage.

  • For each of the Bool (variable)’s, right click on “value”, then “Create New Bool Variable”. Change one of those to False.
  • Again for each of the Bool (variable)’s, right click on “Target”
  • In the option of the Delay, set it to five seconds, and turn on “Start will restart”

Now, the logic we want to set is this – when the player takes damage, it triggers a 10s period when the “Taken Damage” boolean is true. The logic for is connected as follows;

hr2

(Note the green checkmark on “TakenDamage” – if this is a red cross instead, you have not properly declared the boolean variable!)

Let’s examine this – again, when the player takes damage it triggers “take damage”. This uses the first Bool (variable) to set “TakenDamage” to “True”. It also stops the timer delay. 0.1s later, the timer is now restarted (To create the delay, right click on the “out” node and select “Set Activation Delay”). If the Delay is allowed to finish – by not taking damage for those five seconds – the second bool is now triggered, and “TakenDamage” is now set as “False”.

Part 2 – “Regenerate Health”

Now we have set up a system to tell us when we should be regenerating health, let’s make that happen.

Create the following;

  • Player Spawned (New Event / Player / Player Spawned)
  • Delay (New Action, Misc, Delay)
  • Modify Health (New Action / Actor / Modify Health)
  • Compare Bool (New Condition / Comparison / Compare Bool)
  • TakenDamage Bool (New Variable / Named Variables in Persistent Level / TakenDamage)
  • Player Variable (New Variable / Player / Player)

Now;

  • In the Delay, set it to 1 second
  • The Modify Health needs to have it’s Amount set to 5 and “Heal” checked.
  • For the Player Variable, uncheck “All Players”

And we can then connect them as follows;

hr3

We begin the logic looping when the player is spawned. We check with the Compare Bool to see if “TakenDamage”  is false, if it is then we add 1 to the Player’s health with the Modify Health. Regardless if it is true or false, we trigger a delay of 1 second after which the Compare Bool is checked again, etc.

This now works! You can use other values – a shorter delay and a smaller heal amount, for instance, to create a smoother regeneration, if you wish.

(If it is not working, set your World Properties to “utgame”)

Part 3 – Test trigger

Let’s set up a simple trigger to test this with;

Make a Trigger in the main UDK window (Add Actor / Add Trigger), and edit it’s properties (F4), unchecking “Hidden”. Now place it near to the player spawn. With it selected, in Kismet right click and select New Event using Trigger_(x) / Used. Then create;

  • Modify Health (New Action / Actor / Modify Health)
  • Player Variable (New Variable / Player / Player)

Now set the Modify Health to, say, 10 damage per press, and set the Max Trigger Count of the Trigger to zero! If we then connect these up;

hr4

…We then have a trigger which damages the player when we trigger it, and which we can use to test the health regeneration!

I hope this was helpful!

//AndrewC

The original article series was written for a long-defunct Total Annihilation fansite in 2004. Ten years on, the article series is being mildly updated for the current era, when computer games are more popular than ever, and there is a variety of highly interesting RTS games not thought of in 2004 are on the market – among others, AI Fleet Command, R.U.S.E., Creeper World, Sword of The Stars and Eufloria – although I note most of these are primarily 2D. It still retains at it’s core, however, the concepts which it was originally built on.

The primary focus of this series was and remains on a field which unfortunately still lags, isometric-view 3d RTS games. One recent example is “Grey Goo”, which while it has some interesting unit and side concepts is still tied to much the same paradigm as the RTS games of 1997, when Total Annihilation was new and the C&C series current game was Red Alert and it’s expansions – and it has little to offer in terms of advancing the genre.

 

grey gooGrey Goo

Continue Reading

Alternative D20 Firearm Rules

Preamble

These rules are not intended to be comprehensive – they are a replacement for any of several D20-based system’s firing modes and “recoil” systems. They are a deliberate balance between realism and complexity, and are intended to be “feat lite”, since many d20 firearm systems would render low-level soldiers largely ineffective (as well as being overly complex)!

It also includes an optional “wounds” system, and energy weapons with heat management

Note; It is fully intended that burst fire has very low accuracy, due to the number of shots you can take with it and the high damage on hits.

Continue Reading