Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Editing pre-existing entities with mapadd  (Read 1846 times)

0 Members and 1 Guest are viewing this topic.

Offline Nullen

  • *
  • *
  • +2% chance to make useful post
  • Nullen has no influence.
Editing pre-existing entities with mapadd
« on: April 16, 2015, 11:35:01 AM »
What's the mapadd command for editing entities that are already on the map? I remember seeing a stream a while back where the streamer was somehow able to run a Half-Life 2: Episode 2 map without the game crashing and he edited the fall damage trigger at the bottom of a cliff so that it doesn't do any damage.

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Editing pre-existing entities with mapadd
« Reply #1 on: April 16, 2015, 03:22:50 PM »
That kind of thing should be straightforward with a logic_auto. I use them all the time in my scripts.

Code: [Select]
"logic_auto" {
"keyvalues" {
"OnMapSpawn" "demo_charge*,addoutput,renderfx 10,0,-1"
"OnMapSpawn" "demo_charge*,addoutput,renderamt 0,0,-1"
"OnMapSpawn" "weapon_rpg,Kill,,0,-1"
"OnMapSpawn" "item_rpg_round,Kill,,0,-1"
"OnMapSpawn" "dispenser*,FireUser4,,0,-1"
                "spawnflags" "1" // Destroy after use
}
}

Offline Counter-Life™

  • *
  • *
  • +17% chance to make useful post
  • Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!
    • Youtube Channel
Re: Editing pre-existing entities with mapadd
« Reply #2 on: April 16, 2015, 04:35:19 PM »
That kind of thing should be straightforward with a logic_auto. I use them all the time in my scripts.

Code: [Select]
"logic_auto" {
"keyvalues" {
"OnMapSpawn" "demo_charge*,addoutput,renderfx 10,0,-1"
"OnMapSpawn" "demo_charge*,addoutput,renderamt 0,0,-1"
"OnMapSpawn" "weapon_rpg,Kill,,0,-1"
"OnMapSpawn" "item_rpg_round,Kill,,0,-1"
"OnMapSpawn" "dispenser*,FireUser4,,0,-1"
                "spawnflags" "1" // Destroy after use
}
}

Basically this, you have to find out the targetname of the entitie you want to edit tho, then add an output via the logic_auto.

Offline Nullen

  • *
  • *
  • +2% chance to make useful post
  • Nullen has no influence.
Re: Editing pre-existing entities with mapadd
« Reply #3 on: April 17, 2015, 01:11:23 PM »
Thanks y'all. So I have another question. Can the logic_auto method be used to edit the keyvalues of some NPCs built into the map itself? I've been wanting to give the smg a random chance to be replaced by the grease gun or mp5. I don't want to use npc_randomize_weapon for this because it's a little too restrictive for me. And if I use override_class on the smg the player can be affected by it.

Offline Counter-Life™

  • *
  • *
  • +17% chance to make useful post
  • Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!Counter-Life™ is a rising star!
    • Youtube Channel
Re: Editing pre-existing entities with mapadd
« Reply #4 on: April 17, 2015, 03:17:05 PM »
Thanks y'all. So I have another question. Can the logic_auto method be used to edit the keyvalues of some NPCs built into the map itself? I've been wanting to give the smg a random chance to be replaced by the grease gun or mp5. I don't want to use npc_randomize_weapon for this because it's a little too restrictive for me. And if I use override_class on the smg the player can be affected by it.

As far as I know weapons cannot be changed via Outputs/Inputs, but you can set other values (health, killing it, set on fire etc.)

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Editing pre-existing entities with mapadd
« Reply #5 on: April 17, 2015, 03:49:35 PM »
Thanks y'all. So I have another question. Can the logic_auto method be used to edit the keyvalues of some NPCs built into the map itself? I've been wanting to give the smg a random chance to be replaced by the grease gun or mp5. I don't want to use npc_randomize_weapon for this because it's a little too restrictive for me. And if I use override_class on the smg the player can be affected by it.

I've tried it before. Citizens have an input for this, GiveWeapon weapon_name, but you can't just edit the additionalequipment value on other gun-wielding NPCs to switch. You may be better off using a Lua script to search for NPCs, grab what info you can from them with HL2.GetEntInfo, remove the original NPCs, and spawn replacements with those values. If you're messing with the campaign, that should work for most cases since Valve heavily favored logic entities for triggered events. You won't find many NPCs using outputs.