Passer au contenu principal
Version: latest - a1.169.2 ⚖️

🔣 Blueprint

Une classe Blueprint permet de faire apparaître n'importe quel Blueprint Unreal dans nanos world.

Client & Server🔁Auto-Distributed🧑‍💻API Source
👪Inheritance
This class shares methods and events from Base Entity, Base Actor, Base Paintable.

tip

Si votre acteur Blueprint a été créé sur le Serveur, il sera automatiquement synchronisé avec les autres joueurs en utilisant le système d'Autorité de Réseau de nanos world ! Il suit les mêmes règles que toutes les autres entités !

🎒 Exemples​

Appeler des événements Blueprint depuis Lua​

Client/Index.lua
-- Spawns the Blueprint
local blueprint = Blueprint(Vector(), Rotator(), "my-asset-pack::BP_MyBlueprint")

local param1 = 123
local param2 = "hello there!"

-- Calls the event, passing any parameters
blueprint:CallBlueprintEvent("MyBlueprintCustomEvent", param1, param2)

Lier des Event Dispatchers de Blueprint​

Client/Index.lua
-- Spawns the Blueprint
local blueprint = Blueprint(Vector(), Rotator(), "my-asset-pack::BP_MyBlueprint")

-- Subscribes to a Blueprint Event Dispatcher
blueprint:BindBlueprintEventDispatcher("MyBlueprintDispatcher", function(self, arg1, arg2)
Console.Log("Called from Blueprint!", arg1, arg2)
end)

🛠 Constructeurs​

Default Constructor​

No description provided

local my_blueprint = Blueprint(location, rotation, blueprint_asset, collision_type?)

Parameters

TypeNameDefaultDescription
Vectorlocation Required parameter World location to spawn at
Rotatorrotation Required parameter World rotation to spawn with
Blueprint Referenceblueprint_asset Required parameter The Blueprint asset to spawn
CollisionTypecollision_typeCollisionType.AutoCollision profile of this Actor

🗿 Fonctions statiques​

Inherited Entity Static Functions
Blueprint inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
ReturnsNameDescription
table of Base EntityGetAllReturns a table containing all Entities of the class this is called on
Base EntityGetByIndexReturns a specific Entity of this class at an index
integerGetCountReturns how many Entities of this class exist
table of tableGetInheritedClassesGets a list of all directly inherited classes from this Class created with the Inheriting System
iteratorGetPairsReturns an iterator with all Entities of this class to be used with pairs()
table or nilGetParentClassGets the parent class if this Class was created with the Inheriting System
tableInheritInherits this class with the Inheriting System
booleanIsChildOfGets if this Class is child of another class if this Class was created with the Inheriting System
functionSubscribeSubscribes to an Event for all entities of this Class
functionSubscribeRemoteSubscribes to a custom event called from server
UnsubscribeUnsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed

This class doesn't have own static functions.

🦠 Fonctions​

Inherited Entity Functions
Blueprint inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
ReturnsNameDescription
BroadcastRemoteEventCalls a custom remote event directly on this entity to all Players
BroadcastRemoteInRadiusEventAppelle un événement distant personnalisé directement sur cette entité pour tous les Joueurs dans un rayon donné
CallRemoteEventCalls a custom remote event directly on this entity to a specific Player
CallRemoteEventCalls a custom remote event directly on this entity
CallRemotePlayersEventAppelle un événement distant personnalisé directement sur cette entité pour une liste de Joueurs
DestroyDestroys this Entity
FinishSpawnFinish the spawning process and send the entity to clients if it was spawned with a deferred spawn_mode
table of stringGetAllValuesKeysGets a list of all values keys
tableGetClassGets the class of this entity
integerGetIDGets the universal network ID of this Entity (same on both client and server)
anyGetValueGets a Value stored on this Entity at the given key
booleanHasAuthorityGets if the local context has authority over this Entity (true if spawned by the client, false if spawned by the server)
booleanIsARecursively checks if this entity is inherited from a Class
booleanIsBeingDestroyedReturns true if this Entity is being destroyed
booleanIsSpawnedGets if this Entity finished spawning
booleanIsValidReturns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity)
SetSpawnModeOverrides when this Entity finishes spawning, from the Constructor of an Inherited Class
SetValueSets a Value in this Entity
functionSubscribeSubscribes to an Event on this specific entity
functionSubscribeRemoteSubscribes to a custom event called from server on this specific entity
UnsubscribeUnsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed
Inherited Actor Functions
Blueprint inherits from Base Actor Class, sharing it's methods and functions:
Base Actorscripting-reference/classes/base-classes/actor
ReturnsNameDescription
AddActorTagAdds an Unreal Actor Tag to this Actor
AddAngularImpulseAdd an angular impulse to this Actor. Good for one time instant burst
AddImpulseAdd an impulse to this Actor. Good for one time instant burst
booleanAttachToAttache cet acteur à tout autre acteur, éventuellement à un os spécifique
DetachDétache cet Acteur à partir de AttachedTo Actor
table of stringGetActorTagsGets all Unreal Actor Tags on this Actor
VectorGetAngularForceGets this Actor's angular force (set by SetAngularForce())
floatGetAngularVelocityRenvoie la vitesse angulaire de cet Acteur
table of Base ActorGetAttachedEntitiesGets all Actors attached to this Actor
Base Actor or nilGetAttachedToGets the Actor this Actor is attached to
stringGetAttachedToSocketRécupère le nom du bone ou du socket auquel l'acteur concerné est attaché
tableGetBoundsObtient les limites englobantes de l'acteur concerné, utile pour connaître sa taille dans le monde
CollisionTypeGetCollisionGets this Actor's collision type
integerGetDimensionGets this Actor's dimension
floatGetDistanceFromCameraGets the distance of this Actor from the Camera
VectorGetForceGets this Actor's force (set by SetForce())
floatGetLifeSpanDéfinit le temps (en secondes) avant que l'acteur concerné soit détruit
VectorGetLocationGets this Actor's location in the game world
floatGetMassRenvoie la masse de cet Acteur
Player or nilGetNetworkAuthorityGets this Actor's Network Authority Player
VectorGetRelativeLocationGets this Actor's Relative Location if it's attached
RotatorGetRelativeRotationGets this Actor's Relative Rotation if it's attached
RotatorGetRotationGets this Actor's angle in the game world
VectorGetScaleGets this Actor's scale
floatGetScreenPercentageGets the percentage of this Actor size in the screen
tableGetSocketTransformGets a Socket Transform in world space given a bone or socket name
VectorGetVelocityGets this Actor's current velocity
booleanHasNetworkAuthorityReturns true if the local Player is currently the Network Authority of this Actor
booleanIsGravityEnabledReturns true if gravity is enabled on this Actor
booleanIsImpulseOnDamageRenvoie true si les dégâts subis exercent une poussée sur le corps physique de l'acteur concerné
booleanIsInWaterReturns true if this Actor is in water
booleanIsNetworkDistributedReturns true if this Actor is currently network distributed
booleanIsVisibleReturns true if this Actor is visible
RemoveActorTagRemoves an Unreal Actor Tag from this Actor
ResetVelocityResets this Actor's linear and angular velocities to zero
RotateRelativeToFait pivoter progressivement l'acteur attaché jusqu’à un angle relatif à son parent, sur une durée définie
RotateToSmoothly rotates this actor to an angle over a certain time
SetAngularForceAdds a permanent angular force to this Actor, set to Vector(0, 0, 0) to cancel
SetCastShadowSets this Actor's to cast shadows or not
SetCollisionSets this Actor's collision type
SetDimensionDéfinit la dimension de l'acteur concerné. Les acteurs ne peuvent voir et interagir qu’avec les entités appartenant à la même dimension
SetDistanceOptimizationMultiplierDéfinit le multiplicateur d'optimisation de distance de cet Acteur
SetForceAdds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel
SetGravityEnabledSets whether gravity is enabled on this Actor
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetImpulseOnDamageDéfinit si les dégâts subis (tirs, attaques au corps à corps, explosions) provoquent une poussée sur le corps physique de cet acteur
SetLifeSpanSets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed.
SetLocationSets this Actor's location in the game world
SetNetworkAuthoritySets the Player to have network authority over this Actor
SetNetworkAuthorityAutoDistributedSets if this Actor will auto distribute the network authority between players
SetOutlineEnabledDéfinit si le contour est activé sur cet acteur et quel index de contour utiliser
SetRelativeLocationSets this Actor's relative location in local space (only if this actor is attached)
SetRelativeRotationSets this Actor's relative rotation in local space (only if this actor is attached)
SetRenderCullDistanceSets this Actor's render cull distance
SetRotationSets this Actor's rotation in the game world
SetScaleSets this Actor's scale
SetVisibilitySets whether the actor is visible or not
TranslateRelativeToFait bouger progressivement l'acteur attaché jusqu’à une position relatif à son parent, sur une durée définie
TranslateToSmoothly moves this actor to a location over a certain time
booleanWasRecentlyRenderedGets if this Actor was recently rendered on screen
Inherited Paintable Functions
Blueprint inherits from Base Paintable Class, sharing it's methods and functions:
Base Paintablescripting-reference/classes/base-classes/paintable
ReturnsNameDescription
ColorGetMaterialColorParameterGets a Color parameter from this Actor's material
floatGetMaterialScalarParameterGets a Scalar parameter from this Actor's material
stringGetMaterialTextureParameterGets a Texture parameter from this Actor's material
VectorGetMaterialVectorParameterGets a Vector parameter from this Actor's material
ResetMaterialResets the material from the specified index to the original one
SetMaterialSets the material at the specified index of this Actor
SetMaterialColorParameterSets a Color parameter in this Actor's material
SetMaterialFromCanvasDéfinit le matériau à l'index spécifié de cet acteur sur un objet Canvas
SetMaterialFromSceneCaptureSets the material at the specified index of this Actor to a SceneCapture object
SetMaterialFromWebUISets the material at the specified index of this Actor to a WebUI object
SetMaterialScalarParameterDéfinit un paramètre "Scalar" sur le matériau de cet acteur
SetMaterialTextureParameterSets a texture parameter in this Actor's material to an image
SetMaterialVectorParameterDéfinit un paramètre "Vector" sur le matériau de cet acteur
SetPhysicalMaterialOverrides this Actor's Physical Material with a new one
ReturnsNameDescription
functionBindBlueprintEventDispatcherAssigns and Binds a Blueprint Event Dispatcher
varargs of anyCallBlueprintEventCalls a Blueprint Event or Function
anyGetBlueprintPropertyValueGets a Blueprint Property/Variable value
SetBlueprintPropertyValueSets a Blueprint Property/Variable value directly
UnbindBlueprintEventDispatcherUnbinds a Blueprint Event Dispatcher

Slow

BindBlueprintEventDispatcher​

Assigns and Binds a Blueprint Event Dispatcher
local ret = my_blueprint:BindBlueprintEventDispatcher(dispatcher_name, callback)

Parameters

TypeParameterDefaultDescription
stringdispatcher_name Required parameter Event Dispatcher name
functioncallback Required parameter Callback function to call with this format

Returns

TypeDescription
functionle callback lui-même

Slow

CallBlueprintEvent​

Calls a Blueprint Event or Function.

Returns all Function return values on Client Side
local ret_01, ret_02, ... = my_blueprint:CallBlueprintEvent(event_name, arguments...?)

Parameters

TypeParameterDefaultDescription
stringevent_name Required parameter Nom de l'événement ou de la fonction
anyarguments...?nil
Sequence of arguments to pass to the event

Returns

TypeDescription
varargs of anythe function return values

Slow

GetBlueprintPropertyValue​

Gets a Blueprint Property/Variable value
local value = my_blueprint:GetBlueprintPropertyValue(property_name)

Parameters

TypeParameterDefaultDescription
stringproperty_name Required parameter Name of the Blueprint variable

Returns

TypeDescription
anyLa valeur

See also SetBlueprintPropertyValue.


Slow

SetBlueprintPropertyValue​

Sets a Blueprint Property/Variable value directly
my_blueprint:SetBlueprintPropertyValue(property_name, value)

Parameters

TypeParameterDefaultDescription
stringproperty_name Required parameter Name of the Blueprint variable
anyvalue Required parameter La valeur à définir

See also GetBlueprintPropertyValue.


Moderate

UnbindBlueprintEventDispatcher​

Unbinds a Blueprint Event Dispatcher
my_blueprint:UnbindBlueprintEventDispatcher(dispatcher_name, callback?)

Parameters

TypeParameterDefaultDescription
stringdispatcher_name Required parameter Event Dispatcher name
functioncallback?nil
Optional callback to unbind

🚀 Événements​

Inherited Entity Events
Blueprint inherits from Base Entity Class, sharing it's events:
Base Entityscripting-reference/classes/base-classes/entity
NameDescription
ClassRegisterTriggered when a new Class is registered with the Inheriting System
DestroyTriggered when an Entity is destroyed
SpawnTriggered when an Entity is spawned/created
ValueChangeTriggered when an Entity has a value changed with :SetValue()
Inherited Actor Events
Blueprint inherits from Base Actor Class, sharing it's events:
Base Actorscripting-reference/classes/base-classes/actor
NameDescription
DimensionChangeDéclenché lorsqu'un Actor change de dimension
EnterWaterDéclenché lorsqu’un acteur entre dans une étendue d’eau
LeaveWaterDéclenché lorsqu’un acteur quitte une étendue d’eau
NetworkAuthorityChangeDéclenché lorsqu'un Acteur modifie son autorité sur le réseau
NetworkAuthorityChangeDéclenché lorsque le joueur local gagne/perd l'autorité du réseau sur cet Acteur

This class doesn't have own events.

✅ Liste des types de paramètres pris en charge​

Liste de tous les types de paramètres qui peuvent passer entre Lua ↔ Blueprint :

Type LuaType BlueprintLua → BPBP → Lua
booleanBoolean✅✅
numberByte✅✅
numberInteger✅✅
numberInteger64✅✅
numberFloat✅✅
numberEnum✅✅
stringString✅✅
stringName✅✅
stringText✅✅
Vector2DVector2D✅✅
VectorVector✅✅
RotatorRotator✅✅
ColorColor✅✅
ColorLinearColor✅✅
StaticMeshStaticMeshActor✅✅
PropStaticMeshActor✅✅
WeaponSkeletalMeshActor✅✅
Base VehicleWheeledVehiclePawn✅✅
GrenadeStaticMeshActor✅✅
MeleeStaticMeshActor✅✅
LightPointLight, SpotLight ou RectLight✅✅
DecalDecalActor✅✅
TextRenderTextRenderActor✅✅
Text3DText3DActor✅✅
SoundAmbientSound✅✅
CanvasMaterialInstanceDynamic✅❌
WebUIMaterialInstanceDynamic✅❌
SceneCaptureMaterialInstanceDynamic✅❌
BlueprintActor✅✅
WidgetWidget✅❌
Base ActorActor✅✅
PlayerPlayerController✅❌
Image PathTexture2D✅❌
stringClass✅❌
steam-avatar://MaterialInstanceDynamic✅❌
tableCurveFloat✅❌
tableTransform✅✅
tableSlateBrush✅✅
tableSlateFontInfo✅✅
tableAny Struct✅✅
Remarque

On ne peut passer des Actors de Blueprint → Lua que si l'Actor est une entité apparue (Spawned Entity). Il n'est pas possible de passer à Lua des Actors fraîchement apparus dans des Blueprints.

tip

Les Maps, Arrays et Sets peuvent aussi être passés ! Tant que leurs clés/valeurs font partie de la liste ci-dessus.

N'importe quelle struct​

Les structs personnalisées peuvent aussi être passées et récupérées : il suffit de passer un objet avec les mêmes propriétés que la struct Unreal, par exemple :

FTransform​

{
["Translation"] = Vector(),
["Rotation"] = Rotator(),
["Scale"] = Vector()
}

FSlateBrush​

{
["DrawAs"] = 0, -- ESlateBrushDrawType
["Tiling"] = 0, -- ESlateBrushTileType
["Mirroring"] = 0, -- ESlateBrushMirrorType
["ImageSize"] = Vector2D(),
["Tint"] = Color(),
["Image"] = "package://sandbox/Client/my_image.jpg", -- Special Path, or Canvas, WebUI, SceneCapture
["Margin"] = {}, -- FMargin
["OutlineSettings"] = {} -- FSlateBrushOutlineSettings
}

FSlateFontInfo​

{
["FontFamily"] = "package://my-package/Client/my_font.ttf", -- Special Path
["FontMaterial"] = "my-asset-pack::M_MyMaterial", -- Material Path
["OutlineSettings"] = {}, -- FSlateBrushOutlineSettings
["Typeface"] = "", -- string
["Size"] = 24,
["LetterSpacing"] = 0,
["SkewAmount"] = 0.0,
["Monospacing"] = false,
["MonospacedWidth"] = 1.0
}

FMargin​

{
["Bottom"] = 0.0,
["Left"] = 0.0,
["Right"] = 0.0,
["Top"] = 0.0
}

FVector4​

{
["W"] = 0.0,
["X"] = 0.0,
["Y"] = 0.0,
["Z"] = 0.0
}

UCurveFloat​

{
[0.0] = 0.0,
[0.25] = 0.8,
[0.5] = 1.0,
[0.75] = 0.3,
[1.0] = 0.0,
}