Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

Hi all,

 

I try to make a script that check the factions of npcs, then according to the result it give them selected items depends on faction.

For now It works for one faction, then I've try to make an extended script but this one give me those errors in the CK:

 

missing RPAREN at '\\r\\n'

no viable alternative at input '\\r\\n'

 

 

 

It's the last line in the first "if" block which is missing the ")" character at the end of the line. It should look like this:

 

 

Scriptname aaf_OutfitSwapExt extends ObjectReference  

faction property aaf_Faction01 auto
faction property aaf_Faction02 auto
armor property aaf_OutfitFa101 auto 
armor property aaf_OutfitFa102 auto
armor property aaf_OutfitFa103 auto  
armor property aaf_OutfitFa201 auto 
armor property aaf_OutfitFa202 auto
armor property aaf_OutfitFa203 auto  
armor property aaf_NakedReequipRing auto 

Event OnTriggerEnter(ObjectReference triggerRef)
    Actor akactionRef = triggerRef as Actor

    If akActionRef.IsInFaction(aaf_Faction01)
        akActionRef.unequipall() 
        akActionRef.additem(aaf_OutfitFa101,1,true) 
        akActionRef.additem(aaf_OutfitFa102,1,true) 
        akActionRef.additem(aaf_OutfitFa103,1,true) 
        akActionRef.equipitem(aaf_OutfitFa101,1,true)
        akActionRef.equipitem(aaf_OutfitFa102,1,true)
        akActionRef.equipitem(aaf_OutfitFa103,1,true)  ; <<<<< This is where the error was

    ElseIf akActionRef.IsInFaction(aaf_Faction02)
        akActionRef.unequipall() 
        akActionRef.additem(aaf_OutfitFa201,1,true) 
        akActionRef.additem(aaf_OutfitFa202,1,true) 
        akActionRef.additem(aaf_OutfitFa203,1,true) 
        akActionRef.equipitem(aaf_OutfitFa201,1,true)
        akActionRef.equipitem(aaf_OutfitFa202,1,true)
        akActionRef.equipitem(aaf_OutfitFa203,1,true)
    EndIf

EndEvent 


Event OnTriggerLeave(ObjectReference triggerRef)

    Actor akactionRef = triggerRef as Actor 

    If akActionRef.IsInFaction(aaf_Faction01)
        akActionRef.unequipall()
        akActionRef.removeitem(aaf_OutfitFa101,1,true)  
        akActionRef.removeitem(aaf_OutfitFa102,1,true)  
        akActionRef.removeitem(aaf_OutfitFa103,1,true) 
        akActionRef.additem(aaf_NakedReequipRing,1,true) 
        akActionRef.equipitem(aaf_NakedReequipRing,false,true)
        akActionRef.removeitem(aaf_NakedReequipRing,1,true) 

    ElseIf akActionRef.IsInFaction(aaf_Faction02)
        akActionRef.unequipall()
        akActionRef.removeitem(aaf_OutfitFa201,1,true)  
        akActionRef.removeitem(aaf_OutfitFa202,1,true)  
        akActionRef.removeitem(aaf_OutfitFa203,1,true) 
        akActionRef.additem(aaf_NakedReequipRing,1,true) 
        akActionRef.equipitem(aaf_NakedReequipRing,false,true)
        akActionRef.removeitem(aaf_NakedReequipRing,1,true)
    EndIf

EndEvent

 

 

Link to comment
Share on other sites

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

 

Hi all,

 

I try to make a script that check the factions of npcs, then according to the result it give them selected items depends on faction.

For now It works for one faction, then I've try to make an extended script but this one give me those errors in the CK:

 

missing RPAREN at '\\r\\n'

no viable alternative at input '\\r\\n'

 

 

 

It's the last line in the first "if" block which is missing the ")" character at the end of the line. It should look like this:

 

 

Scriptname aaf_OutfitSwapExt extends ObjectReference  

faction property aaf_Faction01 auto
faction property aaf_Faction02 auto
armor property aaf_OutfitFa101 auto 
armor property aaf_OutfitFa102 auto
armor property aaf_OutfitFa103 auto  
armor property aaf_OutfitFa201 auto 
armor property aaf_OutfitFa202 auto
armor property aaf_OutfitFa203 auto  
armor property aaf_NakedReequipRing auto 

Event OnTriggerEnter(ObjectReference triggerRef)
    Actor akactionRef = triggerRef as Actor

    If akActionRef.IsInFaction(aaf_Faction01)
        akActionRef.unequipall() 
        akActionRef.additem(aaf_OutfitFa101,1,true) 
        akActionRef.additem(aaf_OutfitFa102,1,true) 
        akActionRef.additem(aaf_OutfitFa103,1,true) 
        akActionRef.equipitem(aaf_OutfitFa101,1,true)
        akActionRef.equipitem(aaf_OutfitFa102,1,true)
        akActionRef.equipitem(aaf_OutfitFa103,1,true)  ; <<<<< This is where the error was

    ElseIf akActionRef.IsInFaction(aaf_Faction02)
        akActionRef.unequipall() 
        akActionRef.additem(aaf_OutfitFa201,1,true) 
        akActionRef.additem(aaf_OutfitFa202,1,true) 
        akActionRef.additem(aaf_OutfitFa203,1,true) 
        akActionRef.equipitem(aaf_OutfitFa201,1,true)
        akActionRef.equipitem(aaf_OutfitFa202,1,true)
        akActionRef.equipitem(aaf_OutfitFa203,1,true)
    EndIf

EndEvent 


Event OnTriggerLeave(ObjectReference triggerRef)

    Actor akactionRef = triggerRef as Actor 

    If akActionRef.IsInFaction(aaf_Faction01)
        akActionRef.unequipall()
        akActionRef.removeitem(aaf_OutfitFa101,1,true)  
        akActionRef.removeitem(aaf_OutfitFa102,1,true)  
        akActionRef.removeitem(aaf_OutfitFa103,1,true) 
        akActionRef.additem(aaf_NakedReequipRing,1,true) 
        akActionRef.equipitem(aaf_NakedReequipRing,false,true)
        akActionRef.removeitem(aaf_NakedReequipRing,1,true) 

    ElseIf akActionRef.IsInFaction(aaf_Faction02)
        akActionRef.unequipall()
        akActionRef.removeitem(aaf_OutfitFa201,1,true)  
        akActionRef.removeitem(aaf_OutfitFa202,1,true)  
        akActionRef.removeitem(aaf_OutfitFa203,1,true) 
        akActionRef.additem(aaf_NakedReequipRing,1,true) 
        akActionRef.equipitem(aaf_NakedReequipRing,false,true)
        akActionRef.removeitem(aaf_NakedReequipRing,1,true)
    EndIf

EndEvent

 

 

 

Oh no!!! that was it! I have read it over and over again, missed a piece during copy paste in CK... Thanks for the reply nice catch :thumbsup:

Link to comment
Share on other sites

Hi all, trying to get back into the modding game, and pretty much forgot everything I knew about scripting. I know I'm missing a relatively small thing that's preventing this from working, but I can't make this scripted spell function. The effect of the spell is set to "script", and the script is added, but it won't function ingame. The script is as follows. It compiles fine with no errors detected. Not sure what I'm missing.

 

Scriptname namehere extends activemagiceffect
{Event OnEffectStart (Actor akTarget, Actor akCaster)
Target.GetAV ("Health" -1)
Target.DamageAV ("Health")
EndEvent}
Edited by avenger404
Link to comment
Share on other sites

Hello. Noob question here. I'm making a mod that adds an aura effect via spell to the player which casts fear or calm to nearby targets based on conditions.

 

Just wanna know how to add the spell to the player upon mod activation. I tried editing the Player actor and it works but it also adds the other values that are in the Player actor such as the default starting spells, iron equipment, the Dragonborn book, etc. I'm assuming I will have to do this via scripting which I'm hoping I wouldn't have to do.

 

Thanks in advance.

Link to comment
Share on other sites

 

Hi all, trying to get back into the modding game, and pretty much forgot everything I knew about scripting. I know I'm missing a relatively small thing that's preventing this from working, but I can't make this scripted spell function. The effect of the spell is set to "script", and the script is added, but it won't function ingame. The script is as follows. It compiles fine with no errors detected. Not sure what I'm missing.

 

Scriptname namehere extends activemagiceffect
{Event OnEffectStart (Actor akTarget, Actor akCaster)
Target.GetAV ("Health" -1)
Target.DamageAV ("Health")
EndEvent}

 

First off the event is wrapped in {} which is an indication that you put your code in the description field instead of in the editor that opens up after setting up the new script. The description field is for a brief comment that explains what the script does. Certain locations in the CK will make a tool-tip appear with the description when the script entry is hovered with the mouse. Leaving it empty is acceptable.

 

Secondly, your GetAV and DamageAV lines are setup in a manner that probably won't work. Try the following instead:

Float HV = Target.GetAV("Health") - 1

Target.DamageAV("Health", HV)

Link to comment
Share on other sites

Hello again!

 

I'm searching a way to make npc unequip weapons and ammo based on keywords. I've checked the "WeaponRackActivateSCRIPT" who use keywords, but I'm not that much skilled enough to figure out how it need to be called.

 

I need something that unequip that : .HasKeyword(WeapTypeBattleAxe) || (WeapTypeBow) || (WeapTypeDagger) || (WeapTypeGreatsword) || (WeapTypeMace) || (WeapTypeStaff) || (WeapTypeSword) || (WeapTypeWarAxe) || (WeapTypeWarHammer) || (ArmorShield) || (VendorItemArrow)

 

If someone have an idea, I'm ready!!

Thanks for the help on this forum, and thanks in advance :thumbsup:

Link to comment
Share on other sites

@Darkxenoth

 

Just to rule it out... Are you assigning the weapon to the property that you are using to reference the weapon? If not, then Papyrus has no idea what weapon you want to modify.

Sorry for the late reply... but yes, I do assign the weapon to the property that references the weapon. I'm wondering if it isn't working properly because it's just on a generic weapon, not a unique one that is actually placed in the game and thus has a unique ID? Could that be the problem?

Link to comment
Share on other sites

@avenger404

 

 

 

Hi all, trying to get back into the modding game, and pretty much forgot everything I knew about scripting. I know I'm missing a relatively small thing that's preventing this from working, but I can't make this scripted spell function. The effect of the spell is set to "script", and the script is added, but it won't function ingame. The script is as follows. It compiles fine with no errors detected. Not sure what I'm missing.

 

Scriptname namehere extends activemagiceffect
{Event OnEffectStart (Actor akTarget, Actor akCaster)
Target.GetAV ("Health" -1)
Target.DamageAV ("Health")
EndEvent}

 

First off the event is wrapped in {} which is an indication that you put your code in the description field instead of in the editor that opens up after setting up the new script. The description field is for a brief comment that explains what the script does. Certain locations in the CK will make a tool-tip appear with the description when the script entry is hovered with the mouse. Leaving it empty is acceptable.

 

Secondly, your GetAV and DamageAV lines are setup in a manner that probably won't work. Try the following instead:

Float HV = Target.GetAV("Health") - 1

Target.DamageAV("Health", HV)

 

 

 

Not to nitpick or anything... and I could be entirely wrong, but... From my read through the script, the reason it has no effect/affect is because you didn't actually tell it how much damage to do...
Seems to me it is wondering how much damage to apply to 'Health', and makes me wonder why it would compile without a problem to be completely honest... doesn't seem like that function should allow you to not put a value, unless it is hardcoded to just default to 0 if no value is given for the damage. I highly agree with what Ishara had to say, in that if you set the amount of damage you want the spell to do into a variable and then give that variable as the amount of damage in the DamageAV function that it would likely work much better.

 

So basically:

 

Target.DamageAV("Health") 

isn't going to actually damage the target's health at all, simply because no value has been given for the damage to be done.

Float HV = (Target.GetAV("Health") - 1)
Target.DamageAV("Health", HV) 

defines the amount of damage you want done to the target's health, and thus should work as intended.

 

Edited by Darkxenoth
Link to comment
Share on other sites

So, I was just glancing back at the few mods I've actually uploaded and came up with a new question... Is there a way to dynamically change a Message/Message Box? Like my teleporter mod uses a Message as a menu to let you choose a destination to teleport to from a list of 1-5, with 1-5 representing a location that has been assigned as a 'teleLoc' previously; can I dynamically change the options from being 1, 2, 3, 4, 5 to the location names? Like if I set 1 to be in Riverwood, is there a way to make the menu recognize that and show Riverwood, 2, 3, 4, 5 instead of staying just 1, 2, 3, 4, 5?

 

If it helps, here's a look at the script that is currently being used by my mod:

 

ScriptName DarkxenothTeleporterScript extends ObjectReference

ObjectReference Property pcStartLoc Auto
ObjectReference Property currLoc Auto
ObjectReference Property firstLoc Auto
ObjectReference Property secondLoc Auto
ObjectReference Property thirdLoc Auto
ObjectReference Property fourthLoc Auto
ObjectReference Property fifthLoc Auto
ObjectReference Property ConvLocT Auto
Message Property myMenu Auto
Message Property myMenu2 Auto
Message Property myMenu3 Auto

Event OnEquipped(Actor akActor)
	Input.TapKey(Input.GetMappedKey("Tween Menu"))
	currLoc.MoveTo(Game.GetPlayer())
	Menu()
EndEvent

Function TeleToLoc(Int locNum)
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	If (locNum == 0)
		Game.GetPlayer().MoveTo(firstLoc)
		Game.EnableFastTravel()
		Game.FastTravel(firstLoc)
	ElseIf (locNum == 1)
		Game.GetPlayer().MoveTo(secondLoc)
		Game.EnableFastTravel()
		Game.FastTravel(secondLoc)
	ElseIf (locNum == 2)
		Game.GetPlayer().MoveTo(thirdLoc)
		Game.EnableFastTravel()
		Game.FastTravel(thirdLoc)
	ElseIf (locNum == 3)
		Game.GetPlayer().MoveTo(fourthLoc)
		Game.EnableFastTravel()
		Game.FastTravel(fourthLoc)
	ElseIf (locNum == 4)
		Game.GetPlayer().MoveTo(fifthLoc)
		Game.EnableFastTravel()
		Game.FastTravel(fifthLoc)
	EndIf
EndFunction

Function TeleToPCStartLoc()
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	Game.GetPlayer().MoveTo(pcStartLoc)
	Game.EnableFastTravel()
	Game.FastTravel(pcStartLoc)
EndFunction

Function TeleToConvLoc()
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	Game.GetPlayer().MoveTo(ConvLocT)
	Game.EnableFastTravel()
	Game.FastTravel(ConvLocT)
EndFunction

Function Menu(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu.Show()
	If (aiButton == 0)
		pcStartLoc.MoveTo(currLoc)
		Menu3()
	ElseIf (aiButton == 1)
		Menu2()
	ElseIf (aiButton == 2)
		TeleToPCStartLoc()
	ElseIf (aiButton == 3)
		pcStartLoc.MoveTo(currLoc)
		TeleToConvLoc()
	ElseIf (aiButton == 4)
		Return
	EndIf
EndFunction

Function Menu2(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu2.Show()
	If (aiButton == 0)
		firstLoc.MoveTo(currLoc)
	ElseIf (aiButton == 1)
		secondLoc.MoveTo(currLoc)
	ElseIf (aiButton == 2)
		thirdLoc.MoveTo(currLoc)
	ElseIf (aiButton == 3)
		fourthLoc.MoveTo(currLoc)
	ElseIf (aiButton == 4)
		fifthLoc.MoveTo(currLoc)
	ElseIf (aiButton == 5)
		Return
	EndIf
EndFunction

Function Menu3(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu3.Show()
	If (aiButton == 0)
		TeleToLoc(0)
	ElseIf (aiButton == 1)
		TeleToLoc(1)
	ElseIf (aiButton == 2)
		TeleToLoc(2)
	ElseIf (aiButton == 3)
		TeleToLoc(3)
	ElseIf (aiButton == 4)
		TeleToLoc(4)
	ElseIf (aiButton == 5)
		Return
	EndIf
EndFunction

 

 

Edited by Darkxenoth
Link to comment
Share on other sites

So, I was just glancing back at the few mods I've actually uploaded and came up with a new question... Is there a way to dynamically change a Message/Message Box? Like my teleporter mod uses a Message as a menu to let you choose a destination to teleport to from a list of 1-5, with 1-5 representing a location that has been assigned as a 'teleLoc' previously; can I dynamically change the options from being 1, 2, 3, 4, 5 to the location names? Like if I set 1 to be in Riverwood, is there a way to make the menu recognize that and show Riverwood, 2, 3, 4, 5 instead of staying just 1, 2, 3, 4, 5?

 

If it helps, here's a look at the script that is currently being used by my mod:

 

ScriptName DarkxenothTeleporterScript extends ObjectReference

ObjectReference Property pcStartLoc Auto
ObjectReference Property currLoc Auto
ObjectReference Property firstLoc Auto
ObjectReference Property secondLoc Auto
ObjectReference Property thirdLoc Auto
ObjectReference Property fourthLoc Auto
ObjectReference Property fifthLoc Auto
ObjectReference Property ConvLocT Auto
Message Property myMenu Auto
Message Property myMenu2 Auto
Message Property myMenu3 Auto

Event OnEquipped(Actor akActor)
	Input.TapKey(Input.GetMappedKey("Tween Menu"))
	currLoc.MoveTo(Game.GetPlayer())
	Menu()
EndEvent

Function TeleToLoc(Int locNum)
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	If (locNum == 0)
		Game.GetPlayer().MoveTo(firstLoc)
		Game.EnableFastTravel()
		Game.FastTravel(firstLoc)
	ElseIf (locNum == 1)
		Game.GetPlayer().MoveTo(secondLoc)
		Game.EnableFastTravel()
		Game.FastTravel(secondLoc)
	ElseIf (locNum == 2)
		Game.GetPlayer().MoveTo(thirdLoc)
		Game.EnableFastTravel()
		Game.FastTravel(thirdLoc)
	ElseIf (locNum == 3)
		Game.GetPlayer().MoveTo(fourthLoc)
		Game.EnableFastTravel()
		Game.FastTravel(fourthLoc)
	ElseIf (locNum == 4)
		Game.GetPlayer().MoveTo(fifthLoc)
		Game.EnableFastTravel()
		Game.FastTravel(fifthLoc)
	EndIf
EndFunction

Function TeleToPCStartLoc()
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	Game.GetPlayer().MoveTo(pcStartLoc)
	Game.EnableFastTravel()
	Game.FastTravel(pcStartLoc)
EndFunction

Function TeleToConvLoc()
	Utility.Wait(0.5)
	Game.FadeOutGame(False, True, 2.0, 1.0)
	Game.GetPlayer().MoveTo(ConvLocT)
	Game.EnableFastTravel()
	Game.FastTravel(ConvLocT)
EndFunction

Function Menu(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu.Show()
	If (aiButton == 0)
		pcStartLoc.MoveTo(currLoc)
		Menu3()
	ElseIf (aiButton == 1)
		Menu2()
	ElseIf (aiButton == 2)
		TeleToPCStartLoc()
	ElseIf (aiButton == 3)
		pcStartLoc.MoveTo(currLoc)
		TeleToConvLoc()
	ElseIf (aiButton == 4)
		Return
	EndIf
EndFunction

Function Menu2(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu2.Show()
	If (aiButton == 0)
		firstLoc.MoveTo(currLoc)
	ElseIf (aiButton == 1)
		secondLoc.MoveTo(currLoc)
	ElseIf (aiButton == 2)
		thirdLoc.MoveTo(currLoc)
	ElseIf (aiButton == 3)
		fourthLoc.MoveTo(currLoc)
	ElseIf (aiButton == 4)
		fifthLoc.MoveTo(currLoc)
	ElseIf (aiButton == 5)
		Return
	EndIf
EndFunction

Function Menu3(Int aiButton = 0)
	Utility.Wait(0.5)
	aiButton = myMenu3.Show()
	If (aiButton == 0)
		TeleToLoc(0)
	ElseIf (aiButton == 1)
		TeleToLoc(1)
	ElseIf (aiButton == 2)
		TeleToLoc(2)
	ElseIf (aiButton == 3)
		TeleToLoc(3)
	ElseIf (aiButton == 4)
		TeleToLoc(4)
	ElseIf (aiButton == 5)
		Return
	EndIf
EndFunction

 

 

As I understand it, message box buttons cannot be dynamically changed via script.

 

However, you could create multiple buttons each with a different location name and use conditions to only allow five to show at any given time.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...