Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
In MERVBot - if(player has multifire)

 
Post new topic   Reply to topic Printable version
 View previous topic  Sub Arena Post :: Post i have ai bot and need help  View next topic  
Author Message
bugzap
Guest


Offline

PostPosted: Thu Nov 09, 2006 9:23 pm    Post subject: In MERVBot - if(player has multifire) Reply to topic Reply with quote

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.
Back to top
Cerium
Server Help Squatter


Age:42
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Fri Nov 10, 2006 12:03 am    Post subject: Reply to topic Reply with quote

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.
_________________
There are 7 user(s) ignoring me right now.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Nov 10, 2006 1:13 am    Post subject: Reply to topic Reply with quote

couldn't you watch weapons as well?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Fri Nov 10, 2006 2:52 am    Post subject: Reply to topic Reply with quote

yes in weapon part see if someonce has fired a multifire bulet.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
bugzap
Guest


Offline

PostPosted: Fri Nov 10, 2006 3:15 am    Post subject: Reply to topic Reply with quote

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!
Back to top
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Fri Nov 10, 2006 4:18 am    Post subject: Reply to topic Reply with quote

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
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
BugZap
Guest


Offline

PostPosted: Fri Nov 10, 2006 6:16 am    Post subject: Reply to topic Reply with quote

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 !!!
Back to top
BugZap
Guest


Offline

PostPosted: Fri Nov 10, 2006 7:48 am    Post subject: Reply to topic Reply with quote

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");
            }
      }

Back to top
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Nov 10, 2006 3:13 pm    Post subject: Reply to topic Reply with quote

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)
            {
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BugZap
Guest


Offline

PostPosted: Fri Nov 10, 2006 7:00 pm    Post subject: Reply to topic Reply with quote

Well, its the whole code..

In case some noob like me comes along and would like to use it.
Back to top
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sat Nov 11, 2006 7:30 pm    Post subject: Reply to topic Reply with quote

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?
Back to top
View users profile Send private message Add User to Ignore List
BugZap
Guest


Offline

PostPosted: Sat Nov 11, 2006 10:38 pm    Post subject: Reply to topic Reply with quote

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.
Back to top
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Sat Nov 11, 2006 11:40 pm    Post subject: Reply to topic Reply with quote

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);}.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BugZap
Guest


Offline

PostPosted: Sun Nov 12, 2006 1:11 am    Post subject: Reply to topic Reply with quote

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;
      
      
Back to top
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Sun Nov 12, 2006 1:58 am    Post subject: Reply to topic Reply with quote

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.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Guest



Offline

PostPosted: Sun Nov 12, 2006 2:31 am    Post subject: Reply to topic Reply with quote

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,
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 269 page(s) served in previous 5 minutes.

phpBB Created this page in 0.594019 seconds : 41 queries executed (75.7%): GZIP compression disabled