Scripting: Need help with ent_keyvalue

Discussion in 'Mapping Questions & Discussion' started by FrozenState, Aug 7, 2012.

  1. FrozenState

    FrozenState L1: Registered

    Messages:
    4
    Positive Ratings:
    0
    Recently, I have been asked by a friend to come up with a way to create an auto-build script on a server using various props that could be found in game. I have managed to find a way to create and put a prop into place using the Origin output, however when I try to convert the AddOutput string into ent_keyvalue, I encounter some problems.

    So far I have this...
    Code:
    // Aliases
    alias spawnprop "(Prop Directory)
    alias properties "ent_keyvalue xxxx origin"xxx xxx xxx"angles"xx xx xx
    
    // Script
    spawnprop;ent_setname prop
    ent_fire prop addoutput"hammerid xxxx
    wait 2;properties
    
    When I run this script, the script essentially works, however not in the way I intended. When the script is run, the prop spawned gets renamed and teleported to the map origin (being 0 0 0) however from there, only the first value of both Origin and Angles are accounted for.

    For example: If the code above was to be replaced by these values, the following would happen.

    Code:
    ent_keyvalue 0001 origin"123 456 789"angles"10 11 12
    would become
    Code:
    ent_keyvalue 0001 origin"123"angles"10
    As a result, only the first value (X) of both the Origin and Angles value can be manipulated, with the other 2 values (Y,Z) being changed automatically to 0.

    Whenever I use ent_fire (entity name) addoutput "origin 280 815 255" it works fine but I am trying to accomplish this through ent_keyvalue, to save both scripting space and prevent BufferOverflow errors in the console when too many addoutputs and entities are created in a map, which will only be solved by splitting up the script into two separate script files.

    Do you guys have any idea why this is happening? :confused: I attempted to put colons/semicolons/commas in between the values to try and solve this problem, but that did not work. Any help would be much appreciated...

    Additional Info: The server that will run this command will have sv_cheats 1 on and does not support SourceMod or any other types of plugins, which is why I am attempting to do this through scripting.