I want to judge whether the creative_device obtained with GetCreativeObjectsWithTag is the corresponding device.

I would like to change the score points given to players depending on the weapon they have when they win. (with conditional_button_device(GetItemCount))

However, I cannot use if to compare the conditional_button_device extracted from tag and the corresponding conditional_button_device. (It will be a red wavy line.)

Isn’t it possible to use “if” to determine if creative_device is what it is?

condition_tag := class(tag){}
---
---
    @editable
    conditional_10_1 : conditional_button_device = conditional_button_device{}
    #There are many others...
---
---
    WinnerJudge(Agent:agent):void=
        Print("I am Winner")
        Conditons := GetCreativeObjectsWithTag(condition_tag{})
        for (Obj : Conditons):
            if (Condition_Button := conditional_button_device[Obj]):
                Counts_ := Condition_Button.GetItemCount(Agent, 0)
                if (Condition_Button:conditional_button_device = conditional_10_1:conditional_button_device):   # <----# Red wavy line... 
                    Points : int = 10
                    ScoreAward(Agent, Points)

This line already checks if the Obj is a conditional button. Because you are casting that obj into a conditional button, the if statement will only complete if that obj is a conditional button.

 if (Condition_Button := conditional_button_device[Obj]): 

So there is no need to do this

if (Condition_Button:conditional_button_deviceconditional_10_1:conditional_button_device):

which doesn’t exist btw

2 Likes

Thanks for your reply.

I know the below line checks weather the Obj is “conditional_button_device” or not.

if (Condition_Button := conditional_button_device[Obj]): 

I want to check weather the Obj is the “conditional_10_1:conditional_button_device” or not.

It has many other “conditional_button_device”.

    @editable
    conditional_10_1 : conditional_button_device = conditional_button_device{}
    @editable
    conditional_20_1 : conditional_button_device = conditional_button_device{}
    @editable
    conditional_30_1 : conditional_button_device = conditional_button_device{}
1 Like

I don’t think conditional_button_device are comparable objects. You could try comparing their position instead ? :person_shrugging:

if (Condition_Button.GetTransform().Translation = conditional_10_1.GetTransform().Translation):

But be aware that forgetting to plug conditional_10_1 will result in a server crash

2 Likes

It means comparing based on the location of the device.
I’ll try!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.