Can't find any information regarding the new DataService.
M
Matthew Spencer
started a topic
almost 5 years ago
I have absolutely no idea if I'm doing this right and I can't find ANY information regarding updating specific fields. Here is how I add a monster object to my player:
var API = Spark.getGameDataService();
var entry = API.createItem("MONSTER", Spark.getData().ID);
var data = entry.getData();
data.name = Spark.getData().NAME;
data.type = Spark.getData().TYPE;
data.level = Spark.getData().LEVEL;
data.defense = Spark.getData().DEFENSE;
data.attack = Spark.getData().ATTACK;
data.agility = Spark.getData().AGILITY;
data.actionPoints = Spark.getData().ACTIONPOINTS;
data.slot = Spark.getData().SLOT;
data.id = Spark.getData().ID;
data.hunger = Spark.getData().HUNGER;
data.lastMeal = Spark.getData().LASTMEAL;
data.playerId = Spark.getPlayer().playerId;
var status = entry.persistor().persist().error();
if(status){
Spark.setScriptError("ERROR", status);
Spark.exit();
}
This works perfectly fine (although have no idea if I'm doing it correctly) and I can request and show the monsters, but have no idea how I would go about updating a single field like level or hunger. Could someone point me to where the documentation is or let me know how to do it? Thanks :)
Matthew Spencer
I have absolutely no idea if I'm doing this right and I can't find ANY information regarding updating specific fields. Here is how I add a monster object to my player:
This works perfectly fine (although have no idea if I'm doing it correctly) and I can request and show the monsters, but have no idea how I would go about updating a single field like level or hunger. Could someone point me to where the documentation is or let me know how to do it? Thanks :)
1 person has this question