There are two kinds of cigarettes, filtered and unfiltered, with different potencies. I don't want to give the player a full pack every time, and so to avoid having to define 8 different new actors for each type of cigarette and each degree of fullness, I tried to implement an args-based spawner to do this. Unfortunately, it doesn't do anything at all.
Code: Select all
Actor Sanity : Inventory
{
Tag "Sanity"
Inventory.MaxAmount 100 // Sets the max amount that can be held in the inventory
}
ACTOR CigaretteCooldown : PowerupGiver
{
Powerup.Type "PowerCigaretteCooldown"
+AUTOACTIVATE
}
ACTOR PowerCigaretteCooldown : Powerup
{
Powerup.Duration -30
}
ACTOR Cigarettes1 : CustomInventory
{
//$Title Pack of Filtered Cigarettes
//$Category Items
+INVENTORY.KEEPDEPLETED
+INVENTORY.INVBAR
Inventory.Icon CIG1A0
Inventory.PickupSound "misc/inventorypickup"
Inventory.UseSound "misc/invuse"
Inventory.Pickupmessage "I found a pack of filtered cigarettes..."
Inventory.Amount 1
Inventory.MaxAmount 20
States
{
Spawn:
CIG1 A -1
Stop
Use:
TNT1 A 0 A_JumpIfInventory("Sanity", 0, "SanFull")
TNT1 A 0 A_JumpIfInventory("PowerCigaretteCooldown", 1, "DontSmoke")
TNT1 A -1 ACS_NamedExecuteAlways("Filtered_Cigarettes")
Stop
SanFull:
TNT1 A 0 A_Print("I don't feel like smoking right now...")
Fail
DontSmoke:
TNT1 A 0 A_Print("I just smoked, I should wait...")
Fail
}
}
Actor Cigarettes2 : Cigarettes1
{
//$Title Pack of Unfiltered Menthols
Inventory.Icon CIG2A0
Inventory.Pickupmessage "I found a pack of unfiltered menthols..."
States
{
Spawn:
CIG2 A -1
Stop
Use:
TNT1 A 0 A_JumpIfInventory("Sanity", 0, "SanFull")
TNT1 A 0 A_JumpIfInventory("PowerCigaretteCooldown", 1, "DontSmoke")
TNT1 A -1 ACS_NamedExecuteAlways("Unfiltered_Cigarettes")
Stop
SanFull:
TNT1 A 0 A_Print("I don't feel like smoking right now...")
Fail
DontSmoke:
TNT1 A 0 A_Print("I just smoked, I should wait...")
Fail
}
}
Actor CigaretteSmoker : CustomInventory
{
States
{
Spawn:
TNT1 A -1
Stop
Pickup:
TNT1 A 25 A_FireCustomMissile("CigaretteSmoke",random(10,-10),0,0,0)
TNT1 A 25 A_FireCustomMissile("CigaretteSmoke",random(10,-10),0,0,0)
TNT1 A 25 A_FireCustomMissile("CigaretteSmoke",random(10,-10),0,0,0)
TNT1 A 25 A_FireCustomMissile("CigaretteSmoke",random(10,-10),0,0,0)
Stop
}
}
Actor CigaretteSmoke
{
Radius 0
Height 1
Speed 3
VSpeed 5
+RANDOMIZE
PROJECTILE
RENDERSTYLE TRANSLUCENT
ALPHA 0.35
States
{
Spawn:
SMKE ABCDEFGH 2
Stop
}
}
Actor CigaretteButtSpawn : CustomInventory
{
States
{
Spawn:
TNT1 A -1
Stop
Pickup:
TNT1 A 0 A_FireCustomMissile("CigaretteButtSpawner",0,0,0,1)
Stop
}
}
ACTOR CigaretteButtSpawner
{
States
{
Spawn:
TNT1 AA 1 A_CustomMissile("CigButt",random(2,-2),0,0,0)
Stop
}
}
ACTOR CigButt
{
Speed 7
BounceFactor 0.4
Mass 1
ReactionTime 70
PROJECTILE
+DOOMBOUNCE
-NOGRAVITY
-NOBLOCKMAP
States
{
Spawn:
CIGF ABCD 2 A_Countdown
Goto Spawn+1
Death:
CIGF A 0 A_Jump(64,4)
CIGF A 0 A_Jump(85,4)
CIGF A 0 A_Jump(128,4)
CIGF A 350
Stop
CIGF B 350
Stop
CIGF C 350
Stop
CIGF D 350
Stop
}
}
Actor CigPackSpawner 272
{
States
{
Spawn:
TNT1 A 0 A_JumpIf(Args[1] == 1, "Filtered")
TNT1 A 0 A_JumpIf(Args[1] == 2, "Unfiltered")
Loop
Filtered:
TNT1 A 0 A_JumpIf(Args[2] == 1, "QuarterFiltered")
TNT1 A 0 A_JumpIf(Args[2] == 2, "HalfFiltered")
TNT1 A 0 A_JumpIf(Args[2] == 3, "ThirdFiltered")
TNT1 A 0 A_JumpIf(Args[2] == 4, "FullFiltered")
Loop
QuarterFiltered:
TNT1 A 0 A_DropItem("Cigarettes1", 5)
Stop
HalfFiltered:
TNT1 A 0 A_DropItem("Cigarettes1", 10)
Stop
ThirdFiltered:
TNT1 A 0 A_DropItem("Cigarettes1", 15)
Stop
FullFiltered:
TNT1 A 0 A_DropItem("Cigarettes1", 20)
Stop
Unfiltered:
TNT1 A 0 A_JumpIf(Args[2] == 1, "QuarterUnfiltered")
TNT1 A 0 A_JumpIf(Args[2] == 2, "HalfUnfiltered")
TNT1 A 0 A_JumpIf(Args[2] == 3, "ThirdUnfiltered")
TNT1 A 0 A_JumpIf(Args[2] == 4, "FullUnfiltered")
Loop
QuarterUnfiltered:
TNT1 A 0 A_DropItem("Cigarettes2", 5)
Stop
HalfUnfiltered:
TNT1 A 0 A_DropItem("Cigarettes2", 10)
Stop
ThirdUnfiltered:
TNT1 A 0 A_DropItem("Cigarettes2", 15)
Stop
FullUnfiltered:
TNT1 A 0 A_DropItem("Cigarettes2", 20)
Stop
}
}