Jump to content

how to make this projectile disappear after 5 seconds


LuzRoja29

Recommended Posts

Hi, I have another question:
I want to modify this soul cube mod so that it disappears (i.e. becomes usable again) after 5 seconds. Does anyone know what I should change or add?

 

Spoiler

Actor SoulCube : weapon
{
   Weapon.SelectionOrder 4000
   Inventory.PickupSound "misc/usgpickup" 
   Obituary "$o'soul was taken by %k."
   Weapon.SlotNumber 0
   +WEAPON.NO_AUTO_SWITCH
   AttackSound "skull/melee" 
   damagetype Cube
   Scale 0.5
   States 
   { 
   Spawn: 
      SCBG ABCD 5
      Loop
   Ready: 
      //SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedReady")
      SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedReady")
      SCUB C 1 A_WeaponReady
      Loop 
   ChargedReady:
      SCWI A 0 A_PlaySound("weapons/fly_star")
      Goto Rotating
   Rotating:
      SCUB DABC 4 A_WeaponReady
      SCWI A 0 A_PlaySound("weapons/soulpre")
      Loop 
   Deselect:
      //SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedDeselect")
      SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedDeselect")
      Goto DischargedDeselect
   ChargedDeselect:
      SCWI A 0 A_PlaySound("weapons/FLY_END_")
      Goto DischargedDeselect
   DischargedDeselect:
      SCUB C 1 A_Lower
      Loop
   Select:
      SCUB C 1 A_Raise
      Loop
   Fire:
      //SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedFire")
      SCUB C 0 A_JumpIfInventory ("CubeAmmo", 10, "ChargedFire")
      SCUB C 5 A_Print ("Not enough souls!")
      Goto Ready
   ChargedFire:
      SCWF A 0 A_PlaySound("weapons/FLY_LOOP")
      SCUB E 5 A_FireCustomMissile("SoulCubeProj",0,0,0,0,0)
      SCUB F 2
      SCUB G 2
      SCUB H 2
      SCUB I 2
      //TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
      TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
      SCUB J 2
      SCUB J 0 A_TakeInventory("SoulCube")
      Goto Ready
   }
}

actor SoulCubeProj
{
    +RIPPER
    +SEEKERMISSILE
    +SCREENSEEKER
    +SKYEXPLODE
    +BOUNCEONWALLS
    +BOUNCEONFLOORS
    +BOUNCEONCEILINGS
    -NOBLOCKMAP
    BounceFactor 0.9
    bouncecount 101 //67
  speed 15
  damage 2 //5
  radius 13
  height 8
  damagetype Cube
  //deathsound "imp/melee"
  //AttackSound "monster/sprsit"
  //MeleeSound "monster/spratk"
  //DeathSound "monster/sprdth"
  deathsound "weapons/FLY_END_"
  Scale 0.5
  PROJECTILE
  states
  {
  Spawn:
    SCDM A 0 A_PlaySound("weapons/soulcube")
    SCBW A 1 A_SeekerMissile(10, 30, SMF_LOOK|SMF_PRECISE)
    SCBW B 1 A_SeekerMissile(10, 30, SMF_LOOK|SMF_PRECISE)
    SCBW C 1 A_SeekerMissile(10, 30, SMF_LOOK|SMF_PRECISE)
    SCBW D 1 A_SeekerMissile(90, 180, 1, SMF_LOOK|SMF_PRECISE)
    loop
  Death:
    TNT1 A 0 A_CustomMissile ("SoulCubeReturnSpawner",0,0,0,0,0)
    TNT1 A -1
    stop
  }
}

actor SoulCubeReturnSpawner
{
  Radius 0
  Height 0
  Scale 0.5
  MONSTER
  +NONSHOOTABLE
  +NOGRAVITY
  -SOLID
  -COUNTKILL
  States
  {
  Spawn:
    SCBW A 0 A_PlaySound ("imp/melee")
    SCBW ABCDABCDABCDABCD 1
  Missile:
    TNT1 A 0 A_FaceTarget
    TNT1 A 0 A_PlaySound ("Weapon/saw" )
    TNT1 A 0 A_CustomMissile ("SoulCubeReturner",0,0,0,0,0)
  Death:
    TNT1 A 0 A_GiveToTarget ("SoulCube")
    //TNT1 A 0 A_TakeFromTarget ("CubeAmmo", 10)
    TNT1 A 0 A_TakeFromTarget ("CubeAmmo", 10)
    TNT1 A -1
    Stop
  }
}
  
actor SoulCubeReturner : Ammo
{
  radius 13
  height 1
  speed 25
  damage 0
   Scale 0.5
  +MISSILE
  +STEPMISSILE
  +SEEKERMISSILE
  +PAINLESS
  +NONSHOOTABLE
  +NOGRAVITY
  -SOLID
  states
  {
  Spawn:
    SCBW A 1 A_SeekerMissile (90, 90, SMF_PRECISE)
    SCBW B 1 A_SeekerMissile (90, 90, SMF_PRECISE)
    SCBW C 1 A_SeekerMissile (90, 90, SMF_PRECISE)
    SCBW D 1 A_SeekerMissile (90, 90, SMF_PRECISE)
    loop
  Death:
    TNT1 A -1
    stop
  Pickup:
    TNT1 A 0 A_GiveInventory("SoulCube")
    //TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
    TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
    stop
  }
}
  
actor SoulCubeGenerator : CustomInventory
{
  radius 13
  height 8
  +FLOORCLIP
  +AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
   Inventory.PickupMessage "You got the Soul Cube!"
   Inventory.PickupSound "misc/usgpickup" 
  Inventory.MaxAmount 1
   Scale 0.5
  states
  {
  Spawn:
    SCBG ABCD 5 A_SeekerMissile (90, 90, SMF_PRECISE)
    loop
  Pickup:
    TNT1 A 0 A_JumpIfInventory("SoulCube", 1, 3)
    TNT1 A 0 A_GiveInventory("SoulCube")
    //TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
    TNT1 A 0 A_TakeInventory("CubeAmmo", 10)
    TNT1 A 0 A_SelectWeapon("SoulCube") 
    stop
  }
}

up is the code (I did not put the code of the ammunition because I suppose that it is not necessary to modify it for what I want to do)

Share this post


Link to post

From what I can see from the code (without having tested it cause I don't have the time now), it seems that it basically works like the Doom 3 soul cube, so you throw it to a monster and when the cube hits its target it will go back to its owner.

My questions are: do you want the cub to stay away from the player for 5 seconds and then come back? Where do you want the cube to be in those 5 seconds? On the ground, on the monster?

Share this post


Link to post

Yeah, but you haven't answered the second question x)

 

Anyway, for some generic "wait 5 seconds there" you just have to delay the Missile state of SoulCubeReturnSpawner or the Spawn state of SoulCubeReturner, so something like this:

Missile:
	SCBW ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD 4 //5 secs are quite a lot of time in terms of frames since this item plays 1 frame per tic
	                                                    //so I slowed it down x4
	TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_PlaySound ("Weapon/saw" )
	TNT1 A 0 A_CustomMissile ("SoulCubeReturner",0,0,0,0,0)

Or you could just use ReactionTime property on that same actor, with a value of 175, which is cleaner and simpler, but I'm not 100% sure about its reliability in this case.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...