Server Help

ASSS Custom Projects - King of the hill

tcsoccerman - Sat Jun 30, 2007 4:46 pm
Post subject: King of the hill
I'm looking for an as3 module that chooses a location on the map and puts a graphic at that location. you must go to that place and hold that hill for x amount of seconds to win that "king of the hill round". once you win..say 5 hills, you win that game. For an example of this go to Halo zone. Anything is appreciated.
Smong - Sat Jun 30, 2007 5:42 pm
Post subject:
I was asked to make this for halo same time last year. I'm attaching the module/source and a sample arena. I'm sure Halo won't mind since they never used it.

It doesn't run for 5 rounds and the reward is set to 200 bounty per round. If you want to make it give points have a look at stats.h and statcodes.h.
tcsoccerman - Sat Jun 30, 2007 6:34 pm
Post subject:
ty!
BDwinsAlt - Sun Jul 01, 2007 1:17 am
Post subject:
Halo was going to use it, but when it was compiled for Windows (by Muskrat), it crashed ASSS. Linux one worked fine on the development server. Awesome module.
tcsoccerman - Mon Jul 02, 2007 10:03 pm
Post subject:
smong, can you tell me what is wrong w/ this coding. it crashes as3 IN GAME.

Code: Show/Hide
else if (ad->rewardtype == 1)//points
   {
      pd->Lock();
      Link *link;
      Player *p;
         FOR_EACH_PLAYER(p)           
         {
           if (p->status == S_PLAYING &&
            p->arena == arena &&
            p->p_ship != SHIP_SPEC)
            {
                      stats->IncrementStat(p, STAT_BALL_GOALS, 1);
                      stats->SendUpdates();
              }
         }
         pd->Unlock();           
      chat->SendArenaSoundMessage(arena, SOUND_OOO,
         "Freq %d wins the Hill game! %d points given.",
         freq, ad->reward);

      lm->LogA(L_INFO, "halo_hill", arena,
         "freq %d won hill game. %d POINTS given.",
         freq, ad->reward);
        }

Solo Ace - Tue Jul 03, 2007 2:03 am
Post subject:
The indenting, for starters.
Animate Dreams - Tue Jul 03, 2007 8:19 am
Post subject:
Don't you have to use p->p_freq?
tcsoccerman - Tue Jul 03, 2007 8:46 am
Post subject:
Ty, i forgot that. it still isn't fixed though :\.
tcsoccerman - Tue Jul 03, 2007 8:58 am
Post subject:
Here is as3 when it crashed:

Code: Show/Hide
E <deadlock> deadlock detected, aborting

This application has requested the Runtime
Please contact the application's support t
asss out of memory. restarting.
asss 1.4.3 built at Jun  8 2006 23:41:46
Loading modules...


i also figured out that the crash happened in these two lines:

Code: Show/Hide
stats->IncrementStat(p, STAT_BALL_GOALS, 1);
                      stats->SendUpdates();


hope that helps.i'm just gonna play around w/ it and see what happens. maybe i'll get lucky
Cyan~Fire - Tue Jul 03, 2007 9:23 am
Post subject:
Well, there's nothing obviously wrong with that code, so either it's a bug in asss or you're corrupting the internal state somewhere else in your code.
tcsoccerman - Tue Jul 03, 2007 12:14 pm
Post subject:
I'm also adding a command to warp to the hill, and had to use mapdata to make sure the player can warp there w/out being warped back to spawn point because of a tile. i do this:

int tile = map->GetTile(p->arena, ad->x, ad->y);

and that line crashes as3 INGAME.

look in mapdata.h for info on it.
Smong - Wed Jul 04, 2007 11:35 am
Post subject:
The first issue, SendUpdates() can't be called if you hold the player lock. You only need to call it once anyway, do it after the loop and after the unlock().

The second one, you may want check the coordinates are valid before calling GetTile. They may be set to -1,-1 if the game isn't currently running or hasn't loaded yet.
tcsoccerman - Wed Jul 04, 2007 11:51 am
Post subject:
i think i found the problem. i forgot the

mm->getinterface

and

mm->releaseinterface

it still doesn't work though..
tcsoccerman - Thu Jul 05, 2007 10:21 am
Post subject:
I have fixed it by myself icon_smile.gif (*dr.brain*)
tcsoccerman - Thu Jul 05, 2007 11:32 am
Post subject:
Ok, i'm trying to notify the player when they spend money on this item, so i do this coding:

game->WarpTo(p, ad->x, ad->y);
chat->SendMessage(p, "Warped to %i, %i for %i dollars :)",ad->x, ad->y, price);
chat->SendMessage(p, "Tiles 1,2,3,4= %i, %i, %i, %i",tile[1],tile[2],tile[3],tile[3]);


why is it that the player is warped, but the message is never sent?
Smong - Thu Jul 05, 2007 2:35 pm
Post subject:
Looking at your code from a few posts back there are some corrections you can make:
- WarpTo takes a Target parameter, not a Player (lines 561 and 567).
- You're still using SendUpdates inside the player lock (line 334).
- The command "hillwarp" needs unregistering when the module detaches.
- You should put something in the comments at the top that you have edited this file from the original. You probably also want to change the info_halo_hill string (line 658).
- Your tile coordinates don't match up, in one place you are warping to x+4,y-3 but put x+4,y-4 in the chat message. If it's supposed to be like that add some comments to the code explaining why.
- Most people use %d instead of %i.
tcsoccerman - Thu Jul 05, 2007 2:38 pm
Post subject:
Ty for responding smong. I did some stuff w/ friends and forgot to reply back that i got it to work.
-Fixed already
-Will fix, even though it works right now.
-Already fixed
-Will do
-Noticed that earlier, will fix.
-I've always used %i, what's the difference?
Smong - Thu Jul 05, 2007 2:57 pm
Post subject:
I think %d and %i do exactly the same thing. Typically if you edit someone elses code you use their conventions to give it a consistent look.
tcsoccerman - Thu Jul 05, 2007 8:34 pm
Post subject:
Ok, what's the quickest way to find all the players within the hill. is there a "for" statement that would work best? i'm looking at mapdata.h and i don't really see anything for larger areas. i'm 99% sure you can't make elvl regoins in-game....what do you think?
Smong - Thu Jul 05, 2007 9:12 pm
Post subject:
There's already code in the timer function that does that using a for loop, just copy/paste it then edit it.
tcsoccerman - Thu Jul 05, 2007 9:14 pm
Post subject:
oh....i'm stupid. ty again. where would i be w/out you......(do me a favor and don't answer that).
cmdrpinksock - Sun Dec 14, 2008 7:44 pm
Post subject: Linux version
where can I get the linux version?
tcsoccerman - Sun Dec 14, 2008 7:49 pm
Post subject:
for linux your gonna have to compile a .so. I can't help you their but you could ask your host, or if you are your own host/run a linux machine, to compile the same .c file. I'm not very familiar with linux, at least not enough to tell you how to do this.
cmdrpinksock - Sun Dec 14, 2008 7:51 pm
Post subject: Compile for linux
Ok, thanks.... does anyone know how to compile this?
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group