Adjusted to check if ITV has already been learned

Idea from tyrones PR https://github.com/SWG-Source/dsrc/pull/77
This commit is contained in:
Reedux
2020-01-11 15:25:37 +00:00
parent 0e8f027a40
commit af290ce781
3 changed files with 7 additions and 2 deletions
@@ -7,3 +7,4 @@ tcg_itv_home callforsolarsailerpickup
tcg_itv_location callforg9riggerpickup
itv_snowspeeder callforsnowspeeder
itv_slave_1 callforslave1pickup
default_itv callforpickup
@@ -7,3 +7,4 @@
sharedTemplate = "object/tangible/veteran_reward/shared_instant_travel_terminal.iff"
scripts = ["systems.veteran_reward.instant_travel_terminal_deed", "item.special.nomove"]
persistByDefault = true
objvars = +["default_itv" = 1]
@@ -30,16 +30,19 @@ public class instant_travel_terminal_deed extends script.base_script
sendSystemMessage(player, "Instant Travel vehicles may not be used until you have reached level " + minLevelSetting + ". Please use this deed again when you reach level " + minLevelSetting + " or higher.", null);
return SCRIPT_CONTINUE;
}
// Make sure the default_itv is always at the bottom of the table else you will get false hits
int rows = dataTableGetNumRows(ITV_COMMAND_TABLE);
for (int i=0;i<rows;i++) {
if (hasObjVar(self, dataTableGetString(ITV_COMMAND_TABLE, i, 0))) {
if (hasCommand(player,dataTableGetString(ITV_COMMAND_TABLE, i, 1))) {
sendSystemMessageTestingOnly(player, "You have already used this item.");
return SCRIPT_CONTINUE;
}
grantCommand(player, dataTableGetString(ITV_COMMAND_TABLE, i, 1));
destroyObject(self);
return SCRIPT_CONTINUE;
}
}
grantCommand(player, "callforpickup");
destroyObject(self);
}
return SCRIPT_CONTINUE;
}