item script Suicide {
void run() {
if(!this->isValid()) Link->HP = 0;
}
}This causes Link to die when attached to an item's pickup script, and then subsequently picked up.
item script Suicide {
void run() {
if(!this->isValid()) Link->HP = 0;
}
}This causes Link to die when attached to an item's pickup script, and then subsequently picked up.
I'm not sure that non-ffcs are supposed to have an 'this' pointer.
..Why do you even need to check if the item you are currently using or obtaining is valid? If it wasn't, there would be no script running. :\
Well, the original script look(s/ed) like this:
item script FlexibleLootPickup {
void run() {
for(int i = 0; LootList != 0; i++) {
if(LootList[i] == this->ID) {
LootCount[i]++;
return;
}
}
}
}The idea being that I just set the script and forget it.
In retrospect, though, I can understand why there [i]isn't a proper 'this' pointer, since the item doesn't actually exist any more by the time you pick it up! *shrug*
Ah! The lazy scripter syndrome.
You could use arguments for the item ID. Still very minimal work involved:
item script FlexibleLootPickup {
void run(int id) {
for(int i = 0; LootList[i] != 0; i++) {
if(LootList[i] == id) {
LootCount[i]++;
return;
}
}
}
}Well, if I'm going to do that, I may as well just pass the pickup number!
item script PhatLewt {
void run(int lewt) {
LootCount[lewt]++;
}
}(copied from my script file with irrelevant stuff removed)