messageHandler addNotification() { LOG("newquests", "destroy_notification - addNotification()"); if(params != null) { obj_id target = params.getObjId("target"); LOG("newquests", "destroy_notification - addNotification() - target=" + target); if(target != null) { resizeable obj_id[] notificationTargets = null; if(hasObjVar(self, "destroy_notification_targets")) { notificationTargets = getResizeableObjIdArrayObjVar(self, "destroy_notification_targets"); } else { notificationTargets = new Vector(); } if(notificationTargets != null) { notificationTargets.add(target); setObjVar(self, "destroy_notification_targets", notificationTargets); LOG("newquests", "destroy_notification - addNotification() - added " + target + " to notification obj_id array"); String parameter = params.getString("parameter"); LOG("newquests", "destroy_notification - addNotification() - parameter=" + parameter); if(parameter != null && parameter.length() > 0) { String objvarname = target.toString(); setObjVar(self, objvarname, parameter); LOG("newquests", "destroy_notification - addNotification() - set objvar " + objvarname + " = " + parameter); } } } } return SCRIPT_CONTINUE; } void sendNotifications(obj_id self) { LOG("newquests", "destroy_notification - sendNotifications()"); if(hasObjVar(self, "destroy_notification_targets")) { resizeable obj_id[] notificationTargets = getResizeableObjIdArrayObjVar(self, "destroy_notification_targets"); int iter = 0; for(iter = 0; iter < notificationTargets.length; ++iter) { dictionary destroyNotificationParameters = new dictionary(); destroyNotificationParameters.put("source", self); LOG("newquests", "destroy_notification - addNotification() - putting " + self + " into dictionary"); String objvarname = notificationTargets[iter].toString(); if(hasObjVar(self, objvarname)) { String parameter = getStringObjVar(self, objvarname); destroyNotificationParameters.put("parameter", parameter); LOG("newquests", "destroy_notification - addNotification() - putting " + parameter + " into dictionary"); } else { LOG("newquests", "destroy_notification - addNotification() - could not retrieve parameter from objvar " + self); } LOG("newquests", "destroy_notification - addNotification() - sending notification to " + notificationTargets[iter]); messageTo(notificationTargets[iter], "destroyNotification", destroyNotificationParameters, 0.0f, false); } } } trigger OnIncapacitated(obj_id killer) { LOG("newquests", "destroy_notification - OnIncapacitated()"); sendNotifications(self); return SCRIPT_CONTINUE; } trigger OnDestroy() { LOG("newquests", "destroy_notification - OnDestroy()"); sendNotifications(self); return SCRIPT_CONTINUE; } trigger OnObjectDisabled(obj_id killer) { LOG("newquests", "destroy_notification: OnObjectDisabled()"); sendNotifications(self); return SCRIPT_CONTINUE; }