Page 1 of 1

Musicianship

Posted: Tue Dec 23, 2008 1:05 am
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.

Re: Musicianship

Posted: Tue Dec 23, 2008 2:32 pm
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?

Re: Musicianship

Posted: Wed Dec 24, 2008 7:04 pm
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.

Re: Musicianship

Posted: Wed Dec 24, 2008 7:36 pm
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?

Re: Musicianship

Posted: Wed Dec 24, 2008 8:42 pm
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.

Re: Musicianship

Posted: Wed Dec 24, 2008 9:04 pm
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!

Re: Musicianship

Posted: Thu Dec 25, 2008 1:35 am
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?

Re: Musicianship

Posted: Thu Dec 25, 2008 5:36 am
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 ); )

Re: Musicianship

Posted: Thu Dec 25, 2008 5:38 am
by taxman

Re: Musicianship

Posted: Thu Dec 25, 2008 5:52 am
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.

Re: Musicianship

Posted: Thu Dec 25, 2008 11:49 pm
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.

Re: Musicianship

Posted: Sun Dec 28, 2008 12:52 am
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!

Re: Musicianship

Posted: Sun Jan 04, 2009 9:36 pm
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.