We did something like this too. We have CEP implemented so we just used the small flame visual effects that already exist with it.
Made six blueprints for the flame objects (just useable box checked so they can be bashed, also just gave em 1 hp).
Made six blueprints for the flare items (these can be whatever items you want to use). And very important, all of the six items have the same tag but different resrefs. This way you only need to have 1 tag based script run for all of them. Then the script checks the resref of the item used and makes the flame object that corresponds. Aslo make sure the items have the property Cast Spell, Unique Power. And give it unlimited uses per day as the script will take care of destroying the item itself. Or you can just get rid of the line that destroys the item and they really can use it unlimited amount of times.
And then the tag based script for it:
#include "x2_inc_switches"
const float DELAY = 20.0;
void main()
{
int iEvent = GetUserDefinedItemEventNumber();
if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
if (GetIsObjectValid(oTarget))
{
FloatingTextStringOnCreature("Target must be a location.", oPC);
return;
}
location lTarget = GetItemActivatedTargetLocation();
string sResRef = GetResRef(oItem);
string sLight;
if (sResRef == "flare1") sLight = "flareflame1";//blue
if (sResRef == "flare2") sLight = "flareflame2";//green
if (sResRef == "flare3") sLight = "flareflame3";//purple
if (sResRef == "flare4") sLight = "flareflame4";//red
if (sResRef == "flare5") sLight = "flareflame5";//white
if (sResRef == "flare6") sLight = "flareflame6";//yellow
object oLight = CreateObject(OBJECT_TYPE_PLACEABLE, sLight, lTarget);
DestroyObject(oItem);
DestroyObject(oLight, DELAY);
}
There is a constant float toward the top of the script that is used for the delay before the flare on the ground is auto-destroyed. You can set it to whatever you prefer. Currently it is set to 20.0 seconds for testing.
It also has a check to make sure that the target of the flare is a location only.
Just another way of doing it. Good luck.
P.S. That is a neat idea Amethyst.
Modifié par GhostOfGod, 04 janvier 2012 - 09:43 .