Aller au contenu

Photo

Script to Make it so Players cannot CLOSE a door...


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

#1
Darin

Darin
  • Members
  • 282 messages
 Seriously, I can't figure out how to lock/script a door OPEN.  I can keep it clopsed, but not opened...

(Portcullis, want to force it's state linked to a lever...the lever does what it needs to, but the door can be closed)

Tried the following (oPort is the door's object)
..
                        SetUseableFlag(oPort,TRUE);
AssignCommand(oPort, ActionOpenDoor(oPort)); AssignCommand(oPort, SetUseableFlag(oPort,FALSE));

And my little elf, Aabwen Debugger, can still close it after this bit runs.  any ideas?
(it didn't work with/without the "AssignCommand" bit)

Reason:  Portcullis is a counterweight, but the door it counterweights should ponly be controlled via a sally port mechanism (lever), whose code contains the above (and a lot of other stuff)

#2
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

Is there any other script that is closing it somewhere else? On its heartbeat perhaps?

Other than that, set a variable on the script that allows it to open/close that says to exit the script that opens or closes the door if open ... or something like: If(GetIsOpen(oDoor)){return;}

Lance.

#3
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Hmm you can open doors via script.

Take a look at his code

I have another system which handles arcane lock, which is added to the doors on open event, and which closes it right away.

#4
bealzebub

bealzebub
  • Members
  • 352 messages
OnClosed, ActionOpenDoor? maybe a message (this can't be closed) and a variable to control if you DO want it closed.

#5
Darin

Darin
  • Members
  • 282 messages
figured out why the Use Flag failed, doors don't have them. The suggestions above would work, but not in the way I want, since the door would close then re-open (which, as a counterweight, would IRL cause the other thing to come up and back down). Has anyone ever had success spawning a door via code? and if so, can you spawn it opened (make a blueprint of the door as an opened object).

#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

I just reread your OP and I think you mean appear open as if "jammed" open. Is that right? (Like "Doorstate" permanently "open" unless you say otherwise.) If that is what you mean, then maybe it would be better to go with a placeable object that sits ingame in any way you script it, and then add/remove the door appropriately.

However, there would not be any animation this way ... however, I believe somebody even wrote a script that gave this appearance too, by adding/removing a placeable object very quickly in each step of opening/closing, like a stop gap animation effect that gave the appearance of opening/closing.

Lance.

Modifié par Lance Botelle, 19 mai 2012 - 08:16 .


#7
Darin

Darin
  • Members
  • 282 messages
well, CreateObject() doesn't cover doors, and other than the noise, bealzebub's suggestion worked the best. here is the code I used for OnClosed:

void main()
{
// make sure it only effects when a player tries to close the door
if (GetIsOwnedByPlayer(GetLastClosedBy()) || GetIsPC(GetLastClosedBy()) )
{
FloatingTextStringOnCreature("working:",GetLastClosedBy());
AssignCommand(OBJECT_SELF, ActionOpenDoor(OBJECT_SELF));
}
}

Modifié par EpicFetus, 19 mai 2012 - 08:18 .


#8
Darin

Darin
  • Members
  • 282 messages
Lance, cool idea, since I do have a placeable as the other door it's a counterweight for...that would look much cooler, thank you.

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

EpicFetus wrote...

well, CreateObject() doesn't cover doors, and other than the noise, bealzebub's suggestion worked the best. here is the code I used for OnClosed:

void main()
{
// make sure it only effects when a player tries to close the door
if (GetIsOwnedByPlayer(GetLastClosedBy()) || GetIsPC(GetLastClosedBy()) )
{
FloatingTextStringOnCreature("working:",GetLastClosedBy());
AssignCommand(OBJECT_SELF, ActionOpenDoor(OBJECT_SELF));
}
}


Hi,

I was just looking at writing a script around the OnClosed hook, so it looks like you beat me to it. :)

EDIT: Yes, the script above works fine, as long as the initial door state open animation starts the way around the open door function swings it. :)

Lance.

Modifié par Lance Botelle, 19 mai 2012 - 08:31 .