Referência de funções
Godot 4 · GDScript · Groups & clans
create_group
Creates a group; the caller becomes its leader.
Asynchronous (result via signal)
Signature
create_group(group_name: String, opts: Dictionary = {}) -> voidWhat it does
POSTs /groups/create. On success group = {id, name, tag, description, join_policy, max_members, member_count, created_at, my_role}; {} on failure. error_code may be name_taken / tag_taken / already_in_group / forbidden.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| group_name | String | required | Group name (sanitized to max 50 chars). |
| opts | Dictionary | {} | Optional: tag (<=8), description (<=500), join_policy (open|request|invite_only|closed, default "request"), max_members (1-1000). |
How to call it
Connect group_created first, then call create_group(). Groups are gated by your plan (AllowGroups) AND game.groups_enabled; if disabled, error_code is "forbidden".
Result signal: group_created(success: bool, group: Dictionary, error_code: String)
Example
Gamdato.group_created.connect(_on_group_created)
Gamdato.create_group("Dragons", {"tag": "DRG", "join_policy": "request"})
func _on_group_created(ok: bool, group: Dictionary, error_code: String) -> void:
if ok: print("Created %s" % group.name)
else: print("Failed: %s" % error_code) # e.g. name_taken, already_in_groupUse cases
- Let a player start a clan.
- Create a guild with an approval (request) join policy.