Entity Questions (Custom Powerups Mod)

Discussion in 'Mapping Questions & Discussion' started by Crimson, Sep 10, 2008.

  1. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    I have been working quite a while on a server side mod with some custom maps as part of a pack for TF2. I have been doing this alone so it is slow moving, but its getting there.

    Now heres the question. Its more for coding, but I figured you guys know the entities better than anyone. I want to create custom powerups, and since all of the maps for the pack are custom, I figured perhaps I can just insert an entity at the places I want to have the powerups, then use the code to modify those entities when the maps loaded.

    Here are the 2 Ideas:

    1) Have one entity that all powerups use, and differentiate them by name. So on map load, the plugin checks for an entity we will call "Health Boost". If it finds it, it sets all the properties such as the model for it to use, etc.

    2) Have seperate entities, one for each type of powerup, then just search for that entity type on map load.

    Basically I need the help of you guys finding a good pre-existing entity to use, since you cannot really create a completely new customized entity. The more that is already incorporated into the entity the better, so I don't have to make extremely heavy server side modifications for it to work.

    The biggest issue I see is it needs to be able to be picked up on contact. When a player walks over it, I will need to destroy the entity, put it on a X second timer before respawning it, and then give the powerup ability to that player. I thought about using an ammo box, or health pack, or something and just changing the model, but I am looking for an entity that would work better for this (I dont think those would).

    Any help you guys can provide would be excellent!

    *EDIT*

    Would Prop_Physics be the best for this? After looking at the valve wiki for a while, it looks like I could set the model for it, start it asleep, then use the "OnAwakened" property to destroy the entity and place the powerup on the player.
     
    Last edited: Sep 10, 2008
  2. Vicenti

    Vicenti L2: Junior Member

    Messages:
    52
    Positive Ratings:
    1
    You can't create new entities? I would think if you're programming a new mod you'd be able to just define new entities. Hammer lets me enter 'nonsense' entity names as actual entitise (func_bruhs for example)

    Then your map would have func_bruhs's in it and your game code would handle those according to your desires. At least, that's what I would expect.
     
  3. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Its not a standalone mod, its a server side mod for TF2.
     
  4. l3eeron

    l3eeron L8: Fancy Shmancy Member

    Messages:
    594
    Positive Ratings:
    86
    Im not a modder/coder but I would almost guarantee that this all can be done through source mod ;)
     
  5. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Sure it can, but it would be very ghetto and not efficient in the least. I would have to specify the location of where to spawn the entities in the code for each map I made. Every time I wanted to move them or make a new map, I would have to edit the code again, etc.

    Im going to attempt to do this using prop_dynamic, !activator, and a point_clientcommand entity and create some server console commands to activate it. I hope this works >.>
     
  6. Brandished

    Brandished L5: Dapper Member

    Messages:
    234
    Positive Ratings:
    300
    Your idea reminds me of UT2004. :p

    What might work is using a trigger_multiple entity at the "power-ups" location in the map to give the player that touched it a specific target name.

    Have an output something like:
    Output Named: OnStartTouchAll
    Target: !activator
    Input: AddOutput
    Parameter: targetname player_healthbonus

    Then you could use the I\O system to target player_healthbonus. You could also have the trigger_multiple disable itself and whatever model/brush entity you have representing it for a certain amount of time after the player touched it until it "wears off".

    When your powerup would run out, you could send an output to remove the targetname from the player that activated it by giving them a new targetname:

    Output Named: (OnEvent)
    Target: player_healthbonus
    Input: AddOutput
    Parameter: targetname player_normal
     
    Last edited: Sep 11, 2008
  7. teddyruxpin

    teddyruxpin Sr. Hygiene Technician

    Messages:
    83
    Positive Ratings:
    26
    Well if I where going to do this I would pick a set of entities that exist in all maps and have them change out with a set of sprites that are from the existing hl/tf/etc sdk kits. Bind the sprite to the existing locations of these items below and then have them change out on the map load using Stripper:Source rules and trigger_multiples as explained in the previous post. I would expand it further by having the trigger_multiples work with a servercommand entity and have it fire off various SourceMod plugins to give you the actual player power ups.

    Example

    Health pickups

    * item_healthkit_small = 100% Crits for 30 seconds ( Medigun Health Sprite )
    * item_healthkit_medium = 200% health boost for your team ( Diff Color of the same sprite but have 2 of them floating side by side)
    * item_healthkit_full = 250% Overhealer Ability ( Same deal with the medic gun sprites but now have 3 of them in a diff color )


    Ammo pickups

    * item_ammopack_small = 200% Ammo ( Use the Crit Sprites )
    * item_ammopack_medium = 150% Rate of Fire ( Use the dominate sprites )
    * item_ammopack_full = 150% Rate of Fire + 100% Crits (AKA Quad Damage ) ( use the skull and crossbones sprite from the sdk)

    So if a server owner would like this mod then they enable Stripper for that host or the specific maps and it would swap out the existing items for your custom ones and not have to deal with any hackery of models or large amounts of downloads etc.

    -Teddy