• Print

Author Topic: Modifying Trouble in Terrorist Town.  (Read 5904 times)

0 Members and 1 Guest are viewing this topic.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Modifying Trouble in Terrorist Town.
« on: July 28, 2013, 09:12:08 am »
As I know, the Ulysses Team isn't too familiar with TTT (at least not Megiddo as far as I know?), although, I will post here, because you might still be able to help me.

The story behind trying to modify TTT, is this:
I'm trying to modify it so that even though it's pretty much TTT, but based on the game/mod called "Hidden". It's like this: whoever is "Hidden" is invisible and does not really have any guns to use, except for the poltergeist, newton launcher and so on (it's sort of irrelevant to the thread, but I'm adding it anyways). While the "Hunter(s)" are basically detectives, so they have UMPs and such.

Although there's something I've been trying to do, and I'm not sure if I am on the right track, or I'm completely lost.
What I want to do, is basically use ULX's cloak function to cloak the "Hidden", and what I've done is do this

Code: Lua
  1. local function CloakPlayers (ply)
  2.         for k, v in pairs (player.GetAll() do
  3.                 if v:IsRole(ROLE_TRAITOR) then
  4.                 v:ConCommand("ulx cloak", v:Nick())
  5.                 end
  6.         end
  7. end
  8.  

Now, first of all I need to make this trigger when the hook "TTTBeginRound" is called, although, I'm not sure how.
And two, I need to verify if I'm targetting the people right, and if I'm even using "ConCommand" correctly.

Any help is appreciated, and if you need more information, I'll see what I can do.
Thanks in advance!
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Modifying Trouble in Terrorist Town.
« Reply #1 on: July 28, 2013, 10:00:36 am »
Just some quick points to get you (more) on your way.
Are you already passing (ply) to the command? If so, is it a single player, or a table of multiple?
If single, don't go through the for loop.
If multiple, don't go through a table of all players, just go through whats passed.

I also wouldn't recommend ulx console commands in a game mode.
Personally, I wouldn't want a game mode to 'rely' on ULX to function, enhance maybe, but not rely.
If you must just absolutely use ULX, call the functions the console commands use instead, not the console command itself.
« Last Edit: July 28, 2013, 10:03:53 am by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Modifying Trouble in Terrorist Town.
« Reply #2 on: July 28, 2013, 10:02:48 am »
I was thinking about finding a workaround to that, and I'm not sure if I could modify it so that the playermodel became invisible. Although, in theory it should be possible using the RGB code of opacity or whatever. Thanks for the tip, JamminR.

EDIT: Heh. How would I actually call the function? (Yes, I'm a newb, I'll actually look it up and see how I'm gonna do that on the wiki or something).
« Last Edit: July 28, 2013, 10:05:10 am by Decicus »
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Modifying Trouble in Terrorist Town.
« Reply #3 on: July 28, 2013, 10:04:35 am »
Edited my orginal post - again.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Modifying Trouble in Terrorist Town.
« Reply #4 on: July 28, 2013, 10:10:34 am »
I'm actually not sure if I'm already passing it. How would I find that out?

Also, it's gonna be multiplayer, technically, it requires at least 2 people to play it.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Modifying Trouble in Terrorist Town.
« Reply #5 on: July 28, 2013, 11:55:19 am »
Experiencing God's grace one day at a time.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Modifying Trouble in Terrorist Town.
« Reply #6 on: July 28, 2013, 12:07:31 pm »
THAT'S IN ULIB!?

Man, I feel a bit stupid, I looked up cloak, but nada. Didn't think about "invisible". Thanks a lot, Megiddo. I should've searched more in ULib about that.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Modifying Trouble in Terrorist Town.
« Reply #7 on: July 30, 2013, 01:23:56 pm »
Sort of re-using this thread because it's related to the main topic:

When the round in TTT (well, the modified version of it) begins, it triggers some "ConCommands", and I have multiple of them in fact. I want to put a delay between each ConCommand, but I can't find it while searching Google. I might just be using the wrong keywords, but I still need help with this.

So Lua masters, give me a little boost?
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Modifying Trouble in Terrorist Town.
« Reply #8 on: July 30, 2013, 03:45:42 pm »
Try something like this.

Code: [Select]

local timerinterval = 3

timer.Simple( timerinterval * 1, function()
     Code to run here
end )

timer.Simple( timerinterval * 2, function()
     Code to run here
end )

timer.Simple( timerinterval * 3, function()
     Code to run here
end )

timer.Simple( timerinterval * 4, function()
     Code to run here
end )


There are more streamlined ways to do it, but that is the easiest I could think of. All you need to do is make the timerinverval variable at the top how long between the console commands you want. Replace 'Code to run here' with the Console Command code you have currently. For each timer, make sure you increment the multiplication by one. Make more or remove some if you need to.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Modifying Trouble in Terrorist Town.
« Reply #9 on: July 30, 2013, 04:52:03 pm »
I think I get it, thanks.

I assume if I want to make them trigger like... 0.1 seconds after each other, I just change "local timerinterval = 3" to "0.1"?
And also, something I forgot to mention, can I make these timers trigger with a hook somehow? It might be pretty simple, but when I looked around about "timer.Simple", I didn't really find anything that helped me.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

  • Print