GoldenEye: Source Forums

  • November 22, 2024, 05:49:22 pm
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: LUA coding question  (Read 6933 times)

0 Members and 1 Guest are viewing this topic.

Doc.NO

  • 00 Agent
  • ***
  • Posts: 836
  • Reputation Power: 0
  • Doc.NO hides in shadows.
  • Offline Offline
LUA coding question
« on: March 13, 2009, 12:54:46 pm »

I have a map sending a server command on some events, using point_server_command. Wondering if there's a way to use that server command in a LUA coded gameplay? After checking the CB list, my hopes are low, but still wanted to ask.
Logged

Mark [lodle]

  • Retired Lead Developer
  • 007
  • *
  • Posts: 1,411
  • Reputation Power: 1
  • Mark [lodle] has no influence.
  • Offline Offline
Re: LUA coding question
« Reply #1 on: March 13, 2009, 01:46:33 pm »

hmmm, the ony way i think you can hax it is make a cvar and check its value in the onthink function
Logged

Doc.NO

  • 00 Agent
  • ***
  • Posts: 836
  • Reputation Power: 0
  • Doc.NO hides in shadows.
  • Offline Offline
Re: LUA coding question
« Reply #2 on: March 15, 2009, 12:42:21 pm »

thanks. I think the cvar trick will do it.
Logged

Doc.NO

  • 00 Agent
  • ***
  • Posts: 836
  • Reputation Power: 0
  • Doc.NO hides in shadows.
  • Offline Offline
Re: LUA coding question
« Reply #3 on: March 17, 2009, 07:59:27 pm »

Well I did it, and works great. If someone is interested, I used a trigger with a point_servercommand entity on the map


(bb_command is the point_servercommand)

And then, in the think() LUA CB:

Code: [Select]
	if(GetCVar("bb_mi6_score") == "1" and (GetTime() >= g_mi6_timer)) then
g_mi6_timer = GetTime() + 2;
-- any command you'd like goes here:
AddToTeamScore(TEAM_MI6,1);
elseif(GetCVar("bb_mi6_score") == "0") then
g_mi6_timer = 0;
end

I'm sure there is a better way to code that, but actually it works, and its all I want :P The only downside of this is the chat area spam on CVAR change.
« Last Edit: March 17, 2009, 08:01:21 pm by Doc.NO »
Logged

Mark [lodle]

  • Retired Lead Developer
  • 007
  • *
  • Posts: 1,411
  • Reputation Power: 1
  • Mark [lodle] has no influence.
  • Offline Offline
Re: LUA coding question
« Reply #4 on: March 17, 2009, 09:35:17 pm »

Ill add a flag to create cvar which will remove the spam on change but its good to see you got it working.
Logged

killermonkey

  • GES Programmer
  • Retired Lead Developer
  • GE:S Fanatic
  • *
  • Posts: 5,473
  • Reputation Power: 346
  • killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!
  • Offline Offline
    • DroidMonkey Apps
Re: LUA coding question
« Reply #5 on: March 18, 2009, 02:02:53 pm »

You can capture the chat spam with the OnPlayerSay(..) Lua function and use LUA to regexp the chat to find the string that is for changing a CVar and just deny the printing... PHEW
Logged

Mark [lodle]

  • Retired Lead Developer
  • 007
  • *
  • Posts: 1,411
  • Reputation Power: 1
  • Mark [lodle] has no influence.
  • Offline Offline
Re: LUA coding question
« Reply #6 on: March 18, 2009, 02:44:24 pm »

you high again monkey?
Logged
Pages: [1]   Go Up