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)
Script to Make it so Players cannot CLOSE a door...
Débuté par
Darin
, mai 18 2012 09:22
#1
Posté 18 mai 2012 - 09:22
#2
Posté 18 mai 2012 - 10:19
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.
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.
#4
Posté 19 mai 2012 - 12:42
OnClosed, ActionOpenDoor? maybe a message (this can't be closed) and a variable to control if you DO want it closed.
#5
Posté 19 mai 2012 - 05:15
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
Posté 19 mai 2012 - 08:11
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.
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
Posté 19 mai 2012 - 08:17
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));
}
}
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
Posté 19 mai 2012 - 08:19
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
Posté 19 mai 2012 - 08:24
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 .





Retour en haut







