Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Mewdoom

zdoom - giveInventory and TakeInventory problem

Recommended Posts

Hello Guys,

I am working on a monster that spawn two children, I want the main actor two just spawn another 2 children only when his childrens are dead. I have trouble setting it up correctly, its like the TakeInventory doesnt work ...because it never spawn them again once he does it.

actor SoulHarvester 3117
{

Health 200
GibHealth 50
Radius 20
Height 56
Speed 8
PainChance 160
MONSTER
+FLOORCLIP
+NOINFIGHTING // ajouté!
SeeSound "harvester/sight"
PainSound "imp/pain"
DeathSound "harvester/death"
ActiveSound "imp/active"
MeleeSound "imp/melee"
Obituary "%o couldn't evade the soul harvester's attack."
MissileType SoulHarvesterBall
MeleeDamage 3
States
{
Spawn:
SLHV AB 10 A_Look
Loop
See:
SLHV AABBCCDD 3 A_Chase
Loop
Melee:
Missile:
TNT1 A 0 A_Jump(256, "Missile2")
SLHV EFG 4 A_FaceTarget
SLHV HIJK 5 Bright A_FaceTarget
SLHV L 8 Bright A_MissileAttack
SLHV M 10
Goto See
Missile2:

TNT1 A 0 A_JumpIfInventory("Cell", 1, "See")
TNT1 A 0 A_JumpIfInventory("Cell", 2, "See")

SLHV EFG 4 A_FaceTarget
TNT1 A 0 A_PlaySound("SpiritImp/Sight")
SLHV HIJ 10 Bright A_FaceTarget
TNT1 A 0 A_Playsound("harvester/scream")
SLHV K 5 Bright A_FaceTarget
SLHV K 5 BRIGHT A_SpawnItemEx("NDoomImp", 40, 40, 0, 0, 0, 0, 0,SXF_SETMASTER)
SLHV K 5 BRIGHT A_SpawnItemEx("NDoomImp", 40, -40, 0, 0, 0, 0, 0,SXF_SETMASTER)
//SLHV L 8 Bright A_MissileAttack
//SLHV M 10
Goto See
Pain:
SLHV N 3
SLHV N 3 A_Pain
Goto See
Death:
SLHV O 7 A_Scream
SLHV PQ 7
SLHV R 7 A_JumpIfInventory("Ammo", 1, "NoRaiseUp")
Goto RaiseUp

NoRaiseUp:
SLHV S 6 A_CustomMissile("SoulHarvesterGhost", 32, 0, 0)
SLHV T 5 A_Fall

SLHV UV 5
SLHV W -1
Stop

RaiseUp:
SLHV S 6 A_CustomMissile("SoulHarvesterGhost", 32, 0, 0)
SLHV T 5 A_Fall

SLHV U 5 A_GiveInventory("Ammo", 1)
SLHV V Random(105, 175) // Wait between 3-5 seconds before rising
SLHV W -1 Thing_Raise(0)
Wait
XDeath:
SLHV X 6 A_Xscream
SLHV Y 6 A_CustomMissile("SoulHarvesterGhost", 32, 0, 0)
SLHV Z 6
SLHV [ 6 A_Fall
SLHV ] 6
SLHW A -1
Stop
Raise:
SLHV WVUTSRQPO 5
Goto See
}
//$Category New Monsters

}


ACTOR NDoomImp
{
Health 60
Radius 20
Height 56
Mass 100
Speed 8
PainChance 200
Alpha 0
RENDERSTYLE Translucent
Monster
+FLOORCLIP
+LOOKALLAROUND
SeeSound "imp/sight"
PainSound "imp/pain"
DeathSound "imp/death"
ActiveSound "imp/active"
HitObituary "$OB_IMPHIT"
Obituary "$OB_IMP"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("Cell", 1, AAPTR_MASTER)
TNT1 AB 10 A_Look
Loop
See:
TNT1 A 0 A_JumpIf(alpha < 1.0, "See2")
TROO AABBCCDD 3 A_Chase
Loop
See2:
TROO A 5 A_FadeIn(0.2)
TROO A 0 A_JumpIf(alpha >= 1.0, "See")
TROO AABBCCDD 3 A_Chase("Attack1", "Attack2")
Loop
Attack1:
Attack2:
Goto See2
Melee:
Missile:
TROO EF 8 A_FaceTarget
TROO G 6 A_TroopAttack
Goto See
Pain:
TROO H 2
TROO H 2 A_Pain
Goto See
Death:
TROO I 8
TROO J 8 A_Scream
TROO K 6
TROO L 6 A_NoBlocking
Goto Alpha1
Alpha1:
TROO M 5 A_JumpIf(alpha >= 1.0, "Ok1")
TROO M 5 A_FadeIn(0.2)
Goto Alpha1
Ok1:
TNT1 A 0 A_TakeInventory("Cell", 1, AAPTR_MASTER)
TROO M -1
Stop
XDeath:
TROO N 5
TROO O 5 A_XScream
TROO P 5
TROO Q 5 A_NoBlocking
TROO RST 5
Goto Alpha2
Alpha2:
TROO U 5 A_JumpIf(alpha >= 1.0, "Ok2")
TROO U 5 A_FadeIn(0.2)
Goto Alpha2
Ok2:
TNT1 A 0 A_TakeInventory("Cell", 1, AAPTR_MASTER)
TROO U -1
Stop
Raise:
TROO MLKJI 8
Goto See
}
}

Share this post


Link to post

Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("Cell", 1, AAPTR_MASTER)
TNT1 AB 10 A_Look
Loop
A_GiveInventory is within a loop that may get repeated multiple times, so that each NDoomImp may give multiple Cells to his master. Change it so that A_GiveInventory won't be within a loop so that it couldn't be called more than once. Ideally, add an Idle state like this:
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("Cell", 1, AAPTR_MASTER)
Idle:
TNT1 AB 10 A_Look
Loop

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×