Data Realms Fan Forums http://868000.nnhp.asia/ |
|
Putting Actors In the Game with Lua http://868000.nnhp.asia/viewtopic.php?f=73&t=12048 |
Page 1 of 1 |
Author: | robowurmz [ Sat Aug 23, 2008 8:09 pm ] |
Post subject: | 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: Code: myPos = Vector() 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. Code: myActor.Pos = myPos 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. |
Author: | Tea [ Sat Aug 23, 2008 8:24 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
Oh you are cool. |
Author: | Azukki [ Sat Aug 23, 2008 9:10 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
These exact commands in this order, just to make it completely clear. Code: myActor = CreateAHuman( "Soldier Light" , "Base.rte" ) Code: myPos = Vector() Code: myPos:SetXY(200,100) Code: myActor.Pos = myPos Code: myActor.Team = 0 Code: MovableMan:AddActor(myActor); Anywho, pretty cool. I wonder if there's any combination of commands that can add a certain device to the selected actor's inventory? Or to pause and unpause the game, without exiting to the menu. |
Author: | robowurmz [ Sat Aug 23, 2008 9:13 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
This command might work: Code: myWeapon = CreateHDFirearm("Pistol") And then this one: Code: myActor:AddToInventory(myWeapon) These commands must be done before spawning. |
Author: | Azukki [ Sat Aug 23, 2008 9:24 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
Apparently not, unless I did something wrong. Hard to tell with the minuscule text. |
Author: | Alenth Eneil [ Sat Aug 23, 2008 9:32 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
myActor:AddInventoryItem("Pistol"); PS: Post threads like this in the lua section next time. |
Author: | The Fat Sand Rat [ Sat Aug 23, 2008 9:38 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
And how do I pause the game without the menu coming up, and how do I gib an actor/add to it's velocity? |
Author: | robowurmz [ Sat Aug 23, 2008 9:50 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
The Fat Sand Rat wrote: And how do I pause the game without the menu coming up, and how do I gib an actor/add to it's velocity? To gib an actor, I think you'll have to do something like this: Code: myGibActor = MovableMan:GetMOFromID(<i.d of MO object>) Where the ID is the number of a unit: i think it's in order of spawning. Then, you do this: Code: myGibActor.Vel = Vector(100, 0) Where those two variables are the X and the Y speed in Metres Per Second. To sum up, this code creates a new variable called myGibActor and assigns a living actor to it. Then the living actor's stuff can be edited. |
Author: | Grif [ Sat Aug 23, 2008 10:59 pm ] |
Post subject: | Re: Putting Actors In the Game with Lua |
Damn, we don't have lua on bunkermodules yet. Otherwise I'd be doing tons of stuff. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |