When units enter a region the attribute "points" will be doubled

How can I do the following?
For all humans entering a region your points will be doubled once the round time is up
If I explained wrong just say so, any question I will try to answer it.

2 Likes

wdym
your points will be doubled once every round or a centain round can double your points?

1 Like

Game Link:

https://www.modd.io/play/p51NkRT0U/

the code is here:

{
     "triggers": [
          {
               "type": "entityEntersRegion"
          }
     ],
     "conditions": [
          {
               "operator": "==",
               "operandType": "boolean"
          },
          true,
          true
     ],
     "actions": [
          {
               "type": "condition",
               "conditions": [
                    {
                         "operandType": "region",
                         "operator": "=="
                    },
                    {
                         "function": "getTriggeringRegion"
                    },
                    {
                         "function": "getVariable",
                         "variableName": "Doubled Points"
                    }
               ],
               "then": [
                    {
                         "type": "condition",
                         "conditions": [
                              {
                                   "operandType": "boolean",
                                   "operator": "=="
                              },
                              {
                                   "function": "getValueOfEntityVariable",
                                   "variable": {
                                        "function": "getEntityVariable",
                                        "variable": {
                                             "text": "EnteredTheRegion",
                                             "dataType": "boolean",
                                             "entity": "human",
                                             "key": "EnteredTheRegion"
                                        }
                                   },
                                   "entity": {
                                        "function": "thisEntity"
                                   }
                              },
                              false
                         ],
                         "then": [
                              {
                                   "type": "setEntityVariable",
                                   "entity": {
                                        "function": "thisEntity"
                                   },
                                   "variable": {
                                        "function": "getEntityVariable",
                                        "variable": {
                                             "text": "EnteredTheRegion",
                                             "dataType": "boolean",
                                             "entity": "human",
                                             "key": "EnteredTheRegion"
                                        }
                                   },
                                   "value": true
                              },
                              {
                                   "type": "setPlayerAttribute",
                                   "attribute": "points",
                                   "entity": {
                                        "function": "getOwner",
                                        "entity": {
                                             "function": "thisEntity"
                                        }
                                   },
                                   "value": {
                                        "function": "calculate",
                                        "items": [
                                             {
                                                  "operator": "*"
                                             },
                                             {
                                                  "function": "getPlayerAttribute",
                                                  "attribute": "points",
                                                  "entity": {
                                                       "function": "getOwner",
                                                       "entity": {
                                                            "function": "thisEntity"
                                                       }
                                                  }
                                             },
                                             2
                                        ]
                                   },
                                   "comment": "2x the Player Points (change the Player Attribute to your attribute)"
                              }
                         ],
                         "else": [
                              {
                                   "type": "sendChatMessageToPlayer",
                                   "message": "You already got rewarded!",
                                   "player": {
                                        "function": "getOwner",
                                        "entity": {
                                             "function": "thisEntity"
                                        }
                                   }
                              }
                         ],
                         "comment": "Boolean variable to check if the player has entered on the region before"
                    }
               ],
               "else": []
          }
     ],
     "name": "enter region",
     "parent": null,
     "key": "cWlJtKKzID",
     "order": 4
}

if unit enter region
if triggering region name == double point region
set player attribute coin as
player attrbute coin x 2