Set oTarget to Immobile?
#1
Posté 28 mars 2012 - 01:40
I've tried EffectMovementSpeedDecrease(99) but that's not immobile, and it doesn't go up to 100%. I've searched the Lexicon for Movement and Immobile but I found options for oPC camera/cutscene, not the movement speed on the npc.
#2
Posté 28 mars 2012 - 01:43
effect eFreeze = EffectCutsceneImmobilize();
AssignCommand( OBJECT_SELF, ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, OBJECT_SELF, 30.0)));
Change 30.0 for the duration you need to keep the NPC from moving about.
FP!
#3
Posté 28 mars 2012 - 01:44
// them unable to walk but otherwise unpenalized. This effect cannot be resisted.
effect EffectCutsceneImmobilize()
#4
Posté 28 mars 2012 - 02:43
I'm trying to duplicate the Root spell found in other games, and the closest I can see that in nwn is to switch the npc's movement to Immobilize. This allows range attacks to occur and for them to wack on the player if they are within range. Suggestions?
#5
Posté 28 mars 2012 - 03:36
You could probably add a check to the AI script to see if they have your spell effect on them and run a custom AI if they do. You'd have to code a bit to check for enemies within melee distance, else switch to a ranged weapon or cast. Just don't add any options that would involve moving or running.
EffectCutsceneImmobilize() really should work though...
I've just never tested it with the combat AI.
<Wonders if there's some check in the default AI that cancels out if the NPC is immobile>
I think that the AI does a few checks to see if the NPC shouldn't be able to attack and cancels out if it returns true. I'm fairly sure that it checks for stuff like paralyze, petrify, sleep, etc... I'll have to take a look at that when I get a chance.
It may be as simple as adjusting a check in the AI somewhere.
Modifié par wyldhunt1, 28 mars 2012 - 03:37 .
#6
Posté 28 mars 2012 - 10:20
#include "hg_inc"
#include "ac_spell_inc"
void CheckGlobMoveRate(object oTarget, int nDC, effect eEff, int nCount = 1) {
if (!GetIsObjectValid(oTarget))
return;
int nRate = GetLocalInt(oTarget, "BaseMoveRate");
if (!GetHasSpecificEffect(eEff, oTarget)) {
SetMovementRate(oTarget, nRate);
return;
} else if (!(nCount%3)) {
nDC -= 5;
if (GetSkillCheckResult(SKILL_DISCIPLINE, oTarget, nDC) <= 0) {
RemoveEffect(oTarget, eEff);
SetMovementRate(oTarget, nRate);
return;
}
}
nCount++;
DelayCommand(6.0, CheckGlobMoveRate(oTarget, nDC, eEff, nCount));
}
void ApplyNPCMovementRateChange(object oTarget, int nMoveRate) {
int nBaseRate = GetLocalInt(oTarget, "BaseMoveRate");
if (!nBaseRate) {
nBaseRate = GetMovementRate(oTarget);
SetLocalInt(oTarget, "BaseMoveRate", nBaseRate);
}
SetMovementRate(oTarget, nMoveRate);
}
void main() {
struct SpellInfo si = GetSpellInfo();
if (si.id < 0)
return;
si.dc = si.clevel*2;
si.dc = (si.dc > 120 ? 120 : si.dc);
float fDur = MetaDuration(si, si.clevel / 2, DURATION_IN_ROUNDS);
if (GetIsSpellTarget(si)) {
SignalEvent(si.target, EventSpellCastAt(si.caster, si.id));
if (!GetSpellResisted(si) &&
!GetIsImmune(si.target, IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE) &&
GetSkillCheckResult(SKILL_DISCIPLINE, si.target, si.dc) <= 0) {
ApplyVisualToObject(VFX_FNF_GAS_EXPLOSION_ACID, si.target);
effect eLink = EffectSpellImmunity(HGSPELL_UNUSED);
eLink = EffectLinkEffects(EffectVisualEffect(CEPVFX_AOE_FOG_STINK), eLink);
SetEffectSpellId(eLink, HGSPELL_VISCID_GLOB);
if (GetIsPC(si.target)) {
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, si.target, fDur);
RecalculateMovementRate(si.target);
} else {
if (!GetHasSpellEffect(si.id, si.target)) {
//change this to a Recalc analogue if we add a second rate setter
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, si.target, fDur);
ApplyNPCMovementRateChange(si.target, MOVEMENT_RATE_GLACIAL);
AssignCommand(GetArea(si.target), DelayCommand(6.0, CheckGlobMoveRate(si.target, si.dc, eLink)));
} else //block double application to prevent dur bugging
FloatingTextStringOnCreature("Only one Viscid Glob may be put on a creature at once!", si.caster, FALSE);
}
}
}
}
Funky
Modifié par FunkySwerve, 28 mars 2012 - 10:23 .
#7
Posté 28 mars 2012 - 09:34
FunkySwerve wrote...
If you're using NWNX, you can do this with SetMovementRate. Otherwise, I know of no way to do this save Immobilize.
Well you can add a line to appearance.2da with the immobile speed "NOMOVE" used instead and then use the script SetAppearance() to immobilize. But as has previously been said, speed of 0.0 itself has problems in allowing NPC to make use of their AI effectively, just like EffectCutsceneImmobility().
Here are some alternatives to look at:
Defensive Stance (does not work with ranged weapons or spell casting).
Define a new movement speed (such 0.01) that is slightly faster than immobility.
Modifié par WhiZard, 28 mars 2012 - 09:39 .
#8
Posté 29 mars 2012 - 12:07
WhiZard wrote...
But as has previously been said, speed of 0.0 itself has problems in allowing NPC to make use of their AI effectively, just like EffectCutsceneImmobility().
We use movespeed GLACIAL, rather than immobilizing them. From our (modified) creaturespeed.2da:
2DA V2.0
Label Name 2DAName WALKRATE RUNRATE
0 PC_Movement **** PLAYER 2.00 4.00
1 Immobile 2319 NOMOVE 0.00 0.00
2 Very_Slow 2320 VSLOW 0.75 1.50
3 Slow 2321 SLOW 1.25 2.50
4 Normal 2322 NORM 1.75 3.50
5 Fast 2323 FAST 2.25 4.50
6 Very_Fast 2324 VFAST 2.75 5.50
7 Default 6614 DEFAULT 0.00 0.00
8 DM_Fast 6893 DFAST 5.50 11.00
9 Faster 690 FASTER 2.50 5.00
10 Extra_Fast 725 EFAST 3.00 6.00
11 Super_Fast 687 SFAST 3.25 6.50
12 Hyper_Fast 684 HFAST 3.50 7.00
13 Light_Fast 1026 XFAST 3.75 7.50
14 Ridic_Fast 1014 YFAST 4.00 8.00
15 Ludic_Fast 2214 ZFAST 4.25 8.50
16 Relaxed 2275 RELAXED 1.60 3.20
17 Extra_Slow 5137 ESLOW 0.50 1.00
18 Super_Slow 5138 SSLOW 0.25 0.50
19 Glacial 5139 GLACIAL 0.10 0.20
That is PRECISELY why I suggested this approach. The very same you yourself suggest in your last sentence. Did you not read my post?
Funky
Modifié par FunkySwerve, 29 mars 2012 - 12:09 .
#9
Posté 29 mars 2012 - 01:52
FunkySwerve wrote...
That is PRECISELY why I suggested this approach. The very same you yourself suggest in your last sentence. Did you not read my post?
Funky
You didn't specificly say you ADDED a line to creaturespeed.2da. My assumption was that you reset the speed to a previously existing line. But you did say that this can be only achieved through NWNX, and I did mention that adding lines to appearance.2da would allow SetCreatureAppearance() to make use of the speeds defined there (even for extra lines added to creaturespeed.2da). My post was there to show that there is a non-NWNX alternative, not to say that your method doesn't work or has problems.
#10
Posté 29 mars 2012 - 02:07
WhiZard wrote...
FunkySwerve wrote...
That is PRECISELY why I suggested this approach. The very same you yourself suggest in your last sentence. Did you not read my post?
Funky
You didn't specificly say you ADDED a line to creaturespeed.2da.
No, I didn't. It's obvious from the code, which Sets moverate to a value not found in nwscript. I also made it explicit that it 'radically slows' the target, rather than immobilizing it, which renders your expressed concerns about this technique completely irrelevant. If you're going to reply to my posts, please take the time to read them. Doing otherwise wastes both our time and risks confusing the issue for the OP.
Funky
Modifié par FunkySwerve, 29 mars 2012 - 02:09 .
#11
Posté 29 mars 2012 - 02:37
FunkySwerve wrote...
WhiZard wrote...
FunkySwerve wrote...
That is PRECISELY why I suggested this approach. The very same you yourself suggest in your last sentence. Did you not read my post?
Funky
You didn't specificly say you ADDED a line to creaturespeed.2da.
No, I didn't. It's obvious from the code, which Sets moverate to a value not found in nwscript. I also made it explicit that it 'radically slows' the target, rather than immobilizing it, which renders your expressed concerns about this technique completely irrelevant. If you're going to reply to my posts, please take the time to read them. Doing otherwise wastes both our time and risks confusing the issue for the OP.
Funky
Since you want to throw down the guantlet, tell me where I interpreted that your glacial constant couldn't possibly mean very slow movement with run disabled. You have already told me that I have interpreted your words specifically to mean immobile speed. Show me where I said that.
#12
Posté 29 mars 2012 - 08:28
Relax, fellas. Testaserone levels are making it smell like a gym sock around here, yo. ;-D
Modifié par DMSelena, 29 mars 2012 - 08:33 .
#13
Posté 30 mars 2012 - 02:19
DMSelena wrote...
Hey you know what song I'm listening to now? This one:
Relax, fellas. Testaserone levels are making it smell like a gym sock around here, yo. ;-D
Lolz, that was my response to that post as well. Fallen, here's the part of your where you offer a critique of my suggestion with no apparent awareness that I'm suggesting setting a very slow, rather than immobile movement speed, despite my having made that abundantly clear in my post:
At no point did I suggest setting a speed of 0.0, making that a pretty bizarre nonsequitor at best. If you actually took the time to read my post and reply to it, without grasping that concept, I can only suggest you avoid future remark on my posts, as you simply won't be able to add anything useful to the conversation. If you simply skimmed it, as I suspect, then I can only repeat my above suggestion - be a little more attentive to what you're replying to, in order to save everyone some pointless typing.But as has previously been said, speed of 0.0 itself has problems in
allowing NPC to make use of their AI effectively, just like
EffectCutsceneImmobility().
Funky
#14
Posté 30 mars 2012 - 04:45
0.0 is the speed of "NOMOVE" from appearance.2da which was in the prior sentence. I don't see how you are getting it to refer to the glacial constant which I did not mention at all.FunkySwerve wrote...
DMSelena wrote...
Hey you know what song I'm listening to now? This one:
Relax, fellas. Testaserone levels are making it smell like a gym sock around here, yo. ;-D
Lolz, that was my response to that post as well. Fallen, here's the part of your where you offer a critique of my suggestion with no apparent awareness that I'm suggesting setting a very slow, rather than immobile movement speed, despite my having made that abundantly clear in my post:At no point did I suggest setting a speed of 0.0, making that a pretty bizarre nonsequitor at best.But as has previously been said, speed of 0.0 itself has problems in
allowing NPC to make use of their AI effectively, just like
EffectCutsceneImmobility().
#15
Posté 30 mars 2012 - 04:51
#16
Posté 30 mars 2012 - 09:56
Buddywarrior wrote...
Is it possible to add glacial to the appearance.2da and call it without nxnx (or with basic nwn +cep)?
Yes, you first need to add it to creaturespeed.2da and under the"2DAName" column set the string you wish to use in appearance.2da to call that row in creaturespeed.2da.
Modifié par WhiZard, 30 mars 2012 - 09:56 .
#17
Posté 24 juillet 2012 - 08:25
#18
Posté 24 juillet 2012 - 10:36
#19
Posté 24 juillet 2012 - 11:19
Or like Zarathustra said something like a spell-like effect without the ensuing visual effects. I was thinking of that encased in rock spell from the waist down. So your own particular root effect.
Probably different ways to do it.
Modifié par ffbj, 24 juillet 2012 - 11:22 .
#20
Posté 25 juillet 2012 - 05:04
Zarathustra217 wrote...
Why not use EffectEntangle?
Because it will give negative AC and attack penalty oh and I think there a concentration check add (this is according to the lex.) and it cause the AI not to cast spell just like cutsceneimmobile
#21
Posté 25 juillet 2012 - 09:03
"In P&P D&D, it is meant to add an additional concentration check for casting spells (DC: 15) but this is not in NwN"
In the end, the AC and AB penalty would make sense though.
#22
Posté 25 juillet 2012 - 09:33
Zarathustra217 wrote...
You could easily compensate for the AC and AB penalty. And the lexicon says exactly the opposite:
"In P&P D&D, it is meant to add an additional concentration check for casting spells (DC: 15) but this is not in NwN"
In the end, the AC and AB penalty would make sense though.
Lexicon (whatever version quoted) is wrong on that. There is a DC 15 concentration check, but it is not displayed. The HotU manual states a DC of 15 + spell level, however the DC is a static 15.





Retour en haut







