Skip to content

Custom Player-Set Traps

So, the idea was to implement an entirely script-based system for setting traps, because as far as I know default traps are extremely hardcoded and the only traps you can actually do anything interesting with are those you set as part of the module.

That was the crux of the question - we didn't find any way to associate script triggers with player-set traps. There's no "OnPlayerSetTrap" event that we could use.

So instead we added a SetTrap spell instead - the problem? It's always hostile.

The CreateTrapAtLocation function is complete enough to let you assign a Disarm and a Trigger script separately, you can do some interesting things with that, but as part of the script, it also asks you one of the standard faction constants.

And now I'm pulling my hair because I don't know how to create non-hostile traps.
I also read somewhere that there's supposed to be a trap.2da, but I can't find it anywhere either.

Any suggestions?

Comments

  • ProlericProleric Member Posts: 1,282
    edited April 2020
    traps.2da (sic) is a standard resource which you can extract with NWNExplorer. That might be the way to go, as you can specify the trap script etc.

    Past discussions of CreateTrapAtLocation suggest that you really do have to use a standard faction. I have read that using Defender works, because Defender is 100% friendly to PC, but I haven't tested this.

    It's a general feature of traps that they are triggered by neutrals as well as hostiles.
  • icelandiaicelandia Member Posts: 16
    Proleric wrote: »
    Past discussions of CreateTrapAtLocation suggest that you really do have to use a standard faction. I have read that using Defender works, because Defender is 100% friendly to PC, but I haven't tested this.

    This might work if the server is set to Party-PvP, but in full PvP you need to be strictly in a party to be categorized as friendly - everything else is set as neutral, which will trigger traps.

    Hopefully I can do something from the 2da to salvage the last week worth of scripting.

  • icelandiaicelandia Member Posts: 16
    I ended up taking a look at the 2da, and my disappointment is beyond measure.
    All that you can do from the 2da is effectively change the trigger script.
    Off to take a bath with the toaster.
Sign In or Register to comment.