Aller au contenu

Photo

Question about doors


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

#1
Surek

Surek
  • Members
  • 94 messages

I have a question about doors. This should be rather simple but I can’t figure it for the life of me. How do I get a PC to open a locked door based on one of their stats. As an example I would like the door to unlock and open based on their strength. Is this even possible and if so how do I go about doing this?



#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

Make sure your door is checked "locked" and "requires a key to unlock". Then in the door's "OnFailToOpen" event you could put something like this:

 

 

void main()
{
    object oPC = GetClickingObject();
    int iStrength = GetAbilityScore(oPC, ABILITY_STRENGTH, FALSE);

    if (iStrength >= 18)
    {
        ActionUnlockObject(OBJECT_SELF);
        ActionOpenDoor(OBJECT_SELF);
        FloatingTextStringOnCreature("You force the door open with your buff muscles.", oPC);
    }

    else
    {
        FloatingTextStringOnCreature("You are too whimpy to open this door.", oPC);
    }
}

 

 

Hope it helps. Good Luck!



#3
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

I made a custom script that emulates PHB object breaking and door bashing. It uses the FORT save parameter to determine the DC and accounts for the PC's size and strength modifier. The script goes in the OnPhysicalAttacked script slot of a door or placeable. While not exactly what you're looking for, it could be easily altered.

 

Spoiler


#4
WhiZard

WhiZard
  • Members
  • 1 204 messages

I made a custom script that emulates PHB object breaking and door bashing. It uses the FORT save parameter to determine the DC and accounts for the PC's size and strength modifier. The script goes in the OnPhysicalAttacked script slot of a door or placeable. While not exactly what you're looking for, it could be easily altered.

 

Spoiler

 

 

Looks good.  The only problem I can see is that a single arrow can utterly decimate a wooden door, or any other placeable.  Perhaps a melee check?



#5
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

I overlooked that...thanks.



#6
Shadooow

Shadooow
  • Members
  • 4 470 messages

Nice script Pstemarie, I was using something similar for my module but I found several problems during playtesting.

 

1) Ranged weapons, had to disable them for this as it makes no sense that you could use them to break doors.

2) The more attacks per round player has the easier is to break doors by brute force, take 2 weapons, enable flurry of blows and just wait soon you roll 20 and its done. I havent been able to solve this issue in any good way so far...



#7
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

I'm not too concerned about the flurry of blows. I mainly use this script on doors which I want to be more of a nuisance rather than an obstacle to overcome. More for flavoring than anything else.

 

I've also got some other tweaks I'm working on that will alert nearby monsters when a door gets bashed open - all that breaking and splintering of wood, metal, or stone makes a racket that's hard to ignore.



#8
WhiZard

WhiZard
  • Members
  • 1 204 messages

2) The more attacks per round player has the easier is to break doors by brute force, take 2 weapons, enable flurry of blows and just wait soon you roll 20 and its done. I havent been able to solve this issue in any good way so far...

 

This is a non-issue as you are simulating saving throws rather than actually making them (no auto-success on 20).  So if the fortitude save is set high enough, then a character with low strength may be unable to break it no matter how many attacks per round he has.


  • Pstemarie aime ceci

#9
meaglyn

meaglyn
  • Members
  • 811 messages

I see how to disable this in the on attack type scripts. I have doors that allow damage but I would like to undo that damage if caused by a ranged weapon or otherwise disallow damaging by ranged weapons. Anyone know how to do that? Does GetLastWeaponUsed() work still in the onDamaged event?  Is there a better way than healing the damage dealt to do this?



#10
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

This is what I did to take of care ranged physical attacks...

 

Spoiler

 

For the OnDamagedEvent, you'd have to give the HP back, which I don't think is possible because AFAIK healing doesn't work on placeables.



#11
meaglyn

meaglyn
  • Members
  • 811 messages

Thanks, Pstemarie.

 

Yeah, that's about what I did in the on attack event, but that only works for plot doors which are being bashed by strength check as in your code above.

 

I'll test the GetLastWeaponUsed from OnDamaged when I get back into the toolset later. Healing does work at least on real doors. There's a cool respawning mechanism you can use that uses the ability to heal the door.

 

I just want to keep people with bows from being able to destroy such doors :)



#12
meaglyn

meaglyn
  • Members
  • 811 messages
I'll test the GetLastWeaponUsed from OnDamaged when I get back into the toolset later. Healing does work at least on real doors.

Fwiw, it seems GetLastWeaponUsed on the LastDamager works okay in OnDamaged event. You can then heal the non-plot door and as long as there's no instant death it should catch these cases.



#13
WhiZard

WhiZard
  • Members
  • 1 204 messages

If you are using only the OnDamaged event, then you have to account for other sources of damage (e.g. spells, grenades), in which case the last used weapon could be anything as it is unrelated.

 

An alternative is to do a delayed command off of the OnPhysicalAttacked event.  For example, get the current hit points during this event and pass that parameter so that the door is healed up to this amount 0.5 seconds later.



#14
meaglyn

meaglyn
  • Members
  • 811 messages

Good point WhiZard...  The delay could work but in multiplayer could end up healing more than it should pretty easily.  Maybe the damage type could be used to weed out spells and other things... I'll have to poke at it some more.



#15
meaglyn

meaglyn
  • Members
  • 811 messages

Not meaning to completely hijack this thread, but it seems relevant to the original post.

 

Does anyone know if the ondamaged event for a successful attack immediately follows the onattacked event for that attack or could some other event get in between? Like some other creature's on attack event against the same object.

 

Edit: nevermind... I was storing the tracking variable on the wrong object (the attackee) when it makes more sense and removes the issue of interleaving to store it on the attaker. In the on attacked handler set a variable on the attacker when detecting a ranged

attack (clear it if not ranged). Then on damaged can tell if the attacker used a real ranged weapon or not and heal as appropriate.



#16
WhiZard

WhiZard
  • Members
  • 1 204 messages

All the OnPhysicalAttacked in a flurry are done together, then there is a gap in time, then the OnDamaged event occurs for the hits, often, but not reliably, in reverse order from the in game feedback for attack roll.  All the OnDamaged for the flurry will occur together.



#17
meaglyn

meaglyn
  • Members
  • 811 messages

Thanks. I figured you'd probably have the answer to that. On thinking about it more I figured it had to be implemented that way. Your post and my edit crossed :)