What i want feels like it should be pretty straightforward; here i have a powerup that will increase your movement speed permanently, in a game world that has one single, continuous hub. I have plans for a number of permanent upgrades, such as a damage resistance upgrade, a jump ability upgrade, etc.
I tried using a token system as suggested by another thread on here, but no matter what i do, i just cant seem to get the powerup to carry into another level. I am probably using the token wrong.
Code: Select all
class speedmod : PowerupGiver
{
Default
{
+COUNTITEM;
+INVENTORY.ALWAYSPICKUP;
+INVENTORY.AUTOACTIVATE;
+INVENTORY.HUBPOWER;
+INVENTORY.PERSISTENTPOWER;
Inventory.Icon "UPG4A0";
Tag "Speed Module";
Speed 1.5;
Powerup.Type "PowerSpeed";
Inventory.PickupMessage "Picked up a speed module; movement speed has been increased by 50%!";
}
States
{
Spawn:
UPG4 A -1 Bright;
Loop;
Pickup:
UPG4 A 0
{
A_GiveInventory("SpeedToken");
A_GiveInventory("ambPowerSpeed");
}
Stop;
}
}
class ambPowerSpeed : PowerSpeed
{
Default
{
+INVENTORY.HUBPOWER;
+INVENTORY.PERSISTENTPOWER;
Speed 1.5;
Powerup.Duration 0x7FFFFFFF;
Powerspeed.NoTrail 1;
}
}
class SpeedToken : Inventory
{
Default
{
+INVENTORY.UNDROPPABLE;
}
override void Travelled()
{
if (Owner != null)
{
Owner.GiveInventory('speedmod', 1);
}
}
}
Code: Select all
script 3 ENTER {
if (CheckInventory("SpeedToken"),0)
{
giveinventory("ambpowerspeed",1);
}
}