Sign In Register

How can we help you today?

Start a new topic

Running a LogEventRequest from real time script issue

So I'm having issues trying to execute a LogEventRequest inside of a realtime script. I followed the loot drop tutorial (https://docs.gamesparks.com/tutorials/currencies--virtual-goods-and-achievements/loot-drop-and-gacha-systems.html) to create my loot drop event. Tested it in test harness as well as calling it from inside UE4, and it is working properly. But I don't want to call it inside UE4 in order to prevent cheating and would pefer to call it in a realtime script. However, when I try and call it from inside a realtime script I can not get it to work. I have to be doing something wrong, but I went through all the docs and forum posts to make sure I was doing it right, so I'm currently stuck. Here is my code for the realtime script, I'm just trying to get the shortCode for the first Item it the lootDrop response. The loot_drop event code I'm using is from the tutorial page as is.


RTSession.onPacket(202, function(packet){

    var rtData = RTSession.newData();

    var request = RTSession.newRequest().createLogEventRequest();

    request.setEventKey("loot_drop");

    request.SetEventAttribute ("amount", 1);

    request.setPlayerId(packet.getSender().getPlayerId());

    var response = request.Send();

    var scriptData = response.scriptData.lootDrop[0].shortCode;

    rtData.setString(1, scriptData);

    RTSession.newPacket().setOpCode(200).setData(rtData).send();

});


1 person has this question

Hi Alexander,


Could you try logging the response you receive using:


RTSession.getLogger().debug("Got response: " + JSON.stringify(response));


It would appear from your request history that the 'lootDrop' field in this event's response contains an int as opposed to an array.


Regards,

Vinnie



i have a similar issue, any update on this?

Login to post a comment