shooting and invincibility

Post here if you need help setting up your server, etc.
Post Reply
zoidberg
On Lightcycle Grid
Posts: 25
Joined: Thu Mar 13, 2008 2:45 am

shooting and invincibility

Post by zoidberg »

Hey, so for a shooting server, if someone is spawned and still considered "invincible", shots can still kill them. Is there any way to fix this?
-Z
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

that would be easy enough: in gWinZone.cpp, before killing a player because he/her touched a shot, it would check to see if they are invincible. also with death zones. what file has invincibility stuff in it?
Image
Image
Image
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

actually, that will be harder: invincible (invulnerable) information is in src/tron/gCycle.cpp while shots and death zones information is kept in src/tron/gWinZone.cpp.
Image
Image
Image
User avatar
Z-Man
God & Project Admin
Posts: 11587
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

That's not a problem. You can just call the Vulnerable() member function of gCycleMovement objects from the zone code.
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

z-man: you know this code great. exactly what i thought.
so something like this (gWinZone.cpp in void gDeathZoneHack::OnEnter):

Code: Select all

else if ( target->Player != Vulnerable() ) //If player is invincible
                {
                    //Don't kill ivincible players
                    return;
                }
i tried to compile it, but it gave me errors with gWinZone.cpp on a different line(?):
tron/gWinZone.cpp:1279: warning: deprecated conversion from string constant to ‘char*’
tron/gWinZone.cpp:1286: warning: deprecated conversion from string constant to ‘char*’
tron/gWinZone.cpp:1287: warning: deprecated conversion from string constant to ‘char*’
tron/gWinZone.cpp:1295: warning: deprecated conversion from string constant to ‘char*’
tron/gWinZone.cpp:1296: warning: deprecated conversion from string constant to ‘char*’

here is what i find at those lines:

Code: Select all

 pWinString = "$player_win_self_destruct";
                        pFreeString = "$player_free_self_destruct";
                        score = score_self_destruct;
but these lines were already there? i dont get it

EDIT: actually, those lines are just deprecated (some one is lazy) and i removed mine and it worked. tell me what im doing wrong.
Image
Image
Image
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

ok, i got it to work.
add these lines:

Code: Select all

    else if (!target->Vulnerable()) //Cycle is invulnerable
    {
         //Don't kill invulnerable cycles
         return;
    }
to gWinZone.cpp in

Code: Select all

void gDeathZoneHack::OnEnter( gCycle * target, REAL time )
right after

Code: Select all

{
    if (!dynamicCreation_)
    {
    target->Player()->AddScore(score_deathzone, tOutput(), "$player_lose_suicide");
    target->Kill();
    }
Image
Image
Image
zoidberg
On Lightcycle Grid
Posts: 25
Joined: Thu Mar 13, 2008 2:45 am

Post by zoidberg »

:) I was hoping for something simpler, without compiling. But thanks, I'll see if I can get it compiled on my poor little mac.
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

ask Pathetique for help, he has compiled servers on macs i know
Image
Image
Image
zoidberg
On Lightcycle Grid
Posts: 25
Joined: Thu Mar 13, 2008 2:45 am

Post by zoidberg »

yeah, he's gonna be my last resort, I hate to bother people with stupid questions.. But yeah, I know him pretty well and he'll be able to help me out :)
Post Reply