Modme Forums
Menu:

How to access custom KVPs via GSC?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: dimakristally
I have a trigger in my map with a custom KVP called 'teleport_cost'. How can I get the value of this KVP via GSC? I have tried the following and it has not worked, I was specifically told that the cost was undefined.

trigger = GetEnt("teleport_trigger", "targetname");
teleport_cost = trigger.teleport_cost;

while (1 < 2)
{
    trigger waittill("trigger", player);
    player zm_score::minus_to_player_score(teleport_cost);
    // Do teleport stuff...
}
Please lend me your knowledge on how I can access this KVP via GSC. (Please do not suggest workarounds, I would like to use the KVP.)

Thanks!

Edit: fixed minus_to_player_score call, wrote it incorrectly from memory.


ModmeBot:

Reply By: Dan9977
Not a fix but "<2" is not necessary "while(1)" does the job, and make it minus the teleport cost not just 1500.


ModmeBot:

Reply By: dimakristally

Dan9977
Not a fix but "<2" is not necessary "while(1)" does the job, and make it minus the teleport cost not just 1500.


The <2 is an deadmau5 reference I know to minus the teleport cost. I typed this from another computer, it minuses the teleport cost in the actual script, I just wasn't thinking when I typed this out. Good catch ;)


ModmeBot:

Reply By: Abnormal202

mathfag
I don't think that's actually possible. You'll need to put a cost in manually or define it in the beginning of the script.

No, that's definitely possible. I think the script should work, but just to be sure, can you send us a picture of your KVPs in radiant?


ModmeBot:

Reply By: dimakristally

Abnormal202
mathfag I don't think that's actually possible. You'll need to put a cost in manually or define it in the beginning of the script. No, that's definitely possible. I think the script should work, but just to be sure, can you send us a picture of your KVPs in radiant?

Not at home but the KVP is called 'cost' with a value of 7500. Everything is fine on the radiant side.


ModmeBot:

Reply By: Abnormal202

dimakristally
Abnormal202 mathfag I don't think that's actually possible. You'll need to put a cost in manually or define it in the beginning of the script. No, that's definitely possible. I think the script should work, but just to be sure, can you send us a picture of your KVPs in radiant? Not at home but the KVP is called 'cost' with a value of 7500. Everything is fine on the radiant side.

if the KVP is just cost then you should be referencing it with:
teleport_cost = trigger.cost;
instead of:
teleport_cost = trigger.teleport_cost;