The fun .LUA commands thread
Moderator: Moderators
- skelltor
- Sith

- Posts: 1431
- Joined: Fri Dec 11, 2009 6:24 pm
- Projects :: BFSM
- xbox live or psn: skelltor95
- Location: minisnowta
- Contact:
Re: The fun .LUA commands thread
Oh but I don't want to have to edit the stock maps and I still want vehicles is there another way?
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: The fun .LUA commands thread
skelltor wrote:Oh but I don't want to have to edit the stock maps and I still want vehicles is there another way?
Have someone like me edit it gor you,
- skelltor
- Sith

- Posts: 1431
- Joined: Fri Dec 11, 2009 6:24 pm
- Projects :: BFSM
- xbox live or psn: skelltor95
- Location: minisnowta
- Contact:
Re: The fun .LUA commands thread
Ok thanks for the help guys
(sorry about offtopic talk)
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
skelltor wrote:Oh but I don't want to have to edit the stock maps and I still want vehicles is there another way?
DarthD.U.C.K. wrote:otherwise you will have to set this property via lua.
-
CalvaryCptMike
- Captain

- Posts: 476
- Joined: Sat Feb 19, 2011 3:10 pm
- Projects :: Nothing--absolutely nothing
- Location: Freed by alien robots, now living on Mars
- Contact:
Re: The fun .LUA commands thread
How would you go about doing that?
I've been looking for something like that.
I've been looking for something like that.
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
like that:
edit: well im not completely sure if vehiclespawns support properties via lua....but if they do it works like this.
Code: Select all
SetProperty("com_item_vehicle_spawn22", "ClassRepDEF", "rep_hover_fightertank") - Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: The fun .LUA commands thread
I don't believe vehicle spawns support their instance properties via lua (note that these are different kinds of properties than standard .odf properties). They can support basic properties of the vehicles they spawn, though - if, for example, you wanted to change the health of a vehicle spawned from a vehicle spawn, you could use SetProperty on the "CurHealth" property to modify it.DarthD.U.C.K. wrote:like that:edit: well im not completely sure if vehiclespawns support properties via lua....but if they do it works like this.Code: Select all
SetProperty("com_item_vehicle_spawn22", "ClassRepDEF", "rep_hover_fightertank")
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
im not sure whether instanceproperties arent different from other odfproperties since you can put any property under the instanceproperty-tag and it will become an instanceproperty.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: The fun .LUA commands thread
Really? I didn't know that, wow. Does that include sound-related properties?DarthD.U.C.K. wrote:im not sure whether instanceproperties arent different from other odfproperties since you can put any property under the instanceproperty-tag and it will become an instanceproperty.
Wait; if that were true, couldn't you use that for smoother weapon pickups?
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
i dont know about the details, i just found it out by accident once.
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: The fun .LUA commands thread
Fiodis wrote:DarthD.U.C.K. wrote:Wait; if that were true, couldn't you use that for smoother weapon pickups?
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: The fun .LUA commands thread
The thing about current weapon pickup systems is that they affect entire classes of units. If WeaponName can be made into an instance property, then you could have custom weapon pickups per unit rather than per class. I'm a little skeptic about it, though; how did you go about it, Duck?
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
i didnt go about anything! o.o
i just saw that an odfproperty would become editablein ze if it was put under indtanceproperties. thats all, i swear!
i just saw that an odfproperty would become editablein ze if it was put under indtanceproperties. thats all, i swear!
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: The fun .LUA commands thread
Ah. I'll take an educated guess and say it won't work with every odf property. 
Pity. Would've been fun.
Pity. Would've been fun.
- asleeponduty
- Private First Class
- Posts: 77
- Joined: Tue Jul 22, 2008 3:05 pm
- xbox live or psn: No gamertag set
- Location: Illinois
Re: The fun .LUA commands thread
Heres a fun command, courtesy of theITfactor:
What it does: spawns a timebomb on you when you destroy an object (this example uses 3 objects)
*Note to people of the world*
This requires you to make (or copy from assets...) your own timebomb ordnance and place it somewhere in the world so it will spawn when you execute this command.
Look in the REP assets and the COMMON assets to find the files
What it does: spawns a timebomb on you when you destroy an object (this example uses 3 objects)
Code: Select all
local eventSpawn = OnObjectKill(
function(object, killer)
if not killer then return end --do nothing if no killer
if not IsCharacterHuman(killer) then return end --do nothing unless killer is a human
local name = GetEntityName(object)
if (name == "OBJECTNAMEONE") or
(name == "ANOTHEROBJECT") or
(name == "YETANOTHEROBJECT") then
--make sure the player hasn't died already
local unit = GetCharacterUnit( killer )
if not unit then return end
--get the unit's location
local point = GetEntityMatrix( unit )
--drop a time bomb directly on the unit
CreateEntity("fun_weap_inf_timebomb_ord", point, "fun_weap_inf_timebomb_ord")
end
end
)This requires you to make (or copy from assets...) your own timebomb ordnance and place it somewhere in the world so it will spawn when you execute this command.
Look in the REP assets and the COMMON assets to find the files
- Firefang
- Major

- Posts: 518
- Joined: Mon Nov 15, 2010 8:55 pm
- Location: California
Re: The fun .LUA commands thread
I challenge thee!TK432 wrote:Beat this!
Here is the script to my unfinished disguise kit work around
video
Just change the variables according to you map and make sure that all the changes are loaded. Thats it. Keep in mind that this doesn't support skeleton changes, but won't crash if it isn't the proper skeleton and this isn't finished so yes the enemy will still shoot you.
Beta Disguise
Code: Select all
--beginning of variables
Disguise = "msh you will turn into"
Original = "original msh"
Unit = "unit with weapon"
Changeweapon = "change_ord"
Change = 1
Unchange = 0
Team = TEAMNAME (three letter team)
--end of variables
ChangeTimer = CreateTimer("ChangeTimer")
SetTimerValue(ChangeTimer, 2)
Changebody = OnCharacterDispenseControllable(
function(player,controllable)
if GetEntityClass(controllable) == GetEntityClassPtr(Changeweapon) and IsCharacterHuman(player) and Change == 1 then
AllowAISpawn(Team, false)
SetClassProperty( Unit, "GeometryName", Disguise)
spot = GetEntityMatrix(GetCharacterUnit(player))
KillObject( GetCharacterUnit(player) )
AddReinforcements(Team, 1 )
SelectCharacterClass(player,Unit)
SpawnCharacter(player, spot)
SetClassProperty( Unit, "GeometryName", Original)
AllowAISpawn(Team, true)
print("Change Complete")
Unchange = 1
Change = 0
end
end
)
Unchangebody = OnCharacterDispenseControllable(
function(player,controllable)
if GetEntityClass(controllable) == GetEntityClassPtr(Changeweapon) and IsCharacterHuman(player) and Unchange == 1 then
spot = GetEntityMatrix(GetCharacterUnit(player))
KillObject( GetCharacterUnit(player) )
AddReinforcements(Team, 1 )
SelectCharacterClass(player,Unit)
SpawnCharacter(player, spot)
print("Change Back Complete")
Unchange = 0
StartTimer(ChangeTimer)
end
end
)
Timer = OnTimerElapse(
function(timer)
Change = 1
DestroyTimer(ChangeTimer)
end,
ChangeTimer
)Weapon
Hidden/Spoiler:
Hidden/Spoiler:
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: The fun .LUA commands thread
wow, that really cool!
i couldnt resist trying to elaborate/extend it a bit:
it disguises the unit for the time of changetimer. its supposed to put the character in another team neutral to the enemyteam when used. when disguised it should also give him the health he had before disguising and the other way around.
edit: i changed it a bit so the enemyteam starts attacking you once you killed one of them.
i havent tested it however, its rather hypothetical. the things im not sure about is whether you use a characters name as input for setproperty, if the parameters for selectteam are correct and if the "player"-variableof the character changes during gameplay
i couldnt resist trying to elaborate/extend it a bit:
Hidden/Spoiler:
edit: i changed it a bit so the enemyteam starts attacking you once you killed one of them.
i havent tested it however, its rather hypothetical. the things im not sure about is whether you use a characters name as input for setproperty, if the parameters for selectteam are correct and if the "player"-variableof the character changes during gameplay
Last edited by DarthD.U.C.K. on Sat Mar 26, 2011 10:28 am, edited 3 times in total.
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: The fun .LUA commands thread
I Have to test this
Ok guys, AQT couldnt figure out my code, and mine, well, doesnt work as functioned
I tryed making a code(it so didnt work right, but did give me intersting unwanted results) for when a weapon ord hits you(or an AI enemy more like it)the player or ai switches teams. Since this is suppossed to be a mind trick weapon, it will prob not be used on a human player much. Unless you have AI heroes like I do.
My question is this, Is this even possible?
This isnt really offtopic is it? I figured we could try to come up with more fun lua commands as well.
Ok guys, AQT couldnt figure out my code, and mine, well, doesnt work as functioned
I tryed making a code(it so didnt work right, but did give me intersting unwanted results) for when a weapon ord hits you(or an AI enemy more like it)the player or ai switches teams. Since this is suppossed to be a mind trick weapon, it will prob not be used on a human player much. Unless you have AI heroes like I do.
My question is this, Is this even possible?
This isnt really offtopic is it? I figured we could try to come up with more fun lua commands as well.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: The fun .LUA commands thread
Yep; let me see if I can drag up my old code....THEWULFMAN wrote:I tryed making a code(it so didnt work right, but did give me intersting unwanted results) for when a weapon ord hits you(or an AI enemy more like it)the player or ai switches teams.
My question is this, Is this even possible?
EDIT - couldn't find it, so I'll just throw this together:
Code: Select all
OnObjectDamage(
function(object, damager)
if GetObjectLastHitWeaponClass(object) == "weapon_odf" then -- weapon_odf is the odf name of the weapon, not the ord
-- You can also add an aditional check (IsCharacterHuman) if you only want this to work/not work on humans.
SetObjectTeam(object, #) -- # is the number of the team to be set to
end
end
)You know, about a year ago I started putting together a LUA asset pack; essentially a bunch of custom scripts to do various things. I'll try and salvage them from the wreckage of my USB and post here what I get from it.
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: The fun .LUA commands thread
I think its time to prove the all mighty power of lua.
Last edited by THEWULFMAN on Sat Mar 26, 2011 1:46 pm, edited 1 time in total.
