Page 3 of 3

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 1:24 pm
by Fiodis
THEWULFMAN wrote:I think its time to prove the all mighty power of lua.
See Rebel Ops, Spira: Besaid, etc.
THEWULFMAN wrote:And make it easy for people to use it.
See documentation, FAQ, and GT community.

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 1:45 pm
by THEWULFMAN
Fiodis wrote:
THEWULFMAN wrote:I think its time to prove the all mighty power of lua.
See Rebel Ops, Spira: Besaid, etc.
THEWULFMAN wrote:And make it easy for people to use it.
See documentation, FAQ, and GT community.

:oops: Okay, yes I was redundant in saying that we need to prove the all mighty power of lua. I have played all of Mav's maps and mods. So allow me to rephrase.

We can make it easier for people who are not: Mav, Zerted, Fiodis , D.U.C.K. or anyone who is crazy good with luas.
How is dropable weapons done? Could it be done:quotes: better? I dont think anyone other than Mav has done droppable weapons.

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 1:56 pm
by Fiodis
THEWULFMAN wrote:We can make it easier for people who are not: Mav, Zerted, D.U.C.K. or anyone who is crazy good with luas.
Fixed.
THEWULFMAN wrote:How is dropable weapons done? Could it be done:quotes: better? I dont think anyone other than Mav has done droppable weapons.
http://www.xfire.com/video/3bcdb3/
That's an old version of a script I was playing around with, based off Mav's idea that he used in Bakura. Since then I've expanded the system so that you can pick up and store up to two weapons in your "inventory" and then equip them into one of two customizable weapon slots. I didn't iron out all the bugs, though. I'm sure it could be done better; it's just a matter of experimentation.

Something on-topic which people may find useful:

Force Drain (based off of a Force Choke weapon)

Code: Select all

 OnObjectDamage(
         function(object, damager)
             if damager == nil then return end
             if GetCharacterTeam(damager) == DEF then
                 if GetObjectLastHitWeaponClass(object) == "com_weap_inf_force_choke" then
                     local unit = GetCharacterUnit(damager)
                     if unit == nil then return end
                     SetProperty(unit, "CurHealth", GetObjectHealth(unit) + 1)
                 end
             end
         end
            )

OnObjectDamage(
         function(object, damager)
             if damager == nil then return end
             if GetCharacterTeam(damager) == ATT then
                 if GetObjectLastHitWeaponClass(object) == "com_weap_inf_force_choke" then
                     local unit = GetCharacterUnit(damager)
                     if unit == nil then return end
                     SetProperty(unit, "CurHealth", GetObjectHealth(unit) + 1)
                 end
             end
         end
            )
It's not entirely efficient (see how it's broken up into two chunks?) but it gets the job done, basically. Haven't added any check for current health, yet, so unfortunately it'll keep adding health indefinitely, which might make for a very noobish weapon. I don't think it would be hard to put a cap on how much health can be drained, but I haven't done it yet (lazy, I know :P ). Enjoy.

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 2:10 pm
by THEWULFMAN
Still sweet :thumbs: , could it be switched so it drains stamina instead?

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 2:11 pm
by Fiodis
I'm afraid not; energy and ammo are much harder to work with via lua than health.

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 2:19 pm
by THEWULFMAN
Ok, still, if I can figure out how to put a check in their for the health, That IS going in my tcw mod. Along with force mind trick and others.

I came up with another idea. Could it be possible, :P

to have something like
This isnt in lua I know just stating my idea
Ord "name" enters region "name" = play anim "name" then, start timer = timer ends play sound "name"


:?

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 2:39 pm
by DarthD.U.C.K.
so you want to check if an ordnance entered a region? i think thats not possible, you could only put an invisible object there and check if its killed.

Re: The fun .LUA commands thread

Posted: Sat Mar 26, 2011 2:49 pm
by Fiodis
Or damaged. Still, there's the problem of ordances hitting thin air. Unless this region won't be too close, in which case it could work.

Re: The fun .LUA commands thread

Posted: Sun Mar 27, 2011 12:02 pm
by THEWULFMAN
I had this idea awhille back and was wondering if it was possible :P

Could it be scipted, so that depedning on what weapon you had selected, your addon mesh changed.

Like
Ifplayerweapon"weapon class" then setproperty"addon" "mesh name" else if player weapon "weapon class" setproperty"addon" "mesh name"
:?

Re: The fun .LUA commands thread

Posted: Sun Mar 27, 2011 12:04 pm
by Fiodis
Nope, not possible.

May I suggest we post code and go on-topic rather than go back-and-forth "is this possible" "no it is not" "how about this"?

Re: The fun .LUA commands thread

Posted: Sun Mar 27, 2011 12:06 pm
by THEWULFMAN
Agreed. I will stop now.


staff if you want you can delete everything back to the last mention of any real lua.