Simple Kill Score System by LadyLexUK

Have something important that other people might find usefull? Well, drop it here and help others!
User avatar
LucidStew
Level 3
Level 3
Posts: 176

Simple Kill Score System by LadyLexUK

Post#1 » Mon Aug 15, 2016 7:58 am

moved over from projectspark.com forums

There are a few methods for creating a scoreboard. This one is for when you kill a goblin. The goblin's death is what increments the score.Obviously you can use this Kode for any enemy character (zombies, wolves, etc)
This tutorial was created in response to a post in Koding Konversations by Black Bauer.

Score housed in players brain (preferable)

In your templated or placed goblin

WHEN [hit by attack] DO [objvar:my attacker][=][it]
...WHEN[started to][is dead] DO [objvar:my attacker][numvar:score][increment by][1]

This will increment the score variable in the player brain who last hit it. Good for multiplayer or single player.
If your player is destroyed, the variable will go with it. Make sure you have created a respawn system that uses revive rather than destroy on death, for this to work.

Turn destroy after death to off on player. In player brain.

WHEN [is dead]
...WHEN DO [numvar:lives][<][3]
.../...WHEN [countdown timer][2] DO [position][=][IWP:Respawn point][position]
.../.../...WHEN DO [revive]
…/...[Else] DO [game over] (or start a game over sequence by switching page)
WHEN [started to][is dead] Do [numvar:lives][increment by][1]


This gives player 3 lives before he will not revive again.

Score housed in separate logic cube

In your templated or placed goblin

WHEN [started to][is dead] DO [IWP: score cube][numvar:score][incremented by][1]

This is only good if your game has only 1 player, because there is only one score variable.


Score housed in a global variable

In your templated or placed goblin

WHEN [started to][is dead] DO [global][numvar:score][incremented by][1]

Again, only good if there is only 1 player.


You will need to put your display score in a logic cube or the players brain

WHEN DO [display][screen top right][text: "SCORE: "][wherever it is housed (global, player brain, logic cube)][numvar:score]
End of line.

User avatar
LucidStew
Level 3
Level 3
Posts: 176

Re: Simple Kill Score System by LadyLexUK

Post#2 » Mon Aug 15, 2016 8:04 am

In additonal to the above, if you want to use something with area effect damage, like a grenade, you can use something like the following:

w: [for each of][detect] d:
>w: d: [damage][it][20]
>>w: [started to][it][is dead] d: [creator][num var:kills][increment by][1]
End of line.

Return to “Tutorials and guides”

Who is online

Users browsing this forum: No registered users and 1 guest

cron