While we are talking about the death handler, we may as well touch on a few modifications that are easily made.
To start with, the caller variable. As it is set up in the template game, represents the view to be used for the icon in the death's print statement. While I like the idea of using a view in the print statement, what I don't like is using a different view for each death icon that I want to use. Instead I would rather use a single view and instead multiple loops.
This is a pretty easy change. In my case, I placed all of the death icons into a single view, 900. Any number can be used of course, this is just the one that I picked and plan to stay with.
In dying.sc, I hard coded the view to 900 and then used the caller variable to point to the loop I want instead of the view. So I changed this
(if(<> NULL caller)
Load(rsVIEW caller)
(deadIcon:view(caller))
)(else
Load(rsVIEW DYING_SCRIPT)
(deadIcon:view(DYING_SCRIPT))
)
to this
//(if(<> NULL caller)
Load(rsVIEW 900)
(deadIcon:view(900)loop(caller)cel(0))
//)(else
// Load(rsVIEW DYING_SCRIPT)
// (deadIcon:view(DYING_SCRIPT))
//)
Also, while we are at it, that 3 seconds thing before triggering the death statement really bugs me. I usually call the death statement at the end of a changestate method in a room so I already have full control of when where and how everything is animated. Again, changing this is another easy edit. In case 0 of the dying scripts changestate, there is the line
= seconds 3
Personally a brief pause is more than enough for my needs so this is one I change to
= cycles 5
And lastly for today, a dcicon, which is what the death print statement really is, by default cycles forward indefinately. While this is fine as long as you know that when you draw it, you may have cases where you don't want it to play indefinately but instead just want it to play through once to end.
If you scroll all the way down to the bottom of the dying script
(instance deadIcon of DCIcon
(properties)
(method (init)
(super:init())
(if(== gRoomNumberExit 540)
= cycler (End:new())
(send cycler:init(self))
)
)
)
Now, in this little bitty instance, you'll notice the gRoomNumberExit. Basicly this if statement says that if the dying script was called from room 540 then just play the animation till the last cel, otherwise it maintains its default behavior of just playing indefinately. If you want all of the death print icons, regardless of rooms to play till the last cel, then you could simply comment out the if statement and the closing ) all together.
(instance deadIcon of DCIcon
(properties)
(method (init)
(super:init())
//(if(== gRoomNumberExit 2)
= cycler (End:new())
(send cycler:init(self))
//)
)// end method
)// end instance
Or if you want a mix, some room's death icons cycle indefinitely and other room's don't, then you would want to edit the if statement to include the rooms where it only plays till the end.
(instance deadIcon of DCIcon
(properties)
(method (init)
(super:init())
(if(
(== gRoomNumberExit 2) or
(== gRoomNumberExit 6) or
(== gRoomNumberExit 54)
)
= cycler (End:new())
(send cycler:init(self))
)
)// end method
)// end instance
I suppose better yet would be to create a new global variable and set it when calling the dying script, and then check against it in this little instance. That would give you the option per death, not just by room.