Author Topic: Creature Security System  (Read 167 times)

Legacy_Tythesly

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
Creature Security System
« on: September 15, 2011, 09:36:01 pm »


               I am making a castle for my friends and I. Each of use is going to get our own room (they choose the theme) and a couple creatures guarding it. Can you help me figure out how to script the following:

1. Creatures will not attack a PC.

2. Creatures will only attack a PC if they picked the lock or bashed the door down... (Basically every possible way except using the key)

3.
    a. If the player chats Guardians Disperse - the creatures fade away saying "As You Command Master" (in a special effect of smoke)
    b. If the player chats Guardians Unite - the creatures will reappear (with awesome summoning special effect)
  

Also is it possible to basically make them listen to the person who that room belongs to. I dont want the intruder commanding them to dissapear.

And Finally in the unsummon and summon effects I challenge you to find a awesome looking combination.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Creature Security System
« Reply #1 on: September 15, 2011, 11:50:13 pm »


               

Tythesly wrote...

I am making a castle for my friends and I. Each of use is going to get our own room (they choose the theme) and a couple creatures guarding it. Can you help me figure out how to script the following:

1. Creatures will not attack a PC.

2. Creatures will only attack a PC if they picked the lock or bashed the door down... (Basically every possible way except using the key)

You can make them of a neutral faction, and if an intruder enters without having "the key" set the faction hostile to the intruder until he leaves.

3.
    a. If the player chats Guardians Disperse - the creatures fade away saying "As You Command Master" (in a special effect of smoke)
    b. If the player chats Guardians Unite - the creatures will reappear (with awesome summoning special effect)
 

Also is it possible to basically make them listen to the person who that room belongs to. I dont want the intruder commanding them to dissapear.

And Finally in the unsummon and summon effects I challenge you to find a awesome looking combination.


GetPCChatMessage() in the corresponding module call a function relating the specific area to its guardians.
               
               

               
            

Legacy_Tythesly

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
Creature Security System
« Reply #2 on: September 15, 2011, 11:59:49 pm »


               

WhiZard wrote...

Tythesly wrote...

I am making a castle for my friends and I. Each of use is going to get our own room (they choose the theme) and a couple creatures guarding it. Can you help me figure out how to script the following:

1. Creatures will not attack a PC.

2. Creatures will only attack a PC if they picked the lock or bashed the door down... (Basically every possible way except using the key)

You can make them of a neutral faction, and if an intruder enters without having "the key" set the faction hostile to the intruder until he leaves.

3.
    a. If the player chats Guardians Disperse - the creatures fade away saying "As You Command Master" (in a special effect of smoke)
    b. If the player chats Guardians Unite - the creatures will reappear (with awesome summoning special effect)
 

Also is it possible to basically make them listen to the person who that room belongs to. I dont want the intruder commanding them to dissapear.

And Finally in the unsummon and summon effects I challenge you to find a awesome looking combination.


GetPCChatMessage() in the corresponding module call a function relating the specific area to its guardians.


Ok.... So I understand the faction part.

Im still very confused about the GetPCChatMessage Script.... And I figured out how to fix the creatures listen to the owner of the room sort of... What would the script look like if the creatures only listen to the PC that holds a special item?
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Creature Security System
« Reply #3 on: September 16, 2011, 12:27:40 am »


               Ok, First you need a little background...

1. The GetPCChatMessage  function call, gets the last message spoken outloud in the game.
   Initially, this doesnt sound useful, but, when used in the Module 'OnPlayerChat' event, it then allows you to fire functions, scripts and events on each chat message sent by players.

What you should do is the following


//This is your onChatScript for your module
void main()
{
 object oChatter = GetPCChatter();  // Cant remember if this is the right function name...
 object oArea = GetArea(oChatter);
 string sScript = GetLocalString(oArea,"CHAT_SCRIPT");
 if(sScript != "")
   {
      ExecuteScript(sScript);
   }

}


This is the start of a simple framework allowing you to have different scripts run, for different areas.

You would then make another script, specific for your personal quarters/secure area.

You would then use the  GetPCChatMessage  and other GetPCChat  functions, inside that function/script, to make the npcs react and follow direction as appropriate.
The tricky bit is actually knowing which npc to give the orders to, but I would solve that by storing the NPC Guards on the Player themselves, as Local Objects.
That way, you dont need to loop through all creatures,or objects to find the guards, just get the guards from the player via GetLocalObject()
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Creature Security System
« Reply #4 on: September 16, 2011, 05:44:24 pm »


               <blowing the dust off a tome...>

Tythesly wrote...
I am making a castle for my friends and I. Each of use is going to get our own room (they choose the theme) and a couple creatures guarding it. Can you help me figure out how to script the following:

1. Creatures will not attack a PC.

2. ... etc

You might want to look at Dezmodian's Toolset Guide (page 90).

He puts together a pretty good "Script IV:Trap for Unwelcome Guests" that seems to do most of what you want :-)

<...and looking both startled and pleased at the title revealed>
               
               

               


                     Modifié par Rolo Kipp, 16 septembre 2011 - 04:49 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Creature Security System
« Reply #5 on: September 16, 2011, 06:02:04 pm »


               

1. Creatures will not attack a PC.

You would want to go to the advanced tab of the creaure, and set them to Commoner Faction, or better yet create a unique faction for them making them friendly towards PCs.  (The easiest way is to give them the Commoner Faction)

2. Creatures will only attack a PC if they picked the lock or bashed the door down... (Basically every possible way except using the key)

Here you will need to script the door's OnDeath, & OnUnlock events to get the person who either Destroyed the Door or Unlocked the door..  (Why not just require a key for the door = Unable to be Pick Locked & set the door to plot "unbashable")

3.
    a. If the player chats Guardians Disperse - the creatures fade away saying "As You Command Master" (in a special effect of smoke)
    b. If the player chats Guardians Unite - the creatures will reappear (with awesome summoning special effect)

Chat Scripting, whoosh!  This may take a bit of work...
 

Also is it possible to basically make them listen to the person who that room belongs to. I dont want the intruder commanding them to dissapear.

You will want to set a local integer on the PC to tell chat scripts they are indeed allowed to "speak the commands", here you would just use a trigger, when the PC enters the area, you would place it on the PC "if" they are the owner of the area.. (If they had the key to the door they would be considered the owner obviously)

And Finally in the unsummon and summon effects I challenge you to find a awesome looking combination.

VFX_UNSUMMON + Mystical Explosion is pretty good (delay the explosion about 3.0 second precisely 0.5 seconds before they "vanish", they will need to vanish at 3.5 seconds)

//--------------------------------------------

Something like this would actually require someone to make you a module / resource, don't think just scripts would be enough, you would probably not understand fully unless you were able to view each detail.  The hardest part is creating a new faction for the "guards" which if you have never done would be a bit of a challenge.


In a polite way, I'm saying you are asking for something rather large here, not just a couple scripts, sorry but I don't have the time today, but maybe I can get back with you on it later..
               
               

               


                     Modifié par _Guile, 16 septembre 2011 - 05:11 .
                     
                  


            

Legacy_Tythesly

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
Creature Security System
« Reply #6 on: September 19, 2011, 07:31:07 pm »


               

_Guile wrote...

1. Creatures will not attack a PC.

You would want to go to the advanced tab of the creaure, and set them to Commoner Faction, or better yet create a unique faction for them making them friendly towards PCs.  (The easiest way is to give them the Commoner Faction)

2. Creatures will only attack a PC if they picked the lock or bashed the door down... (Basically every possible way except using the key)

Here you will need to script the door's OnDeath, & OnUnlock events to get the person who either Destroyed the Door or Unlocked the door..  (Why not just require a key for the door = Unable to be Pick Locked & set the door to plot "unbashable")

3.
    a. If the player chats Guardians Disperse - the creatures fade away saying "As You Command Master" (in a special effect of smoke)
    b. If the player chats Guardians Unite - the creatures will reappear (with awesome summoning special effect)

Chat Scripting, whoosh!  This may take a bit of work...
 

Also is it possible to basically make them listen to the person who that room belongs to. I dont want the intruder commanding them to dissapear.

You will want to set a local integer on the PC to tell chat scripts they are indeed allowed to "speak the commands", here you would just use a trigger, when the PC enters the area, you would place it on the PC "if" they are the owner of the area.. (If they had the key to the door they would be considered the owner obviously)

And Finally in the unsummon and summon effects I challenge you to find a awesome looking combination.

VFX_UNSUMMON + Mystical Explosion is pretty good (delay the explosion about 3.0 second precisely 0.5 seconds before they "vanish", they will need to vanish at 3.5 seconds)

//--------------------------------------------

Something like this would actually require someone to make you a module / resource, don't think just scripts would be enough, you would probably not understand fully unless you were able to view each detail.  The hardest part is creating a new faction for the "guards" which if you have never done would be a bit of a challenge.


In a polite way, I'm saying you are asking for something rather large here, not just a couple scripts, sorry but I don't have the time today, but maybe I can get back with you on it later..


I appreciate the help lol... Yes I am completely new to this and have almost no idea about scripting. Im only good at area design rofl... Im hoping you could help me in the future because this is a big deal to my friends and I.