Adding Guild Mission

Adding a NPC to create a new guild

To pick up guild missions you must be in a guild, so first of all you may wonder how to create a new guild. To create a new NPC please refer Adding quests for more information. It functions as the fundamentals for adding missions. 

Once you created your new NPC, open its properties window and set the chat_parameters to:

shop:guild_creator
menu: MENU_WHOAMI WHOAMI_GUILD_CLERK

Now, you're NPC will be able to create a new guild for you.

Notice: Creating a guild can be expensive, if you don't have enough money you can:

Creating a new primitive

To add a mission we must open a world and add a primitive to it (you can also use an existing primitive, the steps are the same, but in this article we will create a new primitive).
To add a primitive go to Project -> New Primitive and create your primitive. Your should now have a new primitive in the tree on the right of the world editor.

What are we gonna do ?

We are gonna create a new guild mission and a new solo mission that some guild members will have to complete. 
Only the guild leader will be able to pick this mission.

The objectives of this mission are:

Each member will earn 50 gold and the guild will earn 100 gold.

The objective of the solo mission is to kill 1 yubo. The reward of this mission is 20 gold.

Create a new guild mission

Now that you have a primitive, do a right click on it and select Add missions_editor.
You will have a new item in the tree, do a right click on the new item (a mission_editor item) and select Add mission_tree

Here is what you should have in your tree (i set the title of the mission tree to GUILD_MISSION)

 

Properties

Now that you have a mission tree it's time to set its properties.
Fill the properties of the mission tree like this (double click on the mission tree to see the properties window):

I told you to set the mission giver to: $givervar@fullname$. It's actually a variable that contains the name of the NPC that will give the mission.
Do a right click on the variables item in the tree and select Add var_npc.
Fill the window like this:

The NPC is a NPC from the urban_newbieland primitive so if you don't have it, just fill the form with the NPC you have.

Pre-requisites

In the pre-requisite form just set the require_guild_grade to Leader, and check the require_guild_membership radio box.
It means that only the leader of the guild will be able to pick up the mission.

Pre actions

First of all, you must add a step. Do a right click on the mission tree and select Add step.
You must have these new items in your tree:

Because one of the objectives of this mission is to complete another mission twice (by 2 guild members), we must spawn this mission in the guild members' quest journal.
To do so, we will add a new pre-action that will spawn the mission.
Do a right click on pre_actions and select Add spawn_mission.

Fill the form like this:

Objectives

We will have 2 objectives for this mission.
The first one will be to do the solo mission twice (by 2 guild members) and the second one will be to kill 2 yubos.

Do a right click on the objectives item and select Add do_mission.

Fill the form like this:

Now we have to create the second objective.
Do a right click on the objectives item and select Add kill.

Fill the form like this:

Post actions

Now that we set the objectives we need to add some rewards.
We will add a money reward for each member of the guild, and another money reward for the guild inventory.

First we are gonna add the money reward for the guild. Do a right click on the post_actions item and select Add recv_money.

Fill the form like this:

We now do the exact same thing for the second money reward (for each guild member).
This time we set the amount to 50 and we DON'T check the guild option.

Create a new solo mission for guild members

Now that we have a guild mission that spawns a solo mission for each guild member connected, we must create this solo mission.
To do so, do a right click on the missions editor and select Add mission_tree.

Properties

We must now define the properties of this mission.

Fill the form like this:

As for the guild mission we will set a new variable for the NPC name. So do a right click on the variables item and select Add var_npc.

Fill the window like this:

The NPC is a NPC from the urban_newbieland primitive so if you don't have it, just fill the form with the NPC you have.

Pre-requisites

There is nothing special to set for the pre-requisites of this mission.

Pre actions

There is no pre-action for this mission.

Objectives

The objective is to kill one yubo. So do a right click on the objectives item and select Add kill.

Fill the form like this:

Post actions

The reward of this mission will be 20 gold.
So do a right click on the post_actions item and select Add recv_money.

Just set the amount to 20 and DON'T check the guild option because we are not in a guild mission.

Compile the mission

Now that we have created our missions, we need to compile them.

Open the mission compiler.
Set the path to your primitives folder in the first field.
You should see your primitive in the list on the left.
Select your primitive and click on the >> button. Your primitive will move to the right list.

You should see something like this (maybe you don't have all the primitives i have but it's not important):

No click on VALIDATE and then click on COMPILE. If everything is correct the mission should be compiled.

Test the mission

Now to test your mission, put your primitive in the primitives folder used by your server (for more information on how to set your own server see this link: Set your server), and launch your server.
Be careful. Because the NPC i chose to give my missions is in the urban_newbieland primitive, the mission script is in this primitive, not in the primitive i created, so be sure you also added the urban_newbieland primitive in the primitives folder of the server if your mission giver is in the urban_newbieland primitive.

Video

Here is a video showing these guild missions: