Polymorph crashing Linux NWServer?
#1
Posté 07 janvier 2011 - 09:04
I tested against a windows box and didn't get the same crash.
Is this a known issue? Is there fixes? Does anyone have any more detailed information for me?
#2
Posté 09 janvier 2011 - 04:36
Funky
#3
Posté 10 janvier 2011 - 12:19
I was thinking in the various impact scripts that fired polymorphs, but maybe I'm thinking about it wrong.
You'd more want to perform the check when someone tries to use the unpolymorph button?
If you feel like sharing would you PM me on where to start, or offer some insight on this please, I'd rather not give players the power to crash a server.
#4
Posté 10 janvier 2011 - 01:00
Shifter Crash
#5
Posté 10 janvier 2011 - 11:33
First, you must use nwnx_events to hook, among other things, the feat use event, so that you can block direct polymorph from one form to the next. Here's the (heavily edited for simplicity) code for our events event, showing how this is done.
//::////////////////////////////////////////////////////////////////////////:://
//:: SIMTools V3.0 Speech Integration & Management Tools Version 3.0 :://
//:: Created By: FunkySwerve :://
//:: Created On: April 4 2006 :://
//:: Last Updated: March 27 2007 :://
//:: With Thanks To: :://
//:: Dumbo - for his amazing plugin :://
//:: Virusman - for Linux versions, and for the reset plugin, and for :://
//:: his excellent events plugin, without which this update would not :://
//:: be possible :://
//:: Dazzle - for his script samples :://
//:: Butch - for the emote wand scripts :://
//:: The DMFI project - for the languages conversions and many of the emotes:://
//:: Lanessar and the players of the Myth Drannor PW - for the new languages:://
//:: The players and DMs of Higher Ground for their input and playtesting :://
//::////////////////////////////////////////////////////////////////////////:://
//This script is only used by Linux users, to tell what conversation node was selected in the popup menus.
//The other events shown will work with the Linux version but are commented out
//#include "aps_include"
//#include "nwnx_events"
#include "hg_inc"
#include "fky_chat_instant"
void main() {
int nEventType = GetEventType();
int nSubType;
string sCommand;
location lTarget;
object oTarget, oItem;
switch (nEventType) {
case EVENT_TYPE_CAST_SPELL:
//... note break; removed too
case EVENT_TYPE_USE_ITEM:
//... note break; removed too
case EVENT_TYPE_USE_FEAT:
nSubType = GetEventSubType();
//...other feats removed
if (FindSubString(" 304 305 335 336 337 338 339 340 341 342 872 873 898 900 901 902 903 1060 1061 ", " " + IntToString(nSubType) + " ") >= 0) {
if (GetHasEffectOfType(EFFECT_TYPE_POLYMORPH, OBJECT_SELF)) {
FloatingTextStringOnCreature("You cannot change shape while already polymorphed!", OBJECT_SELF, FALSE);
BypassEvent();
}
}
break;
case EVENT_TYPE_USE_SKILL:
//... note break; removed too
case EVENT_TYPE_TOGGLE_MODE:
//... note break; removed too
case EVENT_TYPE_PICKPOCKET:
//... note break; removed too
case EVENT_TYPE_QUICKCHAT:
//... note break; removed too
}
}
Funky
#6
Posté 10 janvier 2011 - 11:45
if (GetHasEffectOfType(EFFECT_TYPE_POLYMORPH, pi.caster)) {
FloatingTextStringOnCreature("You cannot change shape while already polymorphed!", pi.caster, FALSE);
return;
}
Modifié par FunkySwerve, 10 janvier 2011 - 11:46 .
#7
Posté 10 janvier 2011 - 11:55
} else if (sCancel == "poly") {
int nHP = 20 + (GetAbilityModifier(ABILITY_CONSTITUTION, oCPC) * GetHitDice(oCPC));
if (GetCurrentHitPoints(oCPC) < nHP)
FloatingTextStringOnCreature(COLOR_RED + "Unshifting now would kill you!" + COLOR_END, oCPC, FALSE);
else if (RemoveEffectsOfType(EFFECT_TYPE_POLYMORPH, oCPC, oCPC) > 0)
AssignCommand(oCPC, ClearAllActions());
return;
}
Funky
Modifié par FunkySwerve, 10 janvier 2011 - 11:55 .
#8
Posté 12 janvier 2011 - 06:17
effect EffectPolymorph(
int nPolymorphSelection,
int nLocked = FALSE
);
Parameters
nPolymorphSelection
POLYMORPH_TYPE_*
nLocked
If TRUE, player can't cancel polymorph (Default: FALSE)
Description
Returns a new effect object that when applied to a target will transform them into one of the types defined in the POLYMORPH_TYPE_* constant group, from the "polymorph.2da" file, where new ones can be added via. a hakpack.
A new polymorph will cancel out an existing one, and if nLocked is TRUE, there is no "Cancle Polymorph" in the radical menu, so it cannot be removed automatically by a PC, only by the duration running out, or (if applied via. a spell) it being dispelled.
The target this effect is applied to must be a creature for it to work. The target this effect is applied to must be a creature for it to work.
Funky, would applying nLocked to True for all polymorphs, and then setting up a chat command to force an unpolymoph work? (like your simTools command above)
Might have to use RemoveSpecificEffect(EFFECT_TYPE_POLYMORPH, oPC);
Modifié par Calvinthesneak, 12 janvier 2011 - 06:24 .
#9
Posté 12 janvier 2011 - 07:35
"A new polymorph will cancel out an existing one, and if nLocked is TRUE, there is no "Cancle Polymorph" in the radical menu, so it cannot be removed automatically by a PC, only by the duration running out, or (if applied via. a spell) it being dispelled."
That wouldn't block use of another shifter feat, so far as I know. I can't say for certain, however, since acaos coded our shifter blocking. I assume he did it the way he did for a reason, but I could always be mistaken - feel free to try it.
Funky
#10
Posté 12 janvier 2011 - 06:36
#11
Posté 13 janvier 2011 - 12:33
FunkySwerve wrote...
According to the lexicon, that just has no Cancel Poly icon:
"A new polymorph will cancel out an existing one, and if nLocked is TRUE, there is no "Cancle Polymorph" in the radical menu, so it cannot be removed automatically by a PC, only by the duration running out, or (if applied via. a spell) it being dispelled."
That wouldn't block use of another shifter feat, so far as I know. I can't say for certain, however, since acaos coded our shifter blocking. I assume he did it the way he did for a reason, but I could always be mistaken - feel free to try it.
Funky
Ahhh I forgot the way shifting from one form to another worked. It unshifts you momentarily, then shifts to new form. Looks like you and Acaos have probably done it the only way it's going to be possible. I was trying to catch it in the code to see if they were polymorphed already, and then return.
#12
Posté 14 janvier 2011 - 03:49
Anyhow what I did in each polymorph script was try this.
string badShifter = StringToRGBString("You cannot shift while already shifted!", STRING_COLOR_RED);
//check to see if we are polymorphed already and dissallow so we cannot
//blow the server up and ruin everyone's fun
if(GetLocalInt(oTarget, "IOS_POLY"))
{
SendMessageToPC(oTarget, badShifter);
return;
}
And then after the polymorph was provided, set the int...
//Flag as in polymorph form
SetLocalInt(OBJECT_SELF, "IOS_POLY", 1);
and then the only way to cancel is using the chat command:
else if (sSecondaryCommand == "poly") {
if(GetHasEffect(EFFECT_TYPE_POLYMORPH, oPC)==FALSE)
SendMessageToPC(oPC, "You are not currently polymorphed.");
else
{
int nHP = 20 + (GetAbilityModifier(ABILITY_CONSTITUTION, oPC) * GetHitDice(oPC));
if (GetCurrentHitPoints(oPC) < nHP)
FloatingTextStringOnCreature(badShifter, oPC, FALSE);
else
{
//if they are under DM punishment as chicken, don't let them unpoly
if(GetAppearanceType(oPC)==31)
return;
else
{
RemoveSpecificEffect(EFFECT_TYPE_POLYMORPH, oPC);
AssignCommand(oPC, ClearAllActions());
//Clean up variables
DeleteLocalInt(oPC, "IOS_POLY");
}
}
}
}
Modifié par Calvinthesneak, 14 janvier 2011 - 03:53 .
#13
Posté 14 janvier 2011 - 03:56
#14
Posté 14 janvier 2011 - 04:34
That was acaos' code, not mine, but I suspect you're right.Calvinthesneak wrote...
The only part I see that fails is on the shape to shape shift, it auto unpolys, and I am guessing there is no way to disable that or hook it to perform an HP check and stop it before it it depolymorphs, save how FunkySwerve did with the nwnx_events.
Funky





Retour en haut






