Crossfire Server, Trunk
CFweardisguise.py
Go to the documentation of this file.
1 #CFweardisguise.py
2 # A little script to insert an informational force into the player inventory
3 # if a article is applied and remove the force if it is unapplied.
4 # For example if you put on a priest robe it will insert the option value into
5 # a force slaying field which can be checked against on a map.
6 #
7 # This script is meant for items that can be worn or carried really
8 # I can't say how it will react if you hook it to other types of objects.
9 
10 import Crossfire
11 
12 activator=Crossfire.WhoIsActivator()
13 activatorname=activator.Name
14 whoami=Crossfire.WhoAmI()
15 
16 option=Crossfire.ScriptParameters() # 1 is apply event
17 
18 if option:
19  inv = activator.CheckInventory(option) #Remove any previous disguise
20  if inv:
21  inv.Remove()
22  #Crossfire.Log(Crossfire.LogDebug, "removing tag")
23 
24  if not whoami.Applied: #is the object is being applied
25  tag = activator.CreateInvisibleObjectInside(option)
26  tag.Name=option
27  #Crossfire.Log(Crossfire.LogDebug, "adding tag")