Author |
Message |
Dal
Joined: Mon Dec 10, 2007 9:54 pm Posts: 250
|
Simple Lua requests thread.
Figured we could use one instead of spawning a topic for every little thing. To start us off, I'm looking to restrict the player drop zones; how would I move any rocket or dropship on my team to a specified area (if not already there)?
|
Tue Aug 26, 2008 10:46 am |
|
|
Roon3
Joined: Sun May 11, 2008 12:50 pm Posts: 899
|
Re: Simple Lua requests thread.
Code: for actor in MovableMan.Actors do if (actor.ClassName == ACDropship or actor.ClassName == ACRocket) then if SceneMan.Scene:WithinArea("<blablabla>", actor.Pos) then actor.Pos.X = < area you want him to go to here>; actor.Vel.X = actor.Vel.X; actor.Vel.Y = actor.Vel.Y; end end end
Cover the map top with that and you should be done. Also how do you give velocity to the weapon the actor is currently holding?
Last edited by Roon3 on Tue Aug 26, 2008 12:43 pm, edited 1 time in total.
|
Tue Aug 26, 2008 11:08 am |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Simple Lua requests thread.
So this way we can force people to use the landing pads in my maps? This stuff rocks.
|
Tue Aug 26, 2008 11:32 am |
|
|
Dal
Joined: Mon Dec 10, 2007 9:54 pm Posts: 250
|
Re: Simple Lua requests thread.
Thought you'd enjoy that one as well, Gotcha. Thanks for the help, Roon. Is there a way to set up an 'If not' trigger so we don't have to cover the top of the map? Edit: I don't think we have control over individual items yet. (:() Someone could probably tell you how to make all weapons going flying across the room, though.
|
Tue Aug 26, 2008 11:38 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Simple Lua requests thread.
Dal wrote: Thought you'd enjoy that one as well, Gotcha. Thanks for the help, Roon. Is there a way to set up an 'If not' trigger so we don't have to cover the top of the map? Edit: I don't think we have control over individual items yet. (:() Someone could probably tell you how to make all weapons going flying across the room, though. I'm not at my computer at the moment, but I am pretty sure that there is MovableMan.HeldDevices or something of the sort.
|
Tue Aug 26, 2008 1:03 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Simple Lua requests thread.
Dal wrote: Thought you'd enjoy that one as well, Gotcha. You betcha. With all this new stuff to add I'll even have to hire new staff to help me out.
|
Tue Aug 26, 2008 1:28 pm |
|
|
Normandy
Joined: Sun Nov 11, 2007 5:08 pm Posts: 11
|
Re: Simple Lua requests thread.
Would it be possible to allow actors to pick up explosives this way?
I was thinking something along the lines of 'Actor picks up Weapon, which activates script that destroys the weapon while adding the actual explosive to the actor's inventory'.
|
Tue Aug 26, 2008 9:41 pm |
|
|
coilgunner4
Joined: Tue Aug 26, 2008 11:38 pm Posts: 26 Location: Kansas (contrary to popular belief Kansas does in fact have computers)
|
Re: Simple Lua requests thread.
Someone should make a lua Landmine, like a butterfly mine or just something simple like a pressure sensitive type. That would be tight, I'm still reading up on Lua but I should get there soon.
|
Tue Aug 26, 2008 11:41 pm |
|
|
CandleJack
Joined: Sun May 18, 2008 8:30 am Posts: 732
|
Re: Simple Lua requests thread.
Someone should make a spaceship mission that has 0 gravity, but the inside of the ship uses lua to simulate artificial gravity. They go away after destroying the reactor9which is the mission objective). After that, you have to get to the escape pod room and escape(I have no idea if lua can replace actors with other actors).
|
Tue Aug 26, 2008 11:46 pm |
|
|
coilgunner4
Joined: Tue Aug 26, 2008 11:38 pm Posts: 26 Location: Kansas (contrary to popular belief Kansas does in fact have computers)
|
Re: Simple Lua requests thread.
CandleJack wrote: Someone should make a spaceship mission that has 0 gravity, but the inside of the ship uses lua to simulate artificial gravity. They go away after destroying the reactor9which is the mission objective). After that, you have to get to the escape pod room and escape(I have no idea if lua can replace actors with other actors). that's intense
|
Wed Aug 27, 2008 12:17 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Simple Lua requests thread.
Could someone help me remove a helddevice from an actor's inventory? Right now, I've got Code: for actor in MovableMan.Actors do if SceneMan.Scene:WithinArea("objectivereturnarea", actor.Pos) and actor.HeldDevice==objective and actor.Team == 0 then self.RedTeamPoints = self.RedTeamPoints + 1; actor.RemoveItem("objective"); print (self.RedTeamPoints); end end objective is the HeldDevice. As is, I get the following in the console when the if conditions are met. Quote: ERROR [line of RemoveItem] attempt to call field 'RemoveItem' (a nil value)
|
Wed Aug 27, 2008 12:40 am |
|
|
robowurmz
Joined: Thu Aug 16, 2007 10:09 am Posts: 163
|
Re: Simple Lua requests thread.
Your problem there is that the function RemoveItem doesn't actually exist. Try gibbing the helditem. We could make a weapon stripper outside the enemy base in a campaign. Just like Half Life 2!
|
Wed Aug 27, 2008 7:55 am |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
Re: Simple Lua requests thread.
Heh, first loop through all the weapons and make them forcefully drop and them gib them right away. Although what would be funny if someone was carrying a powerful plasma cannon with a fragile energy cell that is ment to explode if an enemy hits there (a character flaw, you know.) and if someone unfortunate carrying that or a bomb, he's gone for good.
Maybe theres a Delete() function that would simply make the gun go "poof"?
|
Wed Aug 27, 2008 12:32 pm |
|
|
war_man333
Joined: Sun Nov 11, 2007 1:49 pm Posts: 785
|
Re: Simple Lua requests thread.
robowurmz wrote: Your problem there is that the function RemoveItem doesn't actually exist. Try gibbing the helditem. We could make a weapon stripper outside the enemy base in a campaign. Just like Half Life 2! Ok lua isn't so bad afterall!
|
Wed Aug 27, 2008 8:06 pm |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Simple Lua requests thread.
robowurmz wrote: Your problem there is that the function RemoveItem doesn't actually exist. Try gibbing the helditem. We could make a weapon stripper outside the enemy base in a campaign. Just like Half Life 2! How would I select it in order to gib it though?
|
Wed Aug 27, 2008 11:58 pm |
|
|
|