PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
peacemaking, provocation and brainAI add

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion
Display posts from previous:   

Author Message
coltain



Joined: 20 Mar 2007
Posts: 87
Location: Poland

PostPosted: Mon Dec 10, 2007 7:23 pm    Post subject: peacemaking, provocation and brainAI add Reply with quote

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.

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Dec 20, 2007 12:56 pm    Post subject: Reply with quote

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.

Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty