Putting Actors In the Game with Lua
This is a tutorial on how to place actors with the Console. If you are reading it, read it thoroughly to prevent mistakes. Capitalization is extremely important.
The generic code is like this:
Code:
<variablename> = CreateActor( "<presetname in INI file>" , "<Mod .rte, can leave blank to look in all folders>")
So, to add a Light Soldier (in ram, I'll discuss plopping it ingame later) , you would logically have to do this:
Code:
myActor = CreateActor( "Soldier Light" , "Base.rte" )
However, this does not work because a Soldier is an AHuman. So you do this instead;
Code:
myActor = CreateAHuman( "Soldier Light" , "Base.rte" )
Does that mean to place him in game, all you have to do is this?
Code:
MovableMan:AddActor(myActor);
Not yet! We haven't given him any X Y co-ordinates yet! To do that, we write this:
This sets up a vector for X,Y positioning.
Code:
myPos:SetXY(200,100)
This will set the X and Y co-ordinates to somewhere in the sky, on the tutorial map, this places him in the little valley area with the crab.
Now to set the team.
Code:
myActor.Team = 0 (for player one)
Then we can do this:
Code:
MovableMan:AddActor(myActor);
Tadaah! You've just made an actor and placed him! You can repeat the last command to place a copy of him as many times as you want. I'll figure out other stuff later.
I'll try and get a gif of this in action if you want, but you have my guarantee, this works.