Home » Renegade Discussions » Mod Forum » Lua. Answers.
Lua. Answers. [message #449409] |
Mon, 04 July 2011 09:57  |
hego64
Messages: 19 Registered: April 2011 Location: Hegoville
Karma: 0
|
Recruit |
|
|
Look. I know I have posted a lot about this. Thing is, I just want a straight answer. How can I edit/use this function.
function myscript:Killed(ID, obj, killer)
print("Killed", ID, obj, killer)
end
All I need is to know HOW to use this and make it work for what I want.
Quote: | When a player not in spectate mode dies, he/she turns into a spectator and someone else in spectate mode dies and spawns to take their place. I'm not sure how to do this, or if it is even possible. Any help would be appreciated 
Thanks,
Hego64
|
Just someone please help me out with this, and I can get out of everyone's hair here for awhile.
-Hego64
|
|
|
|
|
|
Re: Lua. Answers. [message #449480 is a reply to message #449472] |
Wed, 06 July 2011 16:55   |
hego64
Messages: 19 Registered: April 2011 Location: Hegoville
Karma: 0
|
Recruit |
|
|
Thanks! I was able to make the spectate work now. But I have one more problem...
This is what I currently have in LUA.
function OnObjectCreate(o)
if Is_A_Star(o) then
Attach_Script_Once(o, "myscript", ""
end
end
myscript = {}
function myscript:Killed(ID, obj, killer)
print("Killed", ID, obj, killer)
end
if KpID ~= -1 then
InputConsole("spectate %d", pID)
Register_Script("myscript", "", myscript)
end
I do not know what is wrong with this. But when I try it in-game, this is what happens.
- Type/chat does not show up.
- Whenever we do type, we are sent to spectate and the second time we die and spawn. Happens regardless of what you type.
- I still get an FDS error saying I can't have more than one script named myscript. I do not know why this happens, because I have checked and I have only ONE myscript function with that. What can I do to rename this or something to fix it? I really need the chat fixed too.
I don't know what else to do...can anyone help me to figure out what I did wrong in this?
Thanks,
-Hego64
|
|
|
Re: Lua. Answers. [message #449492 is a reply to message #449480] |
Thu, 07 July 2011 00:12   |
snazy2000
Messages: 67 Registered: December 2007
Karma: 0
|
Recruit |
|
|
local killedtimes = 0
function OnObjectCreate(o)
if Is_A_Star(o) then
Attach_Script_Once(o, "Killed_Speccript", "")
end
end
Killed_Speccript = {}
function Killed_Speccript:Killed(ID, obj, killer)
print("Killed | ID - %d", ID)
if killedtimes == 0 then
InputConsole("spectate %d", ID)
killedtimes = 1
else
killedtimes = 0
end
end
Register_Script("Killed_Speccript", "", Killed_Speccript)
Haven't done LUA in a long time but i think that should work
[Updated on: Thu, 07 July 2011 00:30] Report message to a moderator
|
|
|
|
|
Re: Lua. Answers. [message #449780 is a reply to message #449409] |
Wed, 20 July 2011 18:09  |
iRANian
Messages: 4311 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Try moving all the LUA files out of the LuaPlugins folder and adding the text from this link as .lua file in there:
http://pastebin.com/PxFetuHZ
It's a build server script made by jnz, see if it causes the FDS console window to complain about the registering scripts stuff like it does with your code.
|
|
|
Goto Forum:
Current Time: Mon Feb 24 23:08:44 MST 2025
Total time taken to generate the page: 0.00799 seconds
|