For a spell I'm working on, I'd like to be able to manipulate environmental objects through a spell at long distance. For example, I want to be able to activate the the "Use" icon that occurs over certain in game objects (Tilting the mirror in the Temple Ruins for example), open doors, close doors through this spell. Ideally, I would like to be able to cast the spell, and then click on the target at a distance, as though the PC was close enough to manipulate the environmental object even though they, or the caster is too far to be able to manipulate the environmental object.
Is this possible, and if so are there any hints I could have as to how this could be done?
I received this response from Galactygon.
It's possible, but it would require you a whole lot of work unless you figure something out, via WEIDU. Now don't ask me about WEIDU, because I know nothing yet.
Now, here's what I would do: Somehow make a new scriptingstate and apply it on your character. Let's name it STATE_TELEKINESIS
Now as for the triggers, you would transform things from these:IF Range(LastTrigger,5) THEN RESPONSE #100 Do some stuff END IF !Range(LastTrigger,5) THEN RESPONSE #100 Display that you are too far from the trigger END
.... To something like these:IF OR(2) Range(LastTrigger,5) CheckStat(LastTrigger,1,STATE_TELEKINESIS) THEN RESPONSE #100 Do some stuff END IF !Range(LastTrigger,5) THEN RESPONSE #100 Display that you are too far from the trigger END
As for doors and containers, you can maybe make an invisible/invulnerable creature that picks up everything in there/opens the door, and gives all the items to the caster. I believe there are more triggers in the IF part of the block, but I don't remember all of them. Someone might copy and paste an example.
Ok, so now I recognize that I'm going to have to alter some scripts. The question is, which scripts? Also, what I would Ideally like to implement is different ranges for the telekinetic effect depending on the level of the caster. So, for example a the level 1 version of the spell would have a range of 10 yards (RANGE: 20), the level 10 version of the spell would have a range of 100 (RANGE: 200).
Since the telekinesis spell will be an effect applied to the caster and it will have a duration, I can see how it can be scripted so that if the environmental trigger detects a certain spell effect on the caster, it can then check the range to see if that particular effect increases the reach of the caster far enough to trigger the switch. For example, some pseudo code:
IF OR(2) CheckStat(LastTrigger,1,STATE_TELEKINESIS20) //Level 1 version of the spell, has range of 20 AND Range(LastTrigger,20) Range(LastTrigger,5)//The normal behaviour of the trigger THEN RESPONSE #100... //Trigger the switch IF !Range(LastTrigger,5) THEN RESPONSE #100 Display that you are too far from the trigger END
What I can see doing is creating multiple states/local variables that would be applied to the caster depending on what level of the spell they cast. These different states would be used in the pseudo code to vary the range of the spell.
The other thing I need this to do, is to open doors using a similar level dependant range system. I do not need this ability to pick up items.
A further complication, is that this spell will be castable by a summoned creature, not the pc, so that may introduce problems with switches and doors (I think that summons can't open doors or use switches).
So, how much work does this entail? Will I have to modify every single switch in the game or is there an easier way? The same question about doors. If every switch and door trigger will need to be modified, is there a way for Weidu to automate this to save time, and to automatically make the modifications to any new switches from new areas introduced by other mods that are range dependant?
Thanks for any help.