following is controlled by 3 variables:
FollowMode | Int | If set to 1, will follow the object given in FollowObject |
FollowObject | object | when FollowMode is set to 1, will follow this object |
FollowCombat | Int | Used with FollowMode. If set to 1, will continue to follow even in combat, if 0, will stop following in combat and restart after it |
The heartbeat script chekcs for follow mode and if set checks for follow object and combat state.
If the follow object is not valid will cancel follow mode, wait for for 10 minutes in that location and will then automatically start walkking waypoints again.
There are several helpfull scripts as interface to the followmode in conversations.
Action taken script for conversations to start and stop following.
Normal usage:
ca_g_followmode(1,0,0,0) to start follow
ca_g_followmode(0,0,0,10) to end.
Takes 4 parameters
type: int
setting nFollow to 1 makes the NPC start following PC
setting to 0 will make it stop
type: int
setting nPerception to 1 will make the NPC react normally to seen things
setting to 0 will make it ignore perception until attacked.
type: int
setting nFollowInCombat to 1 will make the creature follow even in combat
setting to 0 will make follow only when not in combat.
type: float fDelay is the time to wait after stop follow before start walking waypoints again.
This script enables and disable walking of waypoints to make the following work.
Conversation conditional script used to check if NPC is following anyone
Normal usage:
are we following the speaker: cc_g_isfollowing(0)
are we following someone else: cc_g_isfollowing(-1)
are we following anyone at all: cc_g_isfollowing(1)
Returns true if the NPC is following and fullfills the requirement given in nAnyone
Has one parameter
type: int
if nAnyone is set to 1 will return true for following anyone
if nAnyone is set to 0 will only return true if following PCspeaker.
if nAnyone is set to -1 will only return true if following someone else not PC
Used to check if the NPC is in given area for quests of type: take me to “area” Normal usage: cc_g_checkarea(“a_vesper”) will return true if the npc is in Vesper.
one parameter:
stype: string
Give the area tag as the parameter, if the NPC is currently in that area, return TRUE, else false.
Used to check if the NPC is near another object for quests of type: take me to “creature/exact place”
Normal usage: cc_g_checknear(“WP_nayegates”,20.0) will return true if the npc is within 20.0 meters from nayebay gates.
Give the tag of object and distance as parameter, if the NPC is currently that distance of less from the object, return TRUE, else false.
Has two paramters:
type:string Tag of the object to be near. This can be any object type, but does not work for items inside objects. Typically is a waypoint or creature tag.
type:float Have to be this close to the given object to return true. Remember that the NPC folows at few meters distance from you so normally a paramater of less that 10.0 will cause problems. 15-20 is normally a good choise.
who | conditional | say what | actiontaken | Note |
---|---|---|---|---|
NPC | cc_g_isfollowing(-1) | Hi | As following someone else, just greet | |
NPC | cc_g_isfollowing(0) | Hi, there yet? | As following PC, ask if we arrived | |
-PC | nope | Generic reply | ||
-PC | cc_g_checkarea(“a_vesper”) | Yes we are | ca_g_followmode(0,0,0,10) | disable follow mode |
ca_g_q_success(“QUEST_MY_MY”) | <and set quest to success | |||
NPC | cc_g_q_running(“QUEST_MY_MY”) | Continue? | Not following anyone but PC has quest going(like PC crashed) | |
NPC | NOT cc_g_checkarea(“a_tk_dyoa”) | Hi | Just say greeting and exit if not in start area | |
NPC | cc_g_canstart(“QUEST_MY_MY”) | Take me to Vesper! | can start the quest so say things and such | |
-PC | No | pc declines | ||
-PC | Sure | ca_g_followmode(1,0,0,0) | PC agrees so set follow mode | |
ca_g_q_setstate(“QUEST_MY_MY”,1) | and start the quest | |||
NPC | Hi | done |
Setting the NPC to immortal allows PC to raise/heal the NPC back, not setting effectively fails quest on NPC death.
Setting the perception flag to 1 in follow causes the NPC to do normal actions like attack enemies it sees so makes the quest much harder.
Note that the NPCs are still neutral to PCs with this so they are affected by some spells.