Hello! Sorry to bother you. Crone here.
I’m having an issue with tag-based scripting (because it should be easy and therefore is ruining my life. Apparently, my constants are all messed up.
I don’t know how or why. I just know that X2_ITEM_EVENT_ACQUIRE == 0 in my case, whereas in the toolset, it claims to be equal to 4. Basically, X2_ITEM_EVENT_ACQUIRE fires as though it were X2_ITEM_EVENT_ACTIVATE.
Why might that be so? I feel like it’s an overriding script thing, but after throwing out my override folder, there was no change to the (very odd) constant values. Creating a blank, non-custom-content module does not change this result, either.
I don’t have much expertise, so I would very much appreciate any and all leads you might have.
Here’s some lousy code to look at:
//* Script for the dagger potentially acquired in
//* besieged00. Minor storyline implications(?)!
//*
#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedEventNumber();
object oPC;
object oItem;
int nHP;
effect eDeath;
int nResult = X2_EXECUTE_SCRIPT_END;
switch(nEvent) {
case X2_ITEM_EVENT_ACQUIRE:
oPC = GetModuleItemAcquiredBy();
oItem = GetModuleItemAcquired();
if(!GetLocalInt(oPC, "acq_dagger")) {
AssignCommand(oPC, ClearAllActions(TRUE));
SendMessageToPC(oPC, "dagger: get");
/*AssignCommand(oPC, ActionStartConversation(oPC, "dag_princess00",
FALSE, FALSE));*/
}
break;
case X2_ITEM_EVENT_ACTIVATE:
oPC = GetItemActivator();
oItem = GetItemActivated();
nHP = GetCurrentHitPoints(oPC);
eDeath = EffectDamage(nHP, DAMAGE_TYPE_SLASHING,
DAMAGE_POWER_NORMAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPC, -1.0f);
break;
default: break;
}
SetExecutedScriptReturnValue(nResult);
}
Thanks for any and all aid!
(Don’t mind the Sudden Death event. Literally just made in order to see if tag-based scripts were working as intended. Spoiler: they were not.)
Edited due to code updates