Aller au contenu

Photo

what's wrong with this script?


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

#1
psiiijay

psiiijay
  • Members
  • 258 messages
 I'm creating a module and as part of the story you get to control a dimention and be omnipotent in it, and thus you get an epic feat at lvl 29 that you can try to get a creature into your dimention (where you could kill him for sure as you are omnipotent inside). 
So you try a touch attack and the creature dies if you touch it (no save) and if you don't the target is still stunned and knocked down from being close to the dimentional gate. pluse  you are also invulnerable for 3 seconds because you are omnipotent the whole time you are inside the dimention while only your hand is out trying to get your target. The downside is the transition from omniotent to mortal leaves you VERY weak and you are left with 1 hp at the end of the spell.

I used the Damnation spell and had a fast script made. No errors but it's not working...
Oh, and I had a try with addng cloud of bwldrmnt visual effect to it, and also nothing... I don't get the prob...

Here's a link to the script: http://pastebin.myrror.net/3411

And here is the code:
1 //::///////////////////////////////////////////////2 //:: Damnation
3 //:: nx_s2_damnation
4 //:: Copyright © 2007 Obsidian Entertainment, Inc.
5 //:://////////////////////////////////////////////
6 /*
7 classes: Cleric, Warlock
8 Spellcraft Required: 33
9 Caster Level: Epic
10 Innate Level: Epic
11 School: Enchantment
12 Descriptor(s): Teleportation
13 Components: Verbal, Somatic
14 Range: Touch
15 Area of Effect / Target: Creature touched
16 Duration: Instant
17 Save: Will negates (DC +5)
18 Spell Resistance: Yes
19
20 You banish a single foe to the Hells, with no possibility of return.
21 You must succeed at a melee touch attack, and the target must fail
22 at a Will saving throw (DC +5). If the target fails the saving throw,
23 it is dragged screaming into the Hells, to be tormented and ultimately
24 devoured by fiends.
25
26 Creatures that succeed at their saving throw are nonetheless exhausted
27 from resisting so powerful an enchantment, and they are Dazed for 1d6+1 rounds.
28 */
29 //:://////////////////////////////////////////////
30 //:: Created By: Andrew Woo
31 //:: Created On: 04/12/2007
32 //:://////////////////////////////////////////////
33 //:: AFW-OEI 06/25/2007: Reduce DC from +15 to +5.
34 //:: AFW-OEI 07/11/2007: Defer to NX1 Damnation hit VFX in spells.2da.
35
36
37 #include "X0_I0_SPELLS"
38 #include "x2_i0_spells"
39 #include "x2_inc_spellhook"
40
41
42 void main()
43 {
44 if (!X2PreSpellCastCode())
45 { // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
46 return;
47 }
48
49 object oCaster = GetLastSpellCaster();
50 int nSaveDC = GetSpellSaveDC() + 5;
51 int nDazeDuration = d4(1) + 2;
52 int hMax = GetCurrentHitPoints(oCaster);
53 object oTarget = GetSpellTargetObject();
54 //effect eVis = EffectVisualEffect(VFX_HIT_SPELL_EVIL);
55 effect eDeath = EffectDeath(TRUE, TRUE, TRUE); // No spectacular death, yes display feedback, yes ignore death immunity.
56 effect eDaze = EffectDazed();
57 effect eKnock = EffectKnockdown();
58 SetPlotFlag(oCaster, TRUE);
59 DelayCommand(3.0, SetPlotFlag(oCaster, FALSE));
60 effect eDam = EffectDamage(hMax-1, TRUE);
61 DelayCommand(3.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oCaster));
62 // Make a melee touch attack.
63 if (TouchAttackMelee(oTarget) != FALSE)
64 // Make save, so be dazed.
65 DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDaze, oTarget, RoundsToSeconds(nDazeDuration)));
66 DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eKnock, oTarget, RoundsToSeconds(nDazeDuration)));
67
68 { // If we succeed at a melee touch attack
69 if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
70 {
71 SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId()));
72
73 if (!MyResistSpell(OBJECT_SELF, oTarget))
74 {
75 //ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
76
77 if (!MySavingThrow(SAVING_THROW_WILL, oTarget, nSaveDC, SAVING_THROW_TYPE_SPELL, OBJECT_SELF))
78 { // Fail save and die.
79 DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget));
80 }
81 else
82 { // Make save, so be dazed.
83 DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDeath, oTarget, RoundsToSeconds(nDazeDuration)));
84 }
85
86 }
87 }
88 }
89 }

Modifié par psiiijay, 28 mai 2013 - 03:15 .


#2
psiiijay

psiiijay
  • Members
  • 258 messages
 uuhhhmmm how do you post a script it the small box?

#3
rjshae

rjshae
  • Members
  • 4 506 messages

psiiijay wrote...

 uuhhhmmm how do you post a script it the small box?


I switch to BBCode and wrap the script in

left square bracket Code right square bracket
code here
left square bracket /Code right square bracket

tags.

Modifié par rjshae, 26 mai 2013 - 02:24 .


#4
kamal_

kamal_
  • Members
  • 5 259 messages

rjshae wrote...

psiiijay wrote...

 uuhhhmmm how do you post a script it the small box?


I switch to BBCode and wrap the script in

left square bracket Code right square bracket
code here
left square bracket /Code right square bracket

tags.

Another option
pastebin.myrror.net/

#5
psiiijay

psiiijay
  • Members
  • 258 messages
Thanks, posted it on the site... rjshae- you mean like this: [/grgrg]? you wrote "code" 3 times, I didn't really get it...

Modifié par psiiijay, 26 mai 2013 - 05:05 .


#6
kamal_

kamal_
  • Members
  • 5 259 messages

psiiijay wrote...

Thanks, posted it on the site... rjshae- you mean like this: [/grgrg]? you wrote "code" 3 times, I didn't really get it...

Now you can link the post here. :happy: No one's going to look at the site and correct anything, but it provides a way to give a link to correctly formatted code.

#7
psiiijay

psiiijay
  • Members
  • 258 messages
Haha- Nice kamal_! I'll post it on the first one!

http://pastebin.myrror.net/3411

#8
kevL

kevL
  • Members
  • 4 074 messages
i suspect the problem is not with the spellscript, but in how it's getting called ...

liberal use of SendMessageToPC(GetFirstPC(), "...") usually indicates where things are stopping

#9
psiiijay

psiiijay
  • Members
  • 258 messages
I thought as much... I never had probs in nwn1 and now in 2 most of my scripts are not working.
Still I think it can't be as just for the check I used the actual Damnation spell (and not just a new feats.2da+spells.2da) So what could be the prob? What should I add? just a msg to myself to see if it goes through when I cast it?

#10
rjshae

rjshae
  • Members
  • 4 506 messages

psiiijay wrote...

Thanks, posted it on the site... rjshae- you mean like this: [/grgrg]? you wrote "code" 3 times, I didn't really get it...


There's a BBCode reference.

#11
psiiijay

psiiijay
  • Members
  • 258 messages
Nope, Couldn't post the code, but its pretty well written on the msg and I have a like to it on the other site. Anyways, the msg didn't work as well... I don't get it at all... It's like something Is not letting the script to change for some reason... Could anybody try it please and tell me what's up?

#12
diophant

diophant
  • Members
  • 116 messages
So, the script is not doing anything at all? There are two possible reasons:
1. The script isn't called at all. How did you name the script, and where did you put it?
2. X2PreCastSpellCode returns false, and the script immediately aborts.
Like kevL stated, use SendMessageToPC to check which lines of the script are executed. Especially, place this statement before line 44 and before line 49 to check whether the script is started, and whether it returns after X2PreCastSpellCode.

If you pass these lines, at least the delayed commands should fire.

After line 63, an opening bracket is missing, but this is not the reason while the script fails at all.