jump.tf Forums
Welcome B)

Rocketnaming / soldier mouse2 prefab

Gorge004

  • Proficient
  • ****
    • Posts: 323
    • Frags: +1/-0
    • View Profile
Hello!

https://drive.google.com/file/d/1AoSDmv73DTQB2s24OUZP4O4wGQwQbSNv/view?usp=sharing

With jump jam coming soon I figured I'd post this incase some people feel brave enough or just want to try something fun. Also with the deep playtesting I received on swizzle since everyone has been playing the map all the time since release, I was able to find the last bug that was still in the logic, making this 100% unbreakable no lie no scam very true.

This is the rocketnaming logic system I've used for jump_virtuoso, jump_vertuosic, jump_tombrady and jump_swizzle. In short, it used the unique player naming system that Pants made, fixes some stuff on it, and add a logic system to it wich renames every rocket shot according to the player's name who shot it. This allows for targetting specific player's rocket with triggers, and put outputs on the rocket itself wich could target back the player. Since you control their name, you also control what or who they will target after that.

If that's not your thing, this prefab can also be used to add something to +attack2 to soldier. For example, if you want to add a velocity reset catapult to mouse2, this would be a great place to start!
I wouldn't remove the rocket naming system even if you're just going to use the mouse2 logic without ever using rocket's names, simply because the rocketnaming isnt gonna influence anything if you're not using it, and if you start deleting stuff in that prefab you may end up deleting something useful.

This works for serverse upto 24 players.

This also is for soldiers only. Everything is setup to work when you're soldier, and to do nothing when you're any other class. Unfortunately (or fortunately for some people) demo is a lot harder to work with, and a logic system like this won't work for them. Stickies do not interact with triggers, making stuff like this impossible.

HOW TO USE:
Ill try to keep this as simple as possible, and following those steps you will succeed, but missing to do something will most likely add unintended bug so be careful (:
  • Copy paste every entities from the prefab into your map
  • This includes the logic room with all buttons and logic entities per player, the spawn room with info_player_teamspawn inside with some filter entities, the player_namer trigger_multiple and 2 trigger_multiple together named soldiertrigger and demotrigger

logic room: https://cdn.discordapp.com/attachments/604424421041766426/798696964765253632/unknown.png
Spawn room: https://cdn.discordapp.com/attachments/604424421041766426/798697603503357982/unknown.png
player_namer: https://cdn.discordapp.com/attachments/604424421041766426/798697916549824552/unknown.png
trigger_multiple soldiertrigger and demotrigger: https://cdn.discordapp.com/attachments/604424421041766426/798727269123489812/unknown.png

  • Put the logic room anywhere in on the grid
  • Put the spawn room anywhere on the grid. This is used only to rename every player that spawns, then redirect them to the real spawn of your map
  • Put the player_namer covering the WHOLE map
  • Put the soldiertrigger and demotrigger around the start of your map. Not the spawn room of this prefab, but the real start of your map
  • Around the logic_room and around spawn room, there's a trigger_teleport with destination "spawn". You want the real spawn of your map, where player are suppose to be when they spawn in into your map, to be a info_teleport_destination with targetname "spawn". If you have a different name you will need to change the destination of those 2 trigger_teleport to that name.

trigger_teleport around logic room: https://cdn.discordapp.com/attachments/604424421041766426/798699255945887755/unknown.png
trigger_teleport around spawn room: https://cdn.discordapp.com/attachments/604424421041766426/798699460808278067/unknown.png

  • For the logic itself, I only included the logic for player 1, not the 23 other players. Reason for that is if you're gonna use this, you will need to add some outputs and/pr entities to this to do anything. Currently it renames every rocket but doesn't do anything else, so on its own this doesn't do anything. When making that much logic for 24 different players, you don't want to manually make outputs for 24 different players, you WILL end up making a mistake somewhere and it's gonna be very hard to debug after that. The one thing you need to be absolutely sure without a doubt is that every player's logics are exactly the same except they target the player's number name they're suppose to. So for the logic of player 1, wich is named p1 in the logic, every entity have p1 in their targetname. This makes every outputs in the whole logic of player1 have p1 in them too. We will get to how you should make the other 23 players logic later, just keep that in mind that you should always make the logic for p1, then copy paste it for other players.
  • Now that you have everything in your map, it's time to add w/e you want to add to make your cool gimmick. The I/O chain stops at 2 entities, this is where you want to add your stuff. There's a logic relay for mouse2 (p1relay2) and a logic_case for rocket naming (p1case_namer). They are easy to spot, they stand out outside the trigger_multiple:

logic_relay p1relay2: https://cdn.discordapp.com/attachments/604424421041766426/798702844320284672/unknown.png
logic_case p1case_namer: https://cdn.discordapp.com/attachments/604424421041766426/798702961563402300/unknown.png

Worth noting the prefab logic handles naming upto 5 different rockets. This can be changed to more but is usually never needed, 5 is more than enough

  • for the relay, its simple. Whatever you add on that relay will be done when you press attack2. If you don't want the player to be able to spam mouse2 stuff, it's your job to add an output to disable that relay and reenable it whenever needed.

For example, this would add a delay so you can only do mouse2 trigger once every 5sec: https://cdn.discordapp.com/attachments/604424421041766426/798704099184869416/unknown.png

You can also be more creative like adding triggers in the map wich enables the relay and have the relay disable itself on trigger. This means it can only be triggered once you touch w/e you need to touch in the map to enable the gimmick.
You can really do anything you want!

  • For the logic_case, each case represent a rocket name. Case1 = rocketp1-1, Case2 = rocketp1-2, Case3 = rocketp1-3, etc. In the outputs of the logic_case, currently it only renames the rockets:

https://cdn.discordapp.com/attachments/604424421041766426/798705255021412372/unknown.png

If you want to add some "attributes" to your rocket, this is the place to do it.

For example, I added a logic_relay named p1relay3 in this picture and made it so everytime a rocket is fired, that relay is triggered. So everytime you shoot, whatever is in p1relay3 will happen: https://cdn.discordapp.com/attachments/604424421041766426/798707285715058698/unknown.png

Usually tho it's gonna be a bit more complicated for rocket stuff. You will most likely want to "store" an output in the rocket to fire it later. This is done through OnUser outputs. If you know jump_swizzle for example, it adds a bunch of different OnUser output to the rocket, then theres different trigger on the pogo textures to fire those ouptut.

For example, this version would store an OnUser2 output to the rocket wich triggers p1relay3 when fired: https://cdn.discordapp.com/attachments/604424421041766426/798707073675165696/unknown.png

To fire the OnUser2 output, all you need is a trigger_multiple filtered for Rocket_Filter_named anywhere in the map wich would look like this:
https://cdn.discordapp.com/attachments/604424421041766426/798707881364684800/unknown.png
https://cdn.discordapp.com/attachments/604424421041766426/798707970166358026/unknown.png
https://cdn.discordapp.com/attachments/604424421041766426/798708034121498676/unknown.png

This will make it so every rocket that enters this trigger will fire its own OnUser2 output, wich is specific to each player since you added the OnUser2 output to the rocket of a specific player. So the rockets for player18, when sent a FireUser2 output, will fire its OnUser2 output, wich will trigger p18relay3. This is how you can handle having multiple logics for multiple people with only 1 trigger in the map

    [li]Same idea goes for the players too. If you want something specific to a player happen when he touches a trigger, you will need to first add the OnUser output when the player is named. This is done inside the p1relay_c_soldier:[/li][/list]

    https://cdn.discordapp.com/attachments/604424421041766426/798710204829138984/unknown.png

    The relay already has a few outputs, don't touch any of them. You can only add to this, you should never remove anything.

    Now comes the shitty source part. You are limited to 4 OnUser outputs per entity (OnUser1, OnUser2, OnUser3 and OnUser4). The logic system already takes up the first 3 for the player (OnUser1, OnUser2 and OnUser3) (rockets are free to use all 4 OnUser outputs). This leaves you with only OnUser4 to work with if you want something specific to happen for each player. You should NEVER add a OnUser1, and, unless you really know what you're doing, you should never add OnUser 2 and OnUser3 either. In most gimmick, only OnUser4 is enough. Most time you'll make a gimmick that does 1 thing and is map wide.

    There are alternatives way to add more onuser outputs with parented entities but that's too complicated to explain here. If you're curious, decompile jump_swizzle and lookup "ball_p1", thats how I added an additional 4 onuser output to each player using a soccer ball.

    Anyway, this is an example of how to add an OnUser4 output to the player. I added a p1relay4 relay in this and everytime FireUser4 is sent to the player, he will trigger it:
    https://cdn.discordapp.com/attachments/604424421041766426/798712724959133757/unknown.png


    *2021-03-29 update*
    I found a better way to handle specific player's output. The above still works, but you're limited to only 1 OnUser output since the logic uses already 3 of them.
    You can now have as many different output as you want using only 2 OnUser output, 3 total since the logic needs OnUser1 to work.

    The way it works now, I updated the download link for the upto date version, the logic assigns those OnUser output when any new player spawns, wich they will have until they leave the server:
    OnUser4 / p1counter_user / add 1 / 0s delay
    OnUser2 / p1counter_user / getvalue / 0s delay

    In the logic_case, set every case to an action/output for the player. Then put a trigger_multiple or button or w/e you want to trigger those output in the map, with outputs being:
    [whatever] / !activator / FireUser4 /0s
    [whatever] / !activator / FireUser2/0.01s

    This will make OnCase1 fire in the logic case. If you want OnCase2, just put 2 outputs for FireUser4
    [whatever] / !activator / FireUser4 /0s
    [whatever] / !activator / FireUser4 /0s
    [whatever] / !activator / FireUser2/0.01s

    And so on. You can have as many different outputs just using FireUser4 that way. You could have a trigger with 15 FireUser4 output and it will fire the Oncase15 of the logic_case. Always put 1 FireUser2 0.01s delay in those triggers.

    Note that the logic_case already uses OnCase1 and Oncase2 for dealing with switching class. So any new outputs need to be from oncase3 and up.

    • Now that you've added every entities and outputs you want, there is some stuff that needs to be done before you copy paste the logic over to other players. In short, the way this works, everytime you spawn as soldier every logic entities gets killed, then respawn. This makes sure there isn't any double of the same entity or something funky going on. Everytime you're soldier, the entities in the game are what you see in hammer. If you spawn as any other class, it kills every entities without respawning them, and if you leave the server it kills all your entities. So everytime you add an entity, you need to add it to that kill and respawn loop. This should be done everytime you add 1, don't wait till you added 10 entities and then forget what you added or you'll make mistakes

    This kill and respawn logic is done with 4 different entities:

    logic_relay p1relay_c_demo: https://cdn.discordapp.com/attachments/604424421041766426/798714434478538762/unknown.png
    logic_relay p1relay_c_soldier: https://cdn.discordapp.com/attachments/604424421041766426/798714606225719296/unknown.png
    logic_relay p_s_p1: https://cdn.discordapp.com/attachments/604424421041766426/798714729413083156/unknown.png
    point_template p_t_p1: https://cdn.discordapp.com/attachments/604424421041766426/798715309930053642/unknown.png

    p1relay_c_demo is when you spawn as any class that isnt soldier, it kills everything.
    p_s_p1 is when you leave the server, it kills everything
    p_t_p1 is the point template holding a template of every entities that are being kill every loop. This is what respawns them.
    p1relay_c_soldier is when you spawn as soldier, this kills everything then send a forcespawn to p1template to respawn everything 0.01s later.

    You should always have the same amount of kill inputs as there is templates in p_t_p1.

    the kill inputs are the same in all 3 relays.

    If you add an entity to the logic system, you need to add the kill input to all 3 above relays and add its targetname to a new template inside p_t_p1

    p_s_p1 and all other p_s_p* relays are not in the kill loop so they can still trigger when players are not in the server. It's an added security incase stuff goes wrong. they are triggered when any player leave the server and that they dont have a player assigned to them. i.e if someone leave the server, p_s_p19 will trigger if nobody is named p19 in the server.

    • finally, there is 1 origin addoutput in each player's p_r_p* relay:

    p_r_p1: https://cdn.discordapp.com/attachments/604424421041766426/798726298678591508/unknown.png

    the coordinate in that origin output needs to be changed to the "spawn" teleport destination (the real start of your map, not the spawn room in this prefab). This is to force every player to be teleported back to the start of the map if they end up leaving the initial spawn room on servers where its easy to teleport out to jumps with chat commands.

    • Now that you added everything and made sure everything was respawning correctly, it's time to copy paste the logic for the other 23 players. This is how you do this without forgetting an output or making a typo somewhere. This will ensure everything in p2 to p23 is exactly the same as p1 except named p2 to p23 instead of p1.

    First select all p1 entities: https://cdn.discordapp.com/attachments/604424421041766426/798718507037491240/unknown.png

    then shift drag to copy paste everything: https://cdn.discordapp.com/attachments/604424421041766426/798718749628563466/unknown.png

    While keeping everything selected, press ctrl + shift + R to open up the best, most useful and savior of jumping popup window: Search and Replace:
    https://cdn.discordapp.com/attachments/604424421041766426/798719276047138817/unknown.png

    You can now "Search: p1",  "Replace with: p2", "Find in: selection" and press replace all to change every instance of p1 to p2 in what you have selected, wich is p2 logic. This replaces EVERYTHING. Every keyvalue, targetnames, filters, outputs, output's parameters, everything.

    https://cdn.discordapp.com/attachments/604424421041766426/798720130326593596/unknown.png

    • Repeat previous step for the remaining 22 players, each time shift drag, and find and replace all for the correct p number.

    IMPORTANT: Do NOT move the trigger_multiple's origin that each player has! This one:
    https://cdn.discordapp.com/attachments/604424421041766426/798720488322236426/unknown.png

    Its offset for a reason, if you move it the rocketnaming will become inconsistent. You can move the brush around no problem, but its origin needs to be offset from its center exactly how it is in the prefab


    KNOWN BUGS:
    • This will make players with medium to high ping feel a weird stutter/lag when they move, especially when they just walk. This is coming from the game_ui wich is used to track the player's m1 and m2. Nothing to be done about this. You can definetly still jump normally for upto 100 ping, after that it becomes a bit harder. You will start to feel the stutter from 40-50ish ping without really impacting the gameplay tho.
    • If you go from soldier to spectator, you won't be able to free cam. This is due again to the game_ui being weird. I haven't found a way yet to track spectators but this is easily fixable by spawning as demo then going to spec, since spawning as demo kills the game_ui
    • If you make a rocket naming gimmick, know that pressing mouse1 with either shotgun or melee out could potentially break someone's else gimmick for 1 rocket. This is due to the fact that the trigger_multiple around the player that gets triggered by the rocket is enable only when you press m1 and disables itself when a rocket triggers it. This means that its only enable for 1 tick to rename your own rocket. If you m1 with melee/shotgun tho, the trigger gets enable and never gets disable since no rockets are triggering it. If you switch to rocket launcher and shoot a rocket then its like nothing happened. However, if another player is inside you, literally right on top of you, and he shoots a rocket, his rocket will be inside your trigger and inside his trigger. In this case, the rocket will hit both trigger at the same time and the result afaik is 50/50 wheither or not the rocket will be named for you or for him. The rocket can only have 1 targetname and the triggers will both give it a name at the same time, so its 50/50 wich one the rocket will end up with. This just happens for 1 rocket tho, since doing so will disable your trigger until you press m1 again.

    Happy gimmick mapping!
    « Last Edit: March 29, 2021, 03:59:53 PM by Gorge004 »



    Gorge004

    • Proficient
    • ****
      • Posts: 323
      • Frags: +1/-0
      • View Profile
    Updated download link.

    Found a better way to handle player's specific outputs. Instead of trying to deal with OnUser outputs, you can do everything you want with only 2. Details in main thread.

    Doesn't change anything to rocket naming and mouse2 triggers. It just gives you the ability to add as many specific player's outputs without worrying about the 4 OnUser output limit.