item script SlashScroll
{
void run()
{
if ( !(Game->Generic[GEN_CANSLASH]) ) Game->Generic[GEN_CANSLASH] = 1;
else Game->Generic[GEN_CANSLASH] = 0;
}
}
-----------------------------------------------------------------------------------------------------------
I want to modify the script so that the sword can do less damage when slashing. Either if you can affect the sword's power directly or having me use a separate sword with less power, I'm okay with both options. Thank you in advance.
Do you mean, that all swords have half power as soon as the player acquires the scroll?
global script OnContinue
{
void run()
{
HalfPowerSwords();
}
}
item script SlashScrollPickup
{
void run()
{
HalfPowerSwords();
}
}
void HalfPowerSwords()
{
itemdata id;
for ( int q = 1; q < 256; ++q )
{
if !(Game->Generic[GEN_CANSLASH]) { return; }
id = Game->LoadItemData(q);
if ( id->Family == IC_SWORD )
{
id->Power = id->Power * 0.5;
}
}
}
Assign the item pickup script to the Pickup slot of your slash scroll item, and assign the global script to the continue slot.