PenUltima Online

It is currently Fri Sep 05, 2008 9:44 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: peacemaking, provocation and brainAI add
PostPosted: Mon Dec 10, 2007 3:23 pm 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 99
Location: Poland
I`m not going to post here entire scripts but the main parts should be enough.

sysEvent.inc add
Code:
const EVID_MUSICIANSHIP     := 0x1134; //number set as You need


peacemaking skill:
When a player passes all skill checks, target is ok and all that a script sends an event to a peace target.
Code:
    var event := array;   
        event .+ type := EVID_MUSICIANSHIP;
        event .+ subcommand := SKILLID_PEACEMAKING;
        event .+ source := who;
        event .+ time := time;
        sendevent(target,event);

time - how long a target is to be calm

provocation skill:
[player sets 2 npc to fight]
Code:
    var evv1 := array;   
        evv1 .+ type := EVID_MUSICIANSHIP;
        evv1 .+ subcommand := SKILLID_PROVOCATION;
        evv1 .+ target := target1;
       
    var evv2 := array;   
        evv2 .+ type := EVID_MUSICIANSHIP;
        evv2 .+ subcommand := SKILLID_PROVOCATION;
        evv2 .+ target := target2;
       
        if(target1.npctemplate)
            sendevent( target2,evv1);
        endif
        if(target2.npctemplate)
            sendevent(target1,evv2);
        endif 


BrainAI add
I added it to virtual.src
Code:
use uo;
use os;

include ":brainAI:npcNerves";
include ":brainAI:npcCommands";
include "include/Sysevent";
program BrainNerve(params)
   var npc      := params[1];
   //var nerve_name:= params[2];
   var event   := params[3];
   //var settings   := params[4];
   //var scripts   := params[5];
   params := 0; // Not needed anymore.

   while ( npc )
      if ( event )
         case ( event.type )
                EVID_MUSICIANSHIP:
                        if(event.subcommand==SKILLID_PEACEMAKING)
                            spokoj(npc,event.time);
                            break;
                        endif
                        if(event.subcommand==SKILLID_PROVOCATION)
                            bij(npc,event.target);
                            break;
                        endif 
                default:
                    break;
          endcase
                  
         event := 0;
      endif
      
      event := Wait_For_Event(900000);
   endwhile
endprogram

function bij(npc,cel)
    AI_ClearThoughts(npc, CLR_BOTH);
    AI_EndNerve(npc, "Combat", WAKEUP);
    AI_Attack(npc, cel);
    return 1;
endfunction

function spokoj(npc, time)
    AI_ClearThoughts(npc, CLR_BOTH);
    AI_EndNerve(npc, "Combat", WAKEUP);
    AI_WarMode(npc);
    AI_Speak(npc, "*Postac uspokaja sie pod wplywem melodii*", SPEAK_TEXTTYPE_DEFAULT, SPEAK_DOEVENT_ENABLE, WAKEUP);
//translation mobile is calming down
    Setobjproperty(npc,"#uspokojona",1);
    //AI_Speak(npc, "Peace Time: "+time, SPEAK_TEXTTYPE_DEFAULT, SPEAK_DOEVENT_ENABLE, WAKEUP);
    sleep(time);
    Eraseobjproperty(npc,"#uspokojona");
    return 1;
endfunction



and a little add to shouldWatch.src (to keep peace time)
Code:
var npc := params[1];
if(Getobjproperty(npc,"#uspokojona"))
        return 0;
endif


I tested it and it works. If somone have better ideas I wait for them.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 8:56 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Thanks for posting this.

I'm a little busy at work now but I'll try and translate it and get it to compile and test it and let you know how it goes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl