Author Topic: Scripting a Trigger of specific shape?  (Read 1103 times)

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« on: July 28, 2011, 01:22:26 pm »


               Background:
I have made an Incantation system for my PW.
It works on the principle of Toggle Incantation mode on, Speak a specific Incantation phrase, and then it will automagically select the relevant custom spell.
I am using nwnx_resman, so all the spells are modules which can be dropped into the module, without requiring a reset.


However, Phase 2 of the system, is the 'Ritual' system.

The Holy Trinity I am creating is

Incantations =  Spells you launch and target at objects or locations
Rituals = Spells that require reagents, and / or preparation and longer incantations
Chants = Remain Motionless, and chant, causing specific buffs/debuffs to occur, at intervals to all within ear-shot.


Chants will be easy...
However...

For Rituals, I want to for some Rituals..
Create a Trigger, that fires a specific script, on enter, and another on exit etc

However, the trigger needs to be Circle in shape.
If I remember correctly, spawning a trigger, makes it square, and fixed to a specific size.

nwnx_funcs for windows, does have functionality that allows you to set trap geometry.

My Question -
Is such a thing possible for Triggers, or am I best just using traps, and changing the scripts for the trap to be whatever is required?



The idea for rituals, is something like

1. Your being attacked by hordes of the undead.
2. You prepare the ritual while your team mates protect you.
3. You finish the ritual, and then a large circle forms around you (using the pentagrams and summoning circles include script)
4. The trigger/trap will be inside the circle. (same shape and size)
5. If an ally enters  - they are safe
6. If an enemy undead enters, they get feared and/or damaged.

The circle would fade after 60 seconds, or when the caster leaves the circle, whichever comes first.


Thoughts?
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #1 on: July 28, 2011, 04:34:34 pm »


               Why not create a custom AoE that is centered on the pentagram?
               
               

               
            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #2 on: July 28, 2011, 07:00:35 pm »


               

Baaleos wrote...

However, the trigger needs to be Circle in shape.
If I remember correctly, spawning a trigger, makes it square, and fixed to a specific size.

nwnx_funcs for windows, does have functionality that allows you to set trap geometry.

My Question -
Is such a thing possible for Triggers, or am I best just using traps, and changing the scripts for the trap to be whatever is required?


Hello.

Triggers (as in objects of type OBJECT_TYPE_TRIGGER) can not be spawned, nor cloned, nor copied, nor repositioned during play.
This major shortcoming is a sad reality. Could we spawn, or at the very least _copy_, triggers it would open up many interesting possibilities (traps do not count).


The suggestion to use an Area Of Effect object is very good.


-fox
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #3 on: July 28, 2011, 10:31:10 pm »


               To create a new AoE  - would this require client side files?

Also - while traps and triggers are slightly different, there are functions to allow the spawning of traps.

If needed, I could swap a trigger for a trap, and make it only perform the designated function on the intended targets
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #4 on: July 28, 2011, 10:39:13 pm »


               you could use: nwnx_funcs for windows, does have functionality that allows you to set trap geometry.
this gives you the ability to use code in trap scripts.  There is some info on nwnx forums link:  http://www.nwnx.org/phpBB2/ they would be better at telling if the shape of the trap is possible.  I haven't played with it that much but it seems the plugin is quite helpful from what I have read
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #5 on: July 28, 2011, 10:41:00 pm »


               I have several custom AoE effects that are created via item activation or even via a chat line command. Unless you're creating an actual learnable custom spell, I can't see why the clients would require anything.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #6 on: July 28, 2011, 11:17:07 pm »


               

Baaleos wrote...

To create a new AoE  - would this require client side files?

no vfx_persistent.2da is serverside with exception for collumn DurationVFX and probably also other collums where is stored the vfx model etc.

However I really dont understand why you need to "spawn" the trigger? Cant just be it the way that the ritual must be done at altar placeable and then there will be invisible trigger of fixed size (painted in toolset) to handle leaving the ritual subarea?'^_^'
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #7 on: July 28, 2011, 11:45:13 pm »


               Shadow brought up a good point, a trigger of fixed size (painted in toolset, in area players will never be)  Would allow you to copy/ that trigger to location of...

The idea for rituals, is something like

1. Your being attacked by hordes of the undead.
2. You prepare the ritual while your team mates protect you.
3. You finish the ritual, and then a large circle forms around you (using the pentagrams and summoning circles include script)
4. The trigger/trap will be inside the circle. (same shape and size)
5. If an ally enters  - they are safe
6. If an enemy undead enters, they get feared and/or damaged.

The circle would fade after 60 seconds, or when the caster leaves the circle, whichever comes first.

and then you send it back/destroy copy.  I just cant rem if we can copy trigers in nwn code or if thats a nwnx plugin
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #8 on: July 29, 2011, 12:11:03 am »


               Just create the AOE.   If vfx's are a problem, create one without vfx's and apply them via scripts if needed.
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Scripting a Trigger of specific shape?
« Reply #9 on: July 29, 2011, 02:35:08 pm »


               

Greyfort wrote...

Shadow brought up a good point, a trigger of fixed size (painted in toolset, in area players will never be) Would allow you to copy/ that trigger to location of...

The idea for rituals, is something like

1. Your being attacked by hordes of the undead.
2. You prepare the ritual while your team mates protect you.
3. You finish the ritual, and then a large circle forms around you (using the pentagrams and summoning circles include script)
4. The trigger/trap will be inside the circle. (same shape and size)
5. If an ally enters - they are safe
6. If an enemy undead enters, they get feared and/or damaged.

The circle would fade after 60 seconds, or when the caster leaves the circle, whichever comes first.

and then you send it back/destroy copy. I just cant rem if we can copy trigers in nwn code or if thats a nwnx plugin



That would have to be a NWNX function. Even copying/moving I think will prove a headache though. Triggers are "centered" based on where they stop/start. IE, when you draw the trigger in the toolset, the point you first click and where the last leg of the trigger rejoins to close the loop is the triggers starting point. Any scripts using get nearest, get first, etc ... will reference this location. So (its just a guess), I suspect that any means of moving a trigger will use that same point as it's center and cause odd placement of the trigger when moved.