From f866c12b646f9a47019db8986fa62f6b8dd79c38 Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Mon, 2 Apr 2007 20:00:11 +0000 Subject: [PATCH] Script to have critters say things when they die. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@5920 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/misc/death_message.py | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 python/misc/death_message.py diff --git a/python/misc/death_message.py b/python/misc/death_message.py new file mode 100644 index 000000000..971f6d102 --- /dev/null +++ b/python/misc/death_message.py @@ -0,0 +1,41 @@ +# death_message.py +# +# Copyright 2007 by Nicolas Weeger +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# +# +# This script makes the monster/living thing containing it display +# a message when it dies. +# Message is specified in event object's options field. It can contain %m +# and %k, which will be replaced by respectively dead item's name and killer's +# name (if no killer, replaced by an empty string). + +import Crossfire + +# This script only works when dying monster is WhoAmI + +whoami = Crossfire.WhoAmI() +msg = Crossfire.ScriptParameters() +hitter = Crossfire.WhoIsActivator() + +if msg != '': + msg = msg.replace('%m', whoami.Name) + if hitter != None: + msg = msg.replace('%k', hitter.Name) + else: + msg = msg.replace('%k', '') + Crossfire.WhoAmI().Map.Print(msg, Crossfire.MessageFlag.NDI_UNIQUE | Crossfire.MessageFlag.NDI_BLUE)