PlaceActorAtMe - ObjectReference
Member of: ObjectReference Script
Places a new Actor at this object's location.
Syntax[edit | edit source]
Actor Function PlaceActorAtMe(ActorBase akActorToPlace, int aiLevelMod = 4,
EncounterZone akZone = None) native
Parameters[edit | edit source]
- akActorToPlace: The ActorBase to base the new actor on.
- aiLevelMod: The level modifier to use.
- Must be one of the following:
- 0: Easy
- 1: Medium
- 2: Hard
- 3: Boss
- 4: None
- Default: 4
- Must be one of the following:
- akZone: The EncounterZone to use when placing the new actor.
- Default: None
Return Value[edit | edit source]
The new Actor that was just placed.
Examples[edit | edit source]
; Place a new wolf at this location - and have it attack the player
MarkerProperty.PlaceActorAtMe(WolfBaseProperty).StartCombat(Game.GetPlayer())
; Place a new boss bear at this location
MarkerProperty.PlaceActorAtMe(BearBaseProperty, 3)
Notes[edit | edit source]
-
A common mistake with PlaceActorAtMe is passing an object of type Actor as its akActorToPlace parameter. Attempting to do so will result in this compilation error:
type mismatch on parameter 1 (did you forget a cast?)
This is the same error as you would see if you were to use an ObjectReference as the first parameter of PlaceAtMe, which should be of type Form.
The first parameter of PlaceActorAtMe should be of type ActorBase. If you need to get an ActorBase from an Actor, use the GetBaseObject function.
Actor Property MyActor Auto ActorBase MyActorBase Event OnInit() MyActorBase = MyActor.GetBaseObject() as ActorBase EndEvent ; ... PlaceActorAtMe(MyActorBase) ; ...
GetBaseObject returns an object of type Form, which is the parent of ActorBase, so if you need to use any functions or properties defined in the ActorBase script make sure to cast the object before using it.
Note that GetActorBase can be used as shorthand for GetBaseObject when you're expecting an ActorBase:
MyActorBase = MyActor.GetBaseObject() as ActorBase ; Is functionally equivalent to... MyActorBase = MyActor.GetActorBase()
However, this shorthand function is the slower option and therefore not recommended.