Server Help

Bot Questions - In MERVBot - if(player has multifire)

Anonymous - Thu Nov 09, 2006 9:23 pm
Post subject: In MERVBot - if(player has multifire)
In MERVBot how can I ask if player has PRIZE_Multifire its not listed below
p->multifire - would do it but its not lised


p->(burst repel, thor, brick, decoy, rocket, portal) = how many items of that type player has
p->(stealth, cloak, xradar, awarp, ufo, flash, safety, shields, supers) = if player has that item on (boolean)



multifire is awarded by the bot, but dont want it awared twice, so need to know if its already been awarded to that player.
Cerium - Fri Nov 10, 2006 12:03 am
Post subject:
It's not something that is ever reported by the client. Basically you have two options:

(1) If the prize factor for multifire is set so players cannot naturally find one, then all you have to do is keep a list of players you have given the prize to. As they die or change ships/freqs remove them from the list.

(2) Similar to above, but rather than adding the players to the list when the bot prizes them, you can handle one of the prize packets (don't remember which) and add the player to the list when they get a multifire prize.
Muskrat - Fri Nov 10, 2006 1:13 am
Post subject:
couldn't you watch weapons as well?
Witchie NL - Fri Nov 10, 2006 2:52 am
Post subject:
yes in weapon part see if someonce has fired a multifire bulet.
Anonymous - Fri Nov 10, 2006 3:15 am
Post subject:
ok some ideas there,

I need to know if theirs a better way to go about this or if im on the right track.

Im using player bounty to give prizes.
//-----------------------------------------

Player starts at 100 bty
50 bty for each kill

3 kills = 250 bty (give prize)// lame prize
8 kills = 500 bty (give prize)// multi/bounce something good
18 kills = 1000 bty (give prize)// reset all inital weaponds for that ship (burst/repel/portal etc.) + nrg/prize updates.

2000 bty, 3000bty etc. repeat..


Code: Show/Hide

========================================

if (p->ship != SHIP_Spectator)
{

/*--------for testing-------*/
//sendPrivate(p, "*prize 50");
/*---------------*/

      if (p->ship == SHIP_Warbird){sendPrivate(p, "You Are In SHIP_Warbird");}
      else if (p->ship == SHIP_Javelin){sendPrivate(p, "You Are In SHIP_Javelin");}
      else if (p->ship == SHIP_Spider){sendPrivate(p, "You Are In SHIP_Spider");}
      else if (p->ship == SHIP_Leviathan){sendPrivate(p, "You Are In SHIP_Leviathan");}
      else if (p->ship == SHIP_Terrier){sendPrivate(p, "You Are In SHIP_Terrier");}
      /////////
      else if (p->ship == SHIP_Weasel)
      {
            if (p->bounty > 235 && p->bounty < 265)
            {
               sendPrivate(p, "Here ya go, multifire.");
               sendPrivate(p, "*prize #15");
            }
            else if (p->bounty > 480 && p->bounty < 520)
            {
               sendPrivate(p, "Here ya go, Super.");
               sendPrivate(p, "*prize #17");
            }
            else if (p->bounty > 975 && p->bounty < 1025)
            {
               sendPrivate(p, "Here ya go, Super.");
               sendPrivate(p, "*prize #17");
            }
            else if (p->bounty > 1970 && p->bounty < 2030)
            {
               sendPrivate(p, "Here ya go, Super.");
               sendPrivate(p, "*prize #17");
            }
      }
      ///////////
      else if (p->ship == SHIP_Lancaster){sendPrivate(p, "You Are In SHIP_Lancaster");}
      else if (p->ship == SHIP_Shark){sendPrivate(p, "You Are In SHIP_Shark");}
      
}//if not in spec close

=================================



Basicly if i could just track kills.. on 3rd kill *prize on 10th kill *prize etc..



Thanks for your time!
Witchie NL - Fri Nov 10, 2006 4:18 am
Post subject:
or use tag's. But this will work aswell yes. if you implent it in EVENT_PlayerDeath. And change the sendPrivate(p, in a k
Anonymous - Fri Nov 10, 2006 6:16 am
Post subject:
As a quick test to end the day.. I tried this


Code: Show/Hide

   case EVENT_PlayerDeath:
      {
         Player *p = (Player*)event.p[0],
                   *k = (Player*)event.p[1];
         Uint16 bounty = (Uint16)(Uint32)event.p[2];
         Uint16 flags = (Uint16)event.p[3];
         
               if (k->ship == SHIP_Warbird)
               {
                     sendPublic("I am in SHIP_Warbird");
               }
               else if (k->ship == SHIP_Javelin)
               {
                     sendPublic("I am in SHIP_Javelin");
               }
               else if (k->ship == SHIP_Spider)
               {
                     sendPublic("I am in SHIP_Spider");
               }
      }
      break;



Hard to test with nobody to kill, but seemed to work with the bot killing me.
I'll give the tag's thing a try, soon as I can figure them out.


Thanks !!!
Anonymous - Fri Nov 10, 2006 7:48 am
Post subject:
Here's what I ended up with, still needs configured for each ship etc.


Issue:
Apparently when a player dies they leave a green by default?
If the zone isn't setup for that, it will vanish almost instantly,
but close kills can result in the killer greening icon_sad.gif
which throws of the evenly numbered bty icon_sad.gif
Could try and round off the bty? dunno, then we could just ask if( k->bounty == x ) but..

Could also put this crap in a Array of some sort to cut down its size icon_wink.gif,
but I dont think var new Array() will work here, and I dont know c+ well enuff.

Code: Show/Hide

   
      if (k->ship == SHIP_Warbird)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }
      
      else if (k->ship == SHIP_Javelin)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }
      
      else if (k->ship == SHIP_Spider)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }
      
      else if (k->ship == SHIP_Leviathan)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }

      else if (k->ship == SHIP_Terrier)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }
/* -- sendPublic((String)k->bounty) -- FOR TESTING -- SHIP_Weasel ONLY -*/
      else if (k->ship == SHIP_Weasel)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPublic((String)k->bounty);
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPublic((String)k->bounty);
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPublic((String)k->bounty);
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPublic((String)k->bounty);
                  sendPrivate(k, "*prize #17");
            }
      }

      else if (k->ship == SHIP_Lancaster)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }

      else if (k->ship == SHIP_Shark)
      {
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {
                  sendPrivate(k, "*prize #17");
            }
      }


Muskrat - Fri Nov 10, 2006 3:13 pm
Post subject:
Umm... correct me if I'm missing something but how it that different from simply....
Code: Show/Hide
            if (k->bounty > 235 && k->bounty < 265)
            {
                  sendPrivate(k, "*prize #15");
            }
            else if (k->bounty > 480 && k->bounty < 520)
            {
                  sendPrivate(k, "*prize #17");
            }
            else if (k->bounty > 975 && k->bounty < 1025)
            {
                  sendPrivate(k, "*prize #17 - Here ya go, Super.");
            }
            else if (k->bounty > 1970 && k->bounty < 2030)
            {

Anonymous - Fri Nov 10, 2006 7:00 pm
Post subject:
Well, its the whole code..

In case some noob like me comes along and would like to use it.
Solo Ace - Sat Nov 11, 2006 7:30 pm
Post subject:
Fool.

Your code is no different from what Muskrat posted.

You're doing the following, in some sort of pseudo-code-ish language:
Code: Show/Hide

if (k's ship is a Warbird)
{
   give killer a prize based on bounty value
}
else if (k's ship is a Javelin)
{
   give killer a prize based on bounty value
}
else if (k's ship is a spider)
{
   give killer a prize based on bounty value
}

What Muskrat meant is: "Handling the prizing based on the bounty value once is enough. Why check the shiptype too?"

I'm not really paying that much attention to these forums anymore, but did we just get a few new Spyed/Qndre members?
Anonymous - Sat Nov 11, 2006 10:38 pm
Post subject:
Check the shiptype to give diffrent prizes to diffrent ships, and Muskrat's code is the code I wrote, tho Im not so proud of it. And Im a Guest at these forums, not a member.

They should neuter chimps like you.
Muskrat - Sat Nov 11, 2006 11:40 pm
Post subject:
Making all those redundant comparisons is still more work than it should be. Use variables for the prize numbers, set the variables in a k->ship switch, then run that code once after it.

When I(and I presume Solo as well) saw a block of code I skipped your sentence about different prizes and thought you were doing something stupid.

Mi apologia!

Also, If you really just want to do it by number of kills, use player tags and increment k's tag. Then you can do a if(get_tag(k, TAG_KILLS)%3(or whatever) == 0){...prize 100*(get_tag(k, TAG_KILLS)/3);}.
Anonymous - Sun Nov 12, 2006 1:11 am
Post subject:
No apologies necessary here, Im just here goofing around trying to learn this stuff, so I can add my name to the list of failed zones someday.. lol

I did finally figure out the tag thing (very useful!). You no doubt are right, its the way to go.
Ill work out the redundancies at some point.



Code: Show/Hide


case EVENT_PlayerDeath:
      {
         Player *p = (Player*)event.p[0],
               *k = (Player*)event.p[1];
         Uint16 bounty = (Uint16)(Uint32)event.p[2];
         Uint16 flags = (Uint16)event.p[3];
         
         set_tag(p, KILLS, 0);
         set_tag(k, KILLS, get_tag(k, KILLS) + 1);
         
         if (get_tag(k, KILLS) == 5)
         {
            if (k->ship == SHIP_Warbird)
            {}
            else if (k->ship == SHIP_Javelin)
            {}
            else if (k->ship == SHIP_Spider)
            {}
            else if (k->ship == SHIP_Leviathan)
            {}
            else if (k->ship == SHIP_Terrier)
            {}
            else if (k->ship == SHIP_Weasel)
            {sendPublic("5 kills");}
            else if (k->ship == SHIP_Lancaster)
            {}
            else if (k->ship == SHIP_Shark)
            {}
         }
         else if (get_tag(k, KILLS) == 10)
         {
            if (k->ship == SHIP_Warbird)
            {}
            else if (k->ship == SHIP_Javelin)
            {}
            else if (k->ship == SHIP_Spider)
            {}
            else if (k->ship == SHIP_Leviathan)
            {}
            else if (k->ship == SHIP_Terrier)
            {}
            else if (k->ship == SHIP_Weasel)
            {sendPublic("10 kills");}
            else if (k->ship == SHIP_Lancaster)
            {}
            else if (k->ship == SHIP_Shark)
            {}
         }
         if (get_tag(k, KILLS) == 15)
         {
            if (k->ship == SHIP_Warbird)
            {}
            else if (k->ship == SHIP_Javelin)
            {}
            else if (k->ship == SHIP_Spider)
            {}
            else if (k->ship == SHIP_Leviathan)
            {}
            else if (k->ship == SHIP_Terrier)
            {}
            else if (k->ship == SHIP_Weasel)
            {sendPublic("15 kills");}
            else if (k->ship == SHIP_Lancaster)
            {}
            else if (k->ship == SHIP_Shark)
            {}
         }
      }
      break;
      
      

Muskrat - Sun Nov 12, 2006 1:58 am
Post subject:
Code: Show/Hide
if(get_tag( k , KILLS ) % 5 == 0){
   if(k->ship == SHIP_Weasel)
      sendPublic( "%d kills", get_tag(k , KILLS));
}


This does the same thing you have in a lot less code. Where you can, use patterns in your numbers to make generic stuff. Your handling every ship different still worries me, If it is really necessary use a switch, but if only a few ships need different values handle a default case.
Anonymous - Sun Nov 12, 2006 2:31 am
Post subject:
To be honest, Im not sure of the final setup. Dividing by 5 would work out nicely, but like I said not sure of the final setup yet. After 3rd prize at 1000 bty it might not prize again till 1500, or 2000 bty.

I did write a chunk of code using switch case, it breaks after finding the ship, alittle less work. But I guess for now atleast ill just leave it hard coded till i figure out where im going with this zone.

Maybe in the end ill try a plugin that can be easily setup whatever way in a ini file, but thats a ways off.

Thanks for you insight,
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group