Musicianship

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 097.
Note: Core 097 is no longer officially supported.

Moderator: POL Developer

Post Reply
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Musicianship

Post by kwandobe »

I am working on the scripts now and it has come to my attention that we don't have an EVID_PEACEMADE anymore, and every attempt at finding a solution to this raises more questions.

I could send AI_ClearThoughts(npc, flags) to each mobile is the set area, but would that buy the peacemaker enough time to tame said creature, etc? I don't believe so. So I thought about running a script on each mobile that continuously sends the same event for 10-15 seconds, but not only would that flood the console, but it probably wouldn't be as effective as a built-in AI event.

Anyone have any ideas on how to solve my problem?


Update:

Hmm, another thought would be changing every untamed npc's script in the area to a dummy script maybe with a pause in it for a certain set of seconds, or just set it to a dummy script that waits for an attack to be made to restart the npc's original script. hrmm.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Musicianship

Post by Luth »

I haven't yet delved into BrainAI, so I'm mostly speaking out of ignorance: how much trouble would it be to put back in EVID_PEACEMADE and integrate it into the existing AI routine?
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

I have no idea... but I came up with another way to do it. I send the creature a dummy script that keeps him retarded until he takes damage or until the 15 seconds is up, at which point it reassigns his\her old control script.
Luth
Former Developer
Posts: 200
Joined: Mon Jan 30, 2006 8:10 am

Re: Musicianship

Post by Luth »

Sounds like a good alternative. If that's all peacemaking is, I suppose you could remake the EVID_PEACEMAKE that puts the script into something like:

Code: Select all

var now := ReadGameClock();
while(ReadGameClock - now < 15)
  var ev := Wait_For_Event(15);
  if(ev.type == /* damaged, engaged, whatever */)
    break;
  endif
endwhile
Or would that simple solution not work with brainAI?
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

Luth wrote:Sounds like a good alternative. If that's all peacemaking is, I suppose you could remake the EVID_PEACEMAKE that puts the script into something like:

Code: Select all

var now := ReadGameClock();
while(ReadGameClock - now < 15)
  var ev := Wait_For_Event(15);
  if(ev.type == /* damaged, engaged, whatever */)
    break;
  endif
endwhile
Or would that simple solution not work with brainAI?
It looks like it could possibly work. But switching the animals AI script with a dummy script that does the same thing works the same. It doesn't matter what type of npc it is, as long as it has a difficulty set in the npcdesc and it doesnt have an ip(player).

Plus adding to brainAI could cause future confusion, and it means everyone working distro needs the update. Switching the AI script, nobody needs an update.
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

Here is the dummy script I am using. I implemented your idea, it was similar to mine, but will work better I think.

Code: Select all

use npc;
use os;
use uo;

include ":brainAI:npcCommands";
include "include/sysEvent";

var me := Self();

program enticedai()

  var timeout := ReadGameClock();

    while(ReadGameClock() - timeout < 15)
    
      var ev := Wait_For_Event(15);
      
      if(ev.type == SYSEVENT_DAMAGED or SYSEVENT_ENGAGED)
        unentice(me);
        AI_Attack(me, ev.source);
      endif
      
    endwhile
    
    unentice(me);
    return;

endprogram

function unentice(me)

  var oldscript := CStr(GetObjProperty(me, "oldai"));
  if(!oldscript)
    return;
  endif
  me.script := oldscript;
  RestartScript(me);
  return;
  
endfunction
How about that!? Eh!
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

I am done with musicianship, provocation and peacemaking. However I have noticed that SkillCheck has a bit of a problem. I can use 1000000 as the difficulty and never miss a beat playing my instrument perfectly.

Code: Select all

  if(SkillCheck(who, "Musicianship", -1, pts))
    PlaySoundEffect(who, success);
  else
    PlaySoundEffect(who, fail);
  endif
any ideas?
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Musicianship

Post by Pierce »

Perhaps i've understood you wrong, but what you mean with
it has come to my attention that we don't have an EVID_PEACEMADE anymore
That this event is not part of the core anymore?
Because i use this one and that just work fine, even with the latest 98 release.
(Have you enabled the event? EnableEvents( EVID_PEACEMADE ); )
Last edited by Pierce on Thu Dec 25, 2008 5:41 am, edited 1 time in total.
User avatar
taxman
Journeyman Poster
Posts: 63
Joined: Tue Apr 18, 2006 11:10 pm

Re: Musicianship

Post by taxman »

Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Musicianship

Post by Pierce »

Ah i see. Try this

Code: Select all

const EVID_PEACEMADE         := 0x90000000;
That seems to work at least for my scripts so far.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Musicianship

Post by Yukiko »

It probably just needs to be added as a constant to whichever file defines events in the 0.97 Distro.

Kwandobe you said "Plus adding to brainAI could cause future confusion, and it means everyone working Distro needs the update. Switching the AI script, nobody needs an update." Peeps should be updating regularly from the SVN anyway.
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

Yukiko wrote:It probably just needs to be added as a constant to whichever file defines events in the 0.97 Distro.

Kwandobe you said "Plus adding to brainAI could cause future confusion, and it means everyone working Distro needs the update. Switching the AI script, nobody needs an update." Peeps should be updating regularly from the SVN anyway.
I have not had any time for scripting lately, but when I get the chance I will try using EVID_PEACEMADE. Thank you to all who replied!
kwandobe
New User
Posts: 22
Joined: Wed Dec 17, 2008 10:24 pm

Re: Musicianship

Post by kwandobe »

Good news, I will have time for scripting this week =)

Which means I will have musicianship taken care of soon and will hopefully start working on another script.
Post Reply