The Strange Result With [Trigger on Death].

The Strange Result With [Trigger on Death].

Postby LCRS » 15 July 2018, 08:16

There may be an issue with the level editor coding in my recognition. I was endeavoring to create a dynamic-notification system when a player gets killed, and a currency system when a player receives funds after they eliminated an opponent. As of now, I cannot solve a strange result when utilizing Trigger on death option. For example, when I associate that option with Set value of variable 'A' to player-killer slot action, it will retain the player-killer slot information even after a pre-variable execution of Set variable 'A' value to value 'B' - That should renew the process; though, it does not. That happens in singleplayer and multiplayer when I tested it.

Here is a visual illustration of how I set it. Specifically, the currency system:

Variables: user_killer and user_balance are set at the start of the match.

-This trigger is initiated by Trigger on death option-
ID: #Add_Balance
Enabled: Yes
Max Calls: Infinite

Action 1: Continue trigger actions execution only if value of variable 'A' is equals value "B"
Parameter A: user_killer
Parameter B: none

Action 2: Set value of variable 'A' to player-killer slot
Parameter A: user_killer
Parameter B: -not used-
This will determine who has killed the player by player-slot.

Action 3: Set value of variable 'A' to slot of current player
Parameter A: initiator_player
Parameter B: 0
This will convert the selected trigger to operate in client-side.
The parameter B of the variable cannot be modified, and it will value back to 0 if changed. I do believe that parameter B should be fixed as -not used- as the variable of action 2. Although, I may be incorrect.

Action 4: Continue trigger actions execution only if variable 'A' is equals variable "B"
Parameter A: user_killer
Parameter B: initiator_player

Action 5: Add value 'B' to value of variable 'A'
Parameter A: user_balance
Parameter B: 1
This adds currency to the player-killer balance.

Action 6: Show text 'A' in chat with color 'B'
Parameter A: + $1
Parameter B: #FFFF00
This notifies the player-killer that they received currency.

Action 7: Set variable 'A' value to value 'B'
Parameter A: user_killer
Parameter B: none
This should reset the trigger.

Here is the actual issue:
Let's say that a player named ACR killed UnrealCrash, then ACR will receive $1. However, if UnrealCrash died by no-one or murder himself, then ACR will still receive $1.

What I am trying to say:
Is it possible to prevent the Set value of variable 'A' to player-killer slot variable to not overwrite values?
Last edited by LCRS on 6 August 2018, 00:19, edited 6 times in total.
User avatar
LCRS
Recruit
 
Posts: 9
Joined: 26 March 2017, 19:03
Location: United States

Re: Possible Problems With Few Variable Triggers.

Postby ditzy » 15 July 2018, 18:37

LCRS wrote:Is it possible to prevent the Set value of variable 'A' to player-killer slot variable to not overwrite values?

I believe you may have inadvertently "client-sided" the user_killer variable. If I am correct, action 7 resets the value stored in user_killer. However, action 4 allows continued execution of the trigger for the player-killer only. That means the rest of the players never get to execute action 7, so user_killer is never reset.

However, that bit is redundant, considering that you only allow execution of the trigger if no player-killer is detected in user_killer even though you check for a player-killer (Which will still give user_killer a value regardless) in the immediate action following it. That may be why your variable doesn't seem to "reset" itself.

----

To my understanding, this is how the action Set value of variable 'A' to player-killer slot works.
- If a player-killer is detected, the value of variable A is set to that player-killer's slot ID.
- If there was no player-killer or the player committed suicide the value of variable A is set to the slot ID of the player who died.

I believe this set of actions should work. (I may be wrong, as I have yet to test this)
Spoiler: Show More
ID: #Add_Balance
Enabled: Yes
Max Calls: Infinite

Action 1: Set value of variable 'A' to player-killer slot
Parameter A: user_killer
Parameter B: -not used-

Action 2: Set value of variable 'A' to player-initiator slot
Parameter A: initiator_player
Parameter B: -not used-
Note: This and the following action check to make sure the player who died is not the player-killer.

Action 3: Continue trigger actions execution only if variable 'A' does not equals variable "B"
Parameter A: user_killer
Parameter B: initiator_player

Action 4: Continue trigger actions execution only if variable 'A' is equals variable "B"
Parameter A: user_killer
Parameter B: current_player
Note: current_player being the result of Set value of variable 'A' to slot of current player, which you can execute at the start of the match on a trigger connected to a timer with a delay of 0. Alternatively you can set Set value of variable 'A' to slot of current player before action 2 of this trigger.
This client-sides the trigger.


Action 5: Add value 'B' to value of variable 'A'
Parameter A: user_balance
Parameter B: 1
Purpose: This adds currency to the player-killer balance.

Action 6: Show text 'A' in chat with color 'B'
Parameter A: + $1
Parameter B: #FFFF00
Purpose: This notifies the player-killer that they received currency.
Sometimes draws ponies
Sometimes draws ponies
Sometimes draws ponies
User avatar
ditzy
Advanced Usurpation Soldier [150]
 
Posts: 169
Joined: 1 December 2017, 01:20
Location: Ponyville

Re: The Strange Result With [Trigger on Death].

Postby LCRS » 15 July 2018, 20:13

ditzy wrote:I believe you may have inadvertently "client-sided" the user_killer variable. If I am correct, action 7 resets the value stored in user_killer. However, action 4 allows continued execution of the trigger for the player-killer only. That means the rest of the players never get to execute action 7, so user_killer is never reset.

However, that bit is redundant, considering that you only allow execution of the trigger if no player-killer is detected in user_killer even though you check for a player-killer (Which will still give user_killer a value regardless) in the immediate action following it. That may be why your variable doesn't seem to "reset" itself.

----

To my understanding, this is how the action Set value of variable 'A' to player-killer slot works.
- If a player-killer is detected, the value of variable A is set to that player-killer's slot ID.
- If there was no player-killer or the player committed suicide the value of variable A is set to the slot ID of the player who died.

I believe this set of actions should work. (I may be wrong, as I have yet to test this)
Spoiler: Show More
ID: #Add_Balance
Enabled: Yes
Max Calls: Infinite

Action 1: Set value of variable 'A' to player-killer slot
Parameter A: user_killer
Parameter B: -not used-

Action 2: Set value of variable 'A' to player-initiator slot
Parameter A: initiator_player
Parameter B: -not used-
Note: This and the following action check to make sure the player who died is not the player-killer.

Action 3: Continue trigger actions execution only if variable 'A' does not equals variable "B"
Parameter A: user_killer
Parameter B: initiator_player

Action 4: Continue trigger actions execution only if variable 'A' is equals variable "B"
Parameter A: user_killer
Parameter B: current_player
Note: current_player being the result of Set value of variable 'A' to slot of current player, which you can execute at the start of the match on a trigger connected to a timer with a delay of 0. Alternatively you can set Set value of variable 'A' to slot of current player before action 2 of this trigger.
This client-sides the trigger.


Action 5: Add value 'B' to value of variable 'A'
Parameter A: user_balance
Parameter B: 1
Purpose: This adds currency to the player-killer balance.

Action 6: Show text 'A' in chat with color 'B'
Parameter A: + $1
Parameter B: #FFFF00
Purpose: This notifies the player-killer that they received currency.


I have tested your method and worked a bit better. Even though, the continuous execution of #Add_Balance remains after I eliminated a NPC, and that is the main issue here.
User avatar
LCRS
Recruit
 
Posts: 9
Joined: 26 March 2017, 19:03
Location: United States

Re: The Strange Result With [Trigger on Death].

Postby ditzy » 22 July 2018, 19:12

Ah, sorry. I see what you mean now.

---- Edit

I tested the Set value of variable 'A' to player-killer slot action and it seems to retain individual values for each character. Let me explain.

I thought it would be possible to work around this bug by having an actor kill another actor after the player died, "resetting" the value of user_killer. When the actor was killed, user_killer returned a value of 2 (The actor-killer's slot). However, user_killer returned 0 (The player-killer's slot) when the player killed himself again afterwards.
Sometimes draws ponies
Sometimes draws ponies
Sometimes draws ponies
User avatar
ditzy
Advanced Usurpation Soldier [150]
 
Posts: 169
Joined: 1 December 2017, 01:20
Location: Ponyville


Return to Bug Reporting Archive

Who is online

Users browsing this forum: No registered users