I need help with something

So i was working on my new Wasteland survival and tried to make a karma system so it should give karma to a player if they kill a innocent player but my script dosent work :frowning:
Image:

What is your trigger?
#1 Why less then 5 and not equal 0?
#2 You set it to max straight away instef of increasing it.(calculate(player attributes(KARMA of owner of last attacking unit)))
#3 Many of the triggering unit should be last attacking unit.
last attacking unit will just return undefined if you use any other trigger but ‘is attacked’.

2 Likes

Update now i made it like this:


.
.
.
So The Trigger is when a units attribute becomes 0
and i should detect if a player kills someone who has no karma aka innocent.
if theres any proplems please tell me.

Did you try to test it out if it’s working fine or not?

no but i will test it today

1 Like

looks better but you check again for triggering unit inside the if statement you want to check for owner of triggering unit.
as much as I know last attacking unit doesnt work on that trigger so you have to use a entity variable.
“killerUnit” datatype unit, inside Homie.
Add a script.

trigger: when unit get attacked
set entity variable “killerUnit” of (this entity) as (last attacking unit)

and then change all your current last attacking unit to → entity variable “killerUnit” of this entity.

1 Like

i chnaged it again and finished it :slight_smile:

Sweet congratulations^^

1 Like