This tutorial will expect the user to have some knowledge with DECORATE, as we will be working with expressions.
First off, we'll make our decoy actor.
Code: Select all
ACTOR HoloDecoy
{
MONSTER
-COUNTKILL
+NOBLOOD
Radius 10
Height 9
Health 1500
Mass 0x7FFFFFFF
DamageFactor 0.0
Scale 0.5
Speed 2
States
{
Spawn:
HOLP ABCD 3
HOLP ABCD 2
TNT1 A 0 A_SpawnItemEx("HoloDecoyProjection",0,0,10,0,0,0,0,SXF_SETMASTER)
HOLP ABCD 1
SpawnLoop:
HOLP ABCD 1 A_Wander
TNT1 A 0 A_DamageSelf(10,"None",DMSS_NOFACTOR)
Loop
Death:
HOLP ABCD 2 A_Wander
HOLP ABCD 3 A_Wander
HOLP ABCD 4 A_Wander
HOLP ABCD 5 A_Wander
TNT1 A 0 A_KillChildren("HoloKill")
HOLP A 1 A_FadeOut(0.1,1)
Wait
}
}Now, for the projection that our decoy spawns.
Code: Select all
ACTOR HoloDecoyProjection
{
MONSTER
+FRIENDLY
-COUNTKILL
+GHOST
+NOBLOODDECALS
+DONTFALL
+NOGRAVITY
BloodType ""
Height 45
Radius 5
Health 1
Mass 0x7FFFFFFF
DamageFactor 0.0
DamageFactor "HoloKill", 1
RenderStyle "Add"
Alpha 0.75
Scale 0.75
States
{
Spawn:
TNT1 A 0 NoDelay Thing_ChangeTID(0,666)
SpawnLoop:
HOLO A 0 A_RadiusGive("DecoyHater",512,RGF_MONSTERS)
HOLO AAAABBBBCCCCDDDD 1 BRIGHT A_Warp(AAPTR_MASTER,0,0,15,0,WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
Loop
Death.HoloKill:
"####" "#" 0 A_NoBlocking
FadeLoop:
"####" "#" 0 BRIGHT A_SetScale(scalex-0.075,scaley+0.075)
"####" "#" 2 BRIGHT A_FadeOut(0.1,1)
Loop
}
}Now, let's look at possibly the most important part of this example; the item the HoloDecoyProjection is giving to the monsters around it.
Code: Select all
ACTOR DecoyHater : CustomInventory
{
+ALWAYSPICKUP
States
{
Pickup:
TNT1 A 0 A_JumpIf(CheckClass("HoloDecoy"),"End")
TNT1 A 0 A_JumpIf(CheckClass("HoloDecoyProjection"),"End")
TNT1 A 0 A_JumpIf(tidtohate==666,"End")
TNT1 A 0 Thing_Hate(0,666,0)
End:
TNT1 A 0
Stop
}
}The next thing the actor does is check the item obtainer's current hated TID, and if it is already the TID of the HoloDecoyProjection, it again moves to a state where it does nothing. If false, it then sets the item obtainer's hated TID to that of the HoloDecoyProjection. Above, I mentioned that the HoloDecoyProjection first set its own TID before doing anything else, and this is why; it gives us a no-nonsense way of garnering the attention of any monster we want it to. We check the obtainer's current hated TID before setting the TID to hate for a very important reason; if we continuously re-set a monster's hated TID, it will never complete its attack states, and will continuously stutter as it impotently attempts to chase or attack.
And that's it! Below is an compiled version of the above code as a pk3 for you to try out in Doom; just load it up and type in "summon HoloDecoy" at the console to see the above decoy in action.
