Jump to content

Scripting help needed -- inconsistent results in my script


okokokok

Recommended Posts

So, The purpose of the script is so get advanced enchantments on a blade when attacking different things. Also different enchantments whether you play a good or evil character (infamy/fame)

 

 

Attacking creatures works as it should different effects for fame and infamy works and enchantments go off right, now the problem really lies the attacking NPC's enchantments. I even think i narrowed it down to the if statements, if that helps you, help me at all :P

 

anyway, I'm posting the whole s*** here now i trust assholes won't take credit for someone else's broken work....

so here it is:

 

 

scn GreatHalbredOfDualismSCRIPT

Ref playerRef
Ref TargetRef
Ref MyRef
Ref BoneRef

begin ScriptEffectStart

if GetPCInfamy >= GetPCFame && TargetRef.GetCreatureType == -1 && TargetRef.GetDead == 1

	playerRef.cast GreatCurseSoulExtraction player ;summons lich -- broken last i tested
	PlayMagicShaderVisuals effectreanimate
	playsound "SPLConjurationHit"

elseif GetPCInfamy >= GetPCFame && TargetRef.GetCreatureType != -1 && getrandompercent >= 90

	Set BoneRef to PlaceAtMe SkelBoneThin01
	Set MyRef to GetSelf
         BoneRef.Cast GreatCurseBurden MyRef	 ;Slow, and damage fatuige -- Works like a charm when i last tested it
	BoneRef.Disable


elseif GetPCInfamy < GetPCFame && TargetRef.GetCreatureType == -1 && TargetRef.GetDead == 1

		playerRef.cast GreatGiftHolyFury player
		PlayMagicShaderVisuals effectrestorehealth ;Speed bonus, and fortify health and a bunch of otherstuff -- doesnt work at all last  i tested.
		playsound "SPLRestorationHit"


elseif GetPCInfamy < GetPCFame && TargetRef.GetCreatureType != -1 && getrandompercent >= 80

		Set BoneRef to PlaceAtMe SkelBoneThin01
		Set MyRef to GetSelf
		BoneRef.Cast GreatGiftFieryFury MyRef	 ;Fire damage -- works like a charm last i tested.
		BoneRef.Disable


endif

end


begin ScriptEffectFinish

StopMagicShaderVisuals effectreanimate
StopMagicShaderVisuals effectrestorehealth
end

Help me out. If you can point out the problem GREAT! if you can't.....well suggestions are always welcome!

 

Tyty

Edited by okokokok
Link to comment
Share on other sites

Why not write a script that switches 2 weapons back and forth instead? You could just use the dawnfang/duskfang one that's in KotN I think.

shivering isles, but the whole point is different enchantments on a SINGLE sword.

what i want to know is why my target isnt being recognized by the script.

Link to comment
Share on other sites

PlayerRef variable isn't assigned to any reference, you're missing a line like "set PlayerRef to player"

 

ps: there's nothing wrong in nesting code, ie

if GetPCInfamy >= GetPCFame
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
else
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
endif

Edited by grmblf
Link to comment
Share on other sites

PlayerRef variable isn't assigned to any reference, you're missing a line like "set PlayerRef to player"

 

ps: there's nothing wrong in nesting code, ie

if GetPCInfamy >= GetPCFame
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
else
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
endif

 

you can have an "if" within another "if"?

Link to comment
Share on other sites

Why not write a script that switches 2 weapons back and forth instead? You could just use the dawnfang/duskfang one that's in KotN I think.

 

Isn't the goal to have a weapon that does X damage if you have more fame and Y damage if you have more infamy? Easiest way to do that is to modify the dawnfang/duskfang script.

Link to comment
Share on other sites

PlayerRef variable isn't assigned to any reference, you're missing a line like "set PlayerRef to player"

 

ps: there's nothing wrong in nesting code, ie

if GetPCInfamy >= GetPCFame
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
else
if TargetRef.GetCreatureType == -1
	;do stuff
elseif getrandompercent >= 90
	;do stuff
endif
endif

 

you can have an "if" within another "if"?

 

You can have as many "elseif"s in a script as you want, as long as you have one if before the elseif(s).

 

 

 

EX

scn Randomness

short Target

Begin GameMode

set target to TargetRef
if (Target.GetAv Health <= 90)
Target.Kill
Elseif (Target.GetAv Health >= 90)
Target.MoveToMarker SomeMarkerREF
Elseif (Target.GetAV Health <= 180)
Target.ResetHealth
endif
end

 

 

 

Just some random example that shouldn't be used ingame for any reason lol And I can think of quite a few ways that are easier than editing the Dusk/Dawnfang script :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...