Jump to content

Limitation


Tatyan

Recommended Posts

Hello everybody, me again <.<

 

I would like to know a thing (for now. I am really, really trying to keep public questions at minimum. I swear.)

 

If I have to put two or more restriction, how I have to separate them?

Say:

 

IF ~NumTimesTalkedTo(0) Race(Player1,HUMAN) Alignment(Player1,MASK_EVIL)~

 

Between Race(Player1,HUMAN) and Alignment(Player1,MASK_EVIL) there has to be something?

 

Also, in the other talk, do I have to put all the other requirements? (race elf, race half elf, race dwarf, alignment etc) or not?

 

Thank you, I am reading other mod code, but I have a lot of requirements for the beginning and it is a little, well, overhelming.

 

But I am determined to learn to code, too. <.<

 

Sorry I know, I am an inconvenience^^

Link to comment

In a dialog trigger you can write

IF ~NumTimesTalkedTo(0) Race(Player1,HUMAN) Alignment(Player1,MASK_EVIL)~ THEN

with a single space between.

 

In a script trigger you would write

IF
NumTimesTalkedTo(0) 
Race(Player1,HUMAN) 
Alignment(Player1,MASK_EVIL)
THEN

 

Also, in the other talk, do I have to put all the other requirements?
Scripts and dialog files are evaluated from the top down meaning that the first one to be true gets used. So if you've one specific talk for one specific arrangement of values, put that first. Any failing such checks would skip that block and go to the next one, etc, etc until finding one with all true triggers.

 

I'm sure I'm being as clear as mud :p

Link to comment

In a dialog trigger you can write

IF ~NumTimesTalkedTo(0) Race(Player1,HUMAN) Alignment(Player1,MASK_EVIL)~ THEN

with a single space between.

 

In a script trigger you would write

IF
NumTimesTalkedTo(0)
Race(Player1,HUMAN)
Alignment(Player1,MASK_EVIL)
THEN

 

Also, in the other talk, do I have to put all the other requirements?
Scripts and dialog files are evaluated from the top down meaning that the first one to be true gets used. So if you've one specific talk for one specific arrangement of values, put that first. Any failing such checks would skip that block and go to the next one, etc, etc until finding one with all true triggers.

 

I'm sure I'm being as clear as mud :p

 

Thank you, you are a godsend! :D

I mean this:

NPC doesn't join if the character is evil, an human, or an half-orc (and I still can't find the half orc race code, sigh). So if charname is evil, human or half-orc the dialogue doesn't have a possibility for joining. I hope I did it right :S

If charname is neutral, good, half elf, elf, halfling, or dwarf, the dialogue that start can make him join the party. (I have shamelessy copied Darian code <.<)

But I don't understand If I have to put all the Race(Player1,ELF) Race(Player1,DWARF), allignment etc etc in the second dialogue. You say no, am I right?

I think it will get easier the more I learn, first steps are always the harder^^

Link to comment

if PC is evil or human or half-orc then no joining. but anything opposite can join

 

This is how I'd do it. do negative checks for the values of PC you don't want and so if they are all true then it's a valid PC for joining. if any one is false then it moves down to the next state which would be for those PC not valid for joining

 

IF ~NumTimesTalkedTo(0) !Race(Player1,HUMAN) !Race(Player1,HALFORC) !Alignment(Player1,MASK_EVIL) Global("abnpcjoinedparty","GLOBAL",0)~ THEN BEGIN IntroductoryState1
SAY ~Do you need another sword in your party?~
IF ~~ THEN REPLY ~Yes I do~ GOTO JoinedState
IF ~~ THEN REPLY ~No I do not~  GOTO DeclinedState

IF ~Global("abnpcjoinedparty","GLOBAL",0) Random(1,3)~ THEN BEGIN IntroductoryState2_1
SAY ~Leave. I want nothing to do with you.~ EXIT

IF ~Global("abnpcjoinedparty","GLOBAL",0) Random(2,3)~ THEN BEGIN IntroductoryState2_2
SAY ~Back off before things get ugly.~ EXIT

IF ~Global("abnpcjoinedparty","GLOBAL",0) Random(3,3)~ THEN BEGIN IntroductoryState2_3
SAY ~I do not wish to talk to you.~ EXIT

IF ~~ THEN BEGIN JoinedState
SAY ~Then my sword is yours.~
DO ~SetGlobal("abnpcjoinedparty","GLOBAL",1) JoinParty()~ EXIT

IF ~~ THEN BEGIN DeclinedState
SAY ~I will be here if you change your mind.~
IF ~~ THEN DO ~SetGlobal("abnpcjoinedparty","GLOBAL",2)~ EXIT

 

the three states with Random trigger just allow for some variety if an evil, human or half-orc PC talks to him multiple times :p

Any variable not set is automatically at 0 as far as the game is concerned, setting a variable is a good way to eliminate certain states from happening again by accident. Oh and use your own mod prefix so that others can identify which files and variables are yours. ^^ Mine is ab and I used it in the example. If you haven't done so yet, you can look at what prefixes are registered and register your own. Community Filename Prefix

 

Note your state positioning, unless you want to apply weighting after the fact to get things just right. because in my example if you put the state labeled "DeclinedState" immediately after the IntroductoryState1 whenever IntroductoryState1 fails the DeclinedState would be applied. Some people solve it by just carrying the same trigger set to each GOTO state, I personally prefer to minimize further errors from copy/paste or retyping and just make sure the states are in proper order to begin with.

 

Might be best for the time being to put your top level states, the things you want your NPC to say when first clicked on in one file and the states being directed to in another. Then when all done with developing the dialog, put the goto states at the bottom after all the top level states. So long as your top level states take care of all possible scenarios you'll never have to worry about any of the GOTO states accidentally triggering. ....... Alternatively you could just keep all your GOTO states at the bottom of the file to begin with :p

 

Prolly more info than you asked for :p

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...