Jump to content


Trap-setting script?


2 replies to this topic

#1 Miloch

    Barbarian

  • Modder
  • 5453 posts

Posted 13 March 2010 - 09:16 PM

Anyone have or know where there's a simple trap-setting script for a bounty-hunter-type character? I suppose I could try to write one but it might involve some hackishness and I don't really want to bother if I can swipe one that works from somewhere already.
Mod Contributions
Aurora * BG1 NPC * Gnomes * Haiass * Infinity Animations * Level 1 NPCs * Lost Items * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * In Progress: Adjusted Portraits * DSotSC (Tutu)
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * PSPad Highlighters * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"As the body itself is slow to grow and quick to decay, so also it is easier to damp men's spirits and their enthusiasm than to revive them..."
-Cornelius Tacitus, Agricola

#2 the bigg

    2083 is a prime number.

  • Modder
  • 3265 posts

Posted 14 March 2010 - 05:30 AM

place_traps is the numbers of traps to set (choose it via dialogue or something else). You need to add in SET_SPECIAL_SNARE_TRAP for bounty hunters).
//////////////////////////////////////////////////////////////
// Set traps: set start work variables.
//////////////////////////////////////////////////////////////

IF
  GlobalGT("place_traps","locals",0)
  !Global("placing_traps","locals",1)
THEN
    RESPONSE #100
     SetGlobal("placing_traps","locals",1)
     ApplySpellRES("tb#alucr",Myself) // one-second long Improved Alacrity
END
 
//////////////////////////////////////////////////////////////
// Set traps: work is done, do some clean up.
//////////////////////////////////////////////////////////////
 
IF
  Global("placing_traps","locals",1)
  OR(3)
       Global("Place_traps","Locals",0)
       !HaveSpell(ROGUE_SET_SPIKE_TRAP)
       See(NearestEnemyOf(Myself))
  OR(3)
       Global("Place_traps","Locals",0)
       !HaveSpell(ROGUE_SET_EXPLODING_TRAP)
        See(NearestEnemyOf(Myself))
  OR(3)
       Global("Place_traps","Locals",0)
       !HaveSpell(ROGUE_SET_TIME_TRAP)
       See(NearestEnemyOf(Myself))
  OR(3)
       Global("Place_traps","Locals",0)
       !HaveSpell(SET_SNARE_TRAP)
       See(NearestEnemyOf(Myself))
THEN
    RESPONSE #100
     SetGlobal("done_traps","locals",1)
     SetGlobal("placing_traps","locals",0)
     SetGlobal("place_traps","locals",0)
END
 
//////////////////////////////////////////////////////////////
// Set traps: actual work, aided by Imp Alacrity.
//////////////////////////////////////////////////////////////
 
IF
  ActionListEmpty()
  GlobalGT("place_traps","Locals",0)
  HaveSpell(ROGUE_SET_TIME_TRAP)
THEN
    RESPONSE #100
     Spell(Myself,ROGUE_SET_TIME_TRAP)
     IncrementGlobal("place_traps","Locals",-1)
END
 
IF
  ActionListEmpty()
  GlobalGT("place_traps","Locals",0)
  HaveSpell(ROGUE_SET_SPIKE_TRAP)
THEN
    RESPONSE #100
     Spell(Myself,ROGUE_SET_SPIKE_TRAP)
     IncrementGlobal("place_traps","Locals",-1)
END
 
IF
  ActionListEmpty()
  GlobalGT("place_traps","Locals",0)
  HaveSpell(ROGUE_SET_EXPLODING_TRAP)
THEN
    RESPONSE #100
     Spell(Myself,ROGUE_SET_EXPLODING_TRAP)
     IncrementGlobal("place_traps","Locals",-1)
END
 
IF
  ActionListEmpty()
  GlobalGT("place_traps","Locals",0)
  HaveSpell(SET_SNARE_TRAP)
THEN
    RESPONSE #100
     Spell(Myself,SET_SNARE_TRAP)
     IncrementGlobal("place_traps","Locals",-1)
END 

I wrote it, so assume you might need to test and fix a bug or two, but the basic idea works.

Edited by the bigg, 14 March 2010 - 05:31 AM.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.

#3 Miloch

    Barbarian

  • Modder
  • 5453 posts

Posted 14 March 2010 - 08:45 PM

Looks cool, cheers.

Oh wait, I actually have to *test* it? :ph34r:

Ideally, I'd like the rogue to run away a bit after setting the trap, to lure stupid folks into it. That sort of scripting is inevitably hackish in the engine but I've already got some blocks I can potentially use, so I'll mess with it a bit when I get a chance.
Mod Contributions
Aurora * BG1 NPC * Gnomes * Haiass * Infinity Animations * Level 1 NPCs * Lost Items * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * In Progress: Adjusted Portraits * DSotSC (Tutu)
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * PSPad Highlighters * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"As the body itself is slow to grow and quick to decay, so also it is easier to damp men's spirits and their enthusiasm than to revive them..."
-Cornelius Tacitus, Agricola




Reply to this topic