Jump to content

Setting more than 1 condition?


Deleted518329User

Recommended Posts

I may be overlooking something silly, but i cant seem to work out how to set more than one condition in a script.

I want to ONLY get the OnActivate Script working when both conditions are furfilled, the target NPC of the activate must first have the item in question (as its random on a levelled list) and the player must have the second item, called absorb. Then when activated it will give the player the item the NPC has.

Ive included the whole script in case of any conflictions, but the only bits im trying to change are the bottom 2 activates.

Basically my question is how do you set it so it must furfill both conditions for the script to run? as I get an error with this script if I simply put If the NPC has item immedietly followed by If PLAYEr has item.

 

ScriptName 0NPCBECKY

 

 

Begin OnHit

Equipitem 1POWERINVISIBILITY 1

Equipitem NPC1POWERINVISIBILITY 1

 

End

 

Begin OnLoad

If Player. GetItemCount 00ainaptive

Additem 1POWERINVISIBILITY 1

endif

end

 

Begin OnLoad

If Player. GetItemCount 00ainaptive < 1

Additem NPC1POWERINVISIBILITY 1

endif

end

 

Begin OnActivate

 

If getitemcount NPC1POWERINVISIBILITY >0

If Player getitemcount 0000ABSORB >0

Player. Additem 1POWERINVISIBILITY 1

Activate

endif

end

 

Begin OnActivate

 

If Player getitemcount 0000ABSORB >0

If getitemcount 1POWERINVISIBILITY 1

Player. Additem 1POWERINVISIBILITY 1

Activate

endif

end

Link to comment
Share on other sites

ScriptName 0NPCBECKY


Begin OnHit
Equipitem 1POWERINVISIBILITY 1
Equipitem NPC1POWERINVISIBILITY 1
End

Begin OnLoad
If Player. GetItemCount 00ainaptive
	Additem 1POWERINVISIBILITY 1
endif
end

Begin OnLoad
If Player. GetItemCount 00ainaptive < 1
	Additem NPC1POWERINVISIBILITY 1
endif
end

Begin OnActivate

If ( getitemcount NPC1POWERINVISIBILITY >0 ) && ( Player.getitemcount 0000ABSORB >0 )
	Player. Additem 1POWERINVISIBILITY 1
	Activate
endif
end

Begin OnActivate

If ( Player.getitemcount 0000ABSORB >0 ) && ( getitemcount 1POWERINVISIBILITY 1 )
	Player. Additem 1POWERINVISIBILITY 1
	Activate
endif
end

For more conditions you have to put "( Condition ) && ( Another Conditions )"

"( )" <-- Are not needed if you only have one condition ;)

What are you putting this script on?

Link to comment
Share on other sites

"( )" <-- Are not needed if you only have one condition ;)

Parentheses are not needed at all, regardless of the number of conditions. They help the user to mentally organize the formula but are unnecessary for the function of the equation.

 

This script confuses me as written.

_______________________________

ScriptName 0NPCBECKY

 

 

Begin OnHit

Equipitem 1POWERINVISIBILITY 1

Equipitem NPC1POWERINVISIBILITY 1

End

 

(This will attempt to run OnHit regardless of whether these items are in the subject's inventory. Could benefit from "If X.GetItemCount Y > 0" condition requirement before equipping.)"

 

Begin OnLoad

If Player. GetItemCount 00ainaptive

Additem 1POWERINVISIBILITY 1

endif

end

 

(This commands the NPC(?) to additem OnLoad if 00ainaptive does not exist in the player's inventory (I am assuming that no numeral being expressed for the GetItemCount will be interpreted as zero). Assuming that 0 inventory units for that item is the default condition, then this will add one 1POWERINVISIBILITY unit to the unit's inventory every time it is run until 00ainaptive is present in the player's inventory. Is there a purpose for this?)

 

Begin OnLoad

If Player. GetItemCount 00ainaptive < 1

Additem NPC1POWERINVISIBILITY 1

endif

end

 

(Less than one is equivalent to zero for the purposes of this script, making this OnLoad argument perform exactly the same as the one above, except that units of NPC1POWERINVISIBILITY will be added.)

 

Begin OnActivate

 

If getitemcount NPC1POWERINVISIBILITY >0

If Player getitemcount 0000ABSORB >0

Player. Additem 1POWERINVISIBILITY 1

Activate

endif

end

 

(If this script is active on an NPC and the player has the item 0000ABSORB in his inventory then he will add a 1POWERINVISIBILITY unit to his inventory regardless of how many he may already have. Is that necessary? I might recommend changing the first line to "If getitemcount NPC1POWERINVISIBILITY >0 && Player.getitemcount 1POWERINVISIBILITY <= 0" so that the item 1POWERINVISIBILITY is only added to the player's inventory if he does not already have one. I would also recommend placing the Activate command outside of the conditions, so that the scripted unit will activate as normal regardless of the contents of the inventory, otherwise you will get dead clicks on the unit if the required inventory items are not present. Suggestion follows:)

 

Begin OnActivate

Activate

 If getitemcount NPC1POWERINVISIBILITY >0 && Player.getitemcount 1POWERINVISIBILITY <= 0
	  If Player getitemcount 0000ABSORB >0
		   Player. Additem 1POWERINVISIBILITY 1
	  endif
 endif
end

 

Begin OnActivate

 

If Player getitemcount 0000ABSORB >0

If getitemcount 1POWERINVISIBILITY 1

Player. Additem 1POWERINVISIBILITY 1

Activate

endif

end

 

(This bit says that if the player has more than 0 units of 0000ABSORB and the unit being activated has one and only one unit of 1POWERINVISIBILITY, then the player will add one unit of 1POWERINVISIBILITY to his inventory regardless of how many are in his inventory already. Recommend conditionalizing to add to player inventory only on a zero count and moving Activate outside of conditions again.)

 

I don't understand the comment "the target NPC of the activate must first have the item in question (as its random on a levelled list)" since items seem to be added to the NPC's inventory based on whether the player has 00ainaptive in his inventory. How one acquires 00ainaptive is not described.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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