Jump to content
  • 0

Character Vibes


Orosa1

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  02/17/14
  • Last Seen:  

I've been working on a quest system that works based on the alignment one chooses, the problem is just that, how do I make the NPC set the alignment for a character, and in turn, make NPCs check for a required alignment? I have yet to make my own variable such as alignment so I'm new to them basically. Any help would be greatly appreciated!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Oh, I also didn't read carefully enough. XD

The cleanest way is to add your own constants in db/const.txt (anywhere is fine), for example:

// these are separated by tabs
ALIGN_GOOD	1
ALIGN_EVIL	2
ALIGN_CHAOTIC	3
In scripts, you'd treat these the same as numbers. Using the character variable 'align', for example:

// set an alignment
mes "You are now aligned with evil.";
align = ALIGN_EVIL;

// check an alignment
if (align == ALIGN_GOOD)
	do this;
else if (align == ALIGN_EVIL)
	do that;
else if (align == ALIGN_CHAOTIC)
	do another;
else
	// not aligned
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

There's this for checking direction: Request for checkfacing or checkdirection script commands

It shouldn't be too difficult for you to create a 'setdirection' command based on that code, and you can always ask if you run into problems. If you haven't implemented any script commands before, you can read section 9 of doc/source_doc.txt for a (very) brief overview of how it works.

EDIT: misread, read below.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  02/17/14
  • Last Seen:  

Thanks for the fast reply! I may have worded the request wrong, I'm looking to set whether a character is good, evil, or chaotic, and make certain npcs check which one the player is set as, sorry if my word choices are confusing. :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  02/17/14
  • Last Seen:  

That's exactly what I was looking for! Thanks again Euphy! :3

So, I try the if, else statement, it says missing function or calling an undeclared function

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...