Aller au contenu

Photo

Toggle traps on/off


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
AeitZean

AeitZean
  • Members
  • 7 messages
almost tearing my hair out here, I'm trying to make traps that I can toggle on and off, so i can use them in a puzzle. The problem is the trap stays detected the way I'm doing it, so the player wont know which traps are active and which arnt.

is there a better way to do this that will work than this:

void main(string sTrapTag, int nBeEnabled)
{
    object oTrap = GetObjectByTag(sTrapTag);
    if(oTrap!=OBJECT_INVALID)
    {
        SetTrapActive(oTrap, nBeEnabled);
        SetTrapDetectable(oTrap, nBeEnabled);
    }
}

The trap wont trigger when disabled, and no new players cant detect it, but it stays red for those whove detected it. do i just need to teleport the trigger out the way and back again (ugly hack) or is there a more elegant way of doing this?

thanks

#2
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
You can create/spawn and destroy traps via script I believe. Still perhaps not the best solution though.

#3
AeitZean

AeitZean
  • Members
  • 7 messages
how does that work for trigger traps though, how would i set the shape i want the trap to take for example?



or does destroying a trap not also destroy the trigger? settrapdisabled seems to suggest the whole trigger will be deleted:

// Disable oTrap.

// - oTrap: a placeable, door or trigger.

// This disarms a trap, which results in the trap being deleted completely (If it is a trigger)

// or being cleared from the door/chest (if oTrap is a door or chest)

// Will execute the 'OnDisarm' script for the trap.

void SetTrapDisabled(object oTrap);



if that was the case isnt it just the same as destroying the trigger object?

#4
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
I haven't really used the SetDisabled function, so can't comment all that much on it. Your basic problem seems to be essntially in "refreshing" the PCs view of the world (to delete the previously revealed trap). You might be able to "fake it" by making the PC temp. blind for like half a second or whatever, I think that causes the Perception to refire when they come out of blindness. No clue if that will work for you, just trying to help out with some ideas here.

#5
AeitZean

AeitZean
  • Members
  • 7 messages
thanks for the help, i think i'll just have to get used to having only square traps using the create traps function



thanks for trying though :D

#6
MokahTGS

MokahTGS
  • Members
  • 946 messages
I would suggest just using custom triggers that check for local variables placed on players via scripts. This way you can have areas on the floor that the player can turn on and off at will via levers, buttons, wall runes or whatever you want.



The standard trap triggers are really a one-trick pony. Just go custom.

#7
AeitZean

AeitZean
  • Members
  • 7 messages
how do you deal with showing the player where the trap would be though? a normal trap shows up when detected by the player as a red square, is there a way to trace the edge of a trigger for the player to see?



if so that would be problem solved, as i could then only show the edge when I want it to be seen.



thanks :D

#8
Shaughn78

Shaughn78
  • Members
  • 637 messages
The trigger would give you the most freedom.



For the visual part place an ipoint in the center of the trap and apply and remove a VFX to it as it is enabled and disabled.



There is no red square effect so you can either get creative with the effects you have avaliable or create a red square effect in the effects editor making a billboard effect.