Author |
Message |
Cakebones
Joined: Tue Nov 27, 2012 12:34 am Posts: 2
|
How to Spawn Bodies from Console?
Sorry if this is in the wrong placeI've been trying to spawn enemy bodies from the console for a while now, for testing matters. And I don't know how. I've looked at a few Lua tutorials, but they're just not helping with this. Anyone know how?
|
Tue Nov 27, 2012 12:49 am |
|
|
Abdul Alhazred
DRL Developer
Joined: Tue Aug 11, 2009 5:09 am Posts: 395
|
Re: How to Spawn Bodies from Console?
Copy and paste this in to the console: Code: a=CreateAHuman("Brain Robot") a.Pos=SceneMan:MovePointToGround(Vector(99,0),9,9) a.Team=0 MovableMan:AddActor(a)
|
Tue Nov 27, 2012 9:08 am |
|
|
Bad Boy
Joined: Fri Sep 10, 2010 1:48 am Posts: 666 Location: Halifax, Canada
|
Re: How to Spawn Bodies from Console?
This is a bit off-topic but since abdul already answered the question I hope it's okay.
Abdul I noticed you used a = ... instead of local a = ... Would that be local a or global a? I know the console can be used to change global variables but does it automatically write them as local? If that's the case, can you specify a variable as global from the console, e.g. global a = ...?
|
Tue Nov 27, 2012 7:05 pm |
|
|
Abdul Alhazred
DRL Developer
Joined: Tue Aug 11, 2009 5:09 am Posts: 395
|
Re: How to Spawn Bodies from Console?
I assume that 'a' will be a global, but haven't really thought about it. I just omitted the local to make the code as short as possible. If you want to know what variables and functions are global just print the contents of the _G table.
|
Tue Nov 27, 2012 8:47 pm |
|
|
Bad Boy
Joined: Fri Sep 10, 2010 1:48 am Posts: 666 Location: Halifax, Canada
|
Re: How to Spawn Bodies from Console?
Oh yeah, that's good to know; I'd forgotten all about _G table, thanks.
|
Tue Nov 27, 2012 10:02 pm |
|
|
Cakebones
Joined: Tue Nov 27, 2012 12:34 am Posts: 2
|
Re: How to Spawn Bodies from Console?
Abdul Alhazred wrote: Copy and paste this in to the console: Thanks so much.
|
Tue Nov 27, 2012 11:10 pm |
|
|
Pumone
Joined: Wed Dec 28, 2011 4:18 pm Posts: 86
|
Re: How to Spawn Bodies from Console?
I know the topic is very old and I'm sorry about that.
But is it possible to spawn bodies holding specific HDFIREARM?
|
Sat Oct 26, 2013 2:45 pm |
|
|
clunatic
Joined: Fri Nov 23, 2012 5:42 am Posts: 143
|
Re: How to Spawn Bodies from Console?
Code: a=CreateAHuman("Brain Robot") a.Pos=SceneMan:MovePointToGround(Vector(99,0),9,9) a.Team=0 a:AddInventoryItem(CreateHDFirearm("Medium Digger")) MovableMan:AddActor(a)
This should work.
|
Sat Oct 26, 2013 3:09 pm |
|
|
Pumone
Joined: Wed Dec 28, 2011 4:18 pm Posts: 86
|
Re: How to Spawn Bodies from Console?
Yeah it works! Thank you man
|
Sat Oct 26, 2013 4:27 pm |
|
|
nomnum
Joined: Fri Jun 15, 2012 3:22 am Posts: 10
|
Re: How to Spawn Bodies from Console?
Bad Boy wrote: Oh yeah, that's good to know; I'd forgotten all about _G table, thanks. Hey there... *rubs hands together* So uhh... Whats this _G table we speak of... and where can I find it O_o
|
Fri Nov 01, 2013 10:10 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: How to Spawn Bodies from Console?
I assume it's the same _G table as mentioned in the Lua documentation.
|
Sat Nov 02, 2013 1:48 pm |
|
|
|