Jump to content

Question

Posted

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!

4 answers to this question

Recommended Posts

Posted

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
Posted

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. :(

Posted

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

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.

  • Recently Browsing   0 members

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