How to make a script that lets you to view someones stats

For example: It’s an input modal, and i type a player names in the input and then accept it, and then i can see the player’s attributes

1 Like

Video showing how it works:

https://streamable.com/ux0ka1

Game Link:

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

{
     "triggers": [
          {
               "type": "playerCustomInput"
          }
     ],
     "conditions": [
          {
               "operator": "==",
               "operandType": "boolean"
          },
          true,
          true
     ],
     "actions": [
          {
               "type": "forAllPlayers",
               "playerGroup": {
                    "function": "humanPlayers"
               },
               "actions": [
                    {
                         "type": "condition",
                         "conditions": [
                              {
                                   "operandType": "boolean",
                                   "operator": "=="
                              },
                              {
                                   "function": "subString",
                                   "sourceString": {
                                        "function": "playerCustomInput",
                                        "player": {
                                             "function": "getTriggeringPlayer"
                                        }
                                   },
                                   "patternString": {
                                        "function": "getPlayerName",
                                        "entity": {
                                             "function": "selectedPlayer"
                                        }
                                   }
                              },
                              true
                         ],
                         "then": [
                              {
                                   "type": "forAllUnits",
                                   "unitGroup": {
                                        "function": "allUnitsOwnedByPlayer",
                                        "player": {
                                             "function": "selectedPlayer"
                                        }
                                   },
                                   "actions": [
                                        {
                                             "type": "showCustomModalToPlayer",
                                             "htmlContent": {
                                                  "function": "concat",
                                                  "textA": {
                                                       "function": "getPlayerName",
                                                       "entity": {
                                                            "function": "selectedPlayer"
                                                       }
                                                  },
                                                  "textB": {
                                                       "function": "concat",
                                                       "textA": " Stats: <br> ",
                                                       "textB": {
                                                            "function": "concat",
                                                            "textA": {
                                                                 "function": "concat",
                                                                 "textA": "<strong>Health:<strong> </strong></strong>",
                                                                 "textB": {
                                                                      "function": "getEntityAttribute",
                                                                      "attribute": "health",
                                                                      "entity": {
                                                                           "function": "selectedUnit"
                                                                      }
                                                                 }
                                                            },
                                                            "textB": {
                                                                 "function": "concat",
                                                                 "textA": "<br>",
                                                                 "textB": {
                                                                      "function": "concat",
                                                                      "textA": "<strong>Speed:<strong> </strong></strong>",
                                                                      "textB": {
                                                                           "function": "getEntityAttribute",
                                                                           "attribute": "speed",
                                                                           "entity": {
                                                                                "function": "selectedUnit"
                                                                           }
                                                                      }
                                                                 }
                                                            }
                                                       }
                                                  }
                                             },
                                             "player": {
                                                  "function": "getTriggeringPlayer"
                                             }
                                        }
                                   ]
                              }
                         ],
                         "else": []
                    }
               ]
          }
     ],
     "name": "Base",
     "parent": "buxAOrf1yw",
     "key": "XhRJpPKug0",
     "order": 1
}
1 Like

if it dont work dm me.
(btw i did this thing in 7 mins)

1 Like

trigger player submit last input message
for all player in the game == selected player
open dialogue for last player submit custom input
Set global variable as concantenate + calculate
turn concantenante into string : Coins
calculate into number : selected player player attribute coins
open dialogue with inside global variable $name of varible$