Jump to content

Force Stun, Force Hate, Force Control Mind and Force Paralysis (SP)


Recommended Posts

Posted

After i dig into the weapon code, and i learned basic how to make and add weapons on SP, i wanna start to learn the next step, and so i wanna learn how to do new force power on SP. this is more easy because i can have 32 force power and SP get only 16 force power.

my idea is to make 3 new force power that allow to separate the mindtrick option.

force stunning: like mindtrick 1-2

force hate: like mindtrick level 3, enemy affected fight for you.

force control mind: enemy is possessed, like mindtrick level 4.

force paralisys: well, enemy is freezed but for that i will need some help.

i think i will begin reading @@eezstreet MP force power tutorial and finding on SP code the code block related.

:)

stay tuned.

If i will got succeeded, i will share my code with peoples and i will make a tutorial for adding Force power to single player. :)

 

 

Daedra likes this
Posted

After i dig into the weapon code, and i learned basic how to make and add weapons on SP, i wanna start to learn the next step, and so i wanna learn how to do new force power on SP. this is more easy because i can have 32 force power and SP get only 16 force power.

my idea is to make 3 new force power that allow to separate the mindtrick option.

force stunning: like mindtrick 1-2

force hate: like mindtrick level 3, enemy affected fight for you.

force control mind: enemy is possessed, like mindtrick level 4.

force paralisys: well, enemy is freezed but for that i will need some help.

i think i will begin reading @@eezstreet MP force power tutorial and finding on SP code the code block related.

:)

stay tuned.

If i will got succeeded, i will share my code with peoples and i will make a tutorial for adding Force power to single player. :)

 

 

There are a few force powers I would love to see for JKA.

 

The first would be Force Rip (not a fart joke)

 

This would consist of lifting the target into the air similar to a force grip, and then dismembering them completely ripping their arms, head, legs and torso apart (hands also). After dismemberment, the pieces will automatically fall to the ground (so you dont keep gripping the broken pieces of the target).

 

 

The second would be Force Slam (not a sex joke)

 

This would consist of simply crushing the target into the ground in which the target dies instantly. Pretty simple really.

 

 

The third and final would be like what you suggested, a new Force Mind Trick called Force Pursuasion.

 

This would consist of literally changing the targets playerteam for 30 seconds. Rather than controlling the target you would simply change their playerteam temporarily to fight on your side.

 

 

 

But either way good luck on this work and I hope it turns out awesome!

Posted

There are a few force powers I would love to see for JKA.

 

The first would be Force Rip (not a fart joke)

 

This would consist of lifting the target into the air similar to a force grip, and then dismembering them completely ripping their arms, head, legs and torso apart (hands also). After dismemberment, the pieces will automatically fall to the ground (so you dont keep gripping the broken pieces of the target).

 

 

The second would be Force Slam (not a sex joke)

 

This would consist of simply crushing the target into the ground in which the target dies instantly. Pretty simple really.

 

 

The third and final would be like what you suggested, a new Force Mind Trick called Force Pursuasion.

 

This would consist of literally changing the targets playerteam for 30 seconds. Rather than controlling the target you would simply change their playerteam temporarily to fight on your side.

 

 

 

But either way good luck on this work and I hope it turns out awesome!

Woah, stop man! D: i am not so skilled again to do these things. but you have really a good idea. maybe i will make in future, when i have knowledge and possibility to do it :)

force persuasion is an half way between mindtrick level 3 and level 4 i think, so you possess an enemy and other enemy shoot to this enemy ahaha, should be funny XD.

for ripping, i see that kind of thing on force grip level 4 of an old dark forces mod multiplayer, but i never found source code of DF mod so i cannot learn by this code for reply it. :(

Daedra likes this
Posted

Sounds nice, but I've got a couple questions. Would there be any difference between the powers that you suggest and the different levels of mind trick? I mean, what's the difference between Mind trick level 3 and Force Hate? 

 

If you want a suggestion for a force power, maybe you could try to add the ability to levitate NPCs without hurting them. Like Grip, but without doing any damage. 

 

Good luck with your quest!

Asgarath83 likes this
Posted

Sounds nice, but I've got a couple questions. Would there be any difference between the powers that you suggest and the different levels of mind trick? I mean, what's the difference between Mind trick level 3 and Force Hate? 

 

If you want a suggestion for a force power, maybe you could try to add the ability to levitate NPCs without hurting them. Like Grip, but without doing any damage. 

 

Good luck with your quest!

 Good question. well, because i am just beginning with code, nothing for moment. they will act exactly like the level of mindtrick. my target is to separate these things in different power, instead of using the same power for all that. because... because for my mod i need to separate into different power, LOL.

i think that the difference can be into the way how that power works.

maybe force stun level 1 can stun a enemy for a lot of second, stun 2 more duratiom, stun 3 can stun all enemy in front of player.

hate act in the same way. enemy pass to the player side for some amount of time, level 3 can make this of an entire group of enemy.

i wanna remove the code part that avoid of saberist to be mindtricked. not worry, bosses sure are immune to mindtrick. ^^  i have already setted immunity for all boss classes. in this case, the cultist become really funny because can be obnibalated or turn againt theyr same teammeate Lol.

for force paralysis, well, enemy not move, not shoot, it's freezed, basically, maybe with a preset animation standing. like the stasys of kotor. i think level 3 paralysis can affected an entire group of enemy for a lot of second.

but for now, i need to make the first step: learn how to add a new force power into the HUD.

mmm another interessing power maybe should be force blind, so player become invisible to enemy, if they are not really closest they cannot detecting him. should be fun.

well i need to think about that.

In the time, i hope my weapon tutorial can help someone with his mod. ^_^

i hope to receive some feedback about his utility. :) if you will make some cool weapon for Single player, let me know :)

PS: if you wanna give me some suggest about customizzation of level power of these powers, let me know ^^

Noodle likes this
Posted

The weapon tutorial was released? I didn't know! Gonna check that out.

Good luck :) is for a gun, but if you look the code files of the various weapons and you understand the various code block you can make every kind of weapon you want. the limitation is only 3 weapons :\  because SP got 28 weapon + weapon_none and the max value is 32. otherwise, i am working to a way for expand this: i understood how to change weapon efx, snd and dmg in base of the CLASS of the user. so a gun of CLASS_LUKE can got different effect of a gun of CLASS_SABOTEUR, for example. that's is cool and add the possibility to put weapons with a large amount of customizations :) later i think i show also a little tutorial about how to make that.

Posted

@@Noodle

@

I make some bug in the datapad code of force power and now descrition are not much good aligned but for the rest i add my new 4 force power and they works properly used by player. for the moment they act exactly like mindtrick. tomorrow i fix the bugs and i customize the new powers. when i fix all things i think i will write a tutorial for add new powers on SP. :)

it's relatively easy, respect to weapons. D:

Daedra likes this
Posted

You got some personal wish about torturing NPCs? :D

 

Don't worry about that, I already have a whole mod folder dedicated to it :shifty:

No, I was actually thinking about just having more Force Powers returning from Jedi Knight and Mysteries of the Sith. Those games had pretty cool Force Powers.

Asgarath83 likes this
Posted

Don't worry about that, I already have a whole mod folder dedicated to it :shifty:

No, I was actually thinking about just having more Force Powers returning from Jedi Knight and Mysteries of the Sith. Those games had pretty cool Force Powers.

i have not played because i started with JO. what kind of powers? :)

Posted

i have not played because i started with JO. what kind of powers? :)

 

Light side powers were nice, but nothing dramatically different - in comparison to JA, the Light Side only lacks Force Blinding. Force Persuasion in Jedi Knight was more of an invisibility power than convincing an enemy to turn against the other enemies. Aside from that, the Dark Side powers were more interesting, in the specific Force Throw: essentially picking an enemy and let everything moveable (except items like shield recharges, etc.) in the room fly on him, causing great damage. Somewhat, the code for this already exists in JA: misc_model_breakable can be pushed toward a target, causing damage, though it seems to be horribly broken - apparently only one target will be chosen for ALL misc_model_breakables.

 

And... well... how could you forget Force Destruction and Force Deadly Sight (burn them on sight!)?

 

Mysteries of the Sith featured even more interesting powers, namely, Force Far Sight (basically an Out of Body Experience, flying as far as you can, but consuming Force Energy doing it) and Force Projection (as the name says, it created an illusory copy of the Jedi where it stood, drawing the enemy fire).

Posted

Light side powers were nice, but nothing dramatically different - in comparison to JA, the Light Side only lacks Force Blinding. Force Persuasion in Jedi Knight was more of an invisibility power than convincing an enemy to turn against the other enemies. Aside from that, the Dark Side powers were more interesting, in the specific Force Throw: essentially picking an enemy and let everything moveable (except items like shield recharges, etc.) in the room fly on him, causing great damage. Somewhat, the code for this already exists in JA: misc_model_breakable can be pushed toward a target, causing damage, though it seems to be horribly broken - apparently only one target will be chosen for ALL misc_model_breakables.

 

And... well... how could you forget Force Destruction and Force Deadly Sight (burn them on sight!)?

 

Mysteries of the Sith featured even more interesting powers, namely, Force Far Sight (basically an Out of Body Experience, flying as far as you can, but consuming Force Energy doing it) and Force Projection (as the name says, it created an illusory copy of the Jedi where it stood, drawing the enemy fire).

Mmmm, yes, should be interessing a coding project for add they in SP game of JKA D: i can tell you how to add new force powers, but for add these things on game depends by who want to take this project on the hand. i see however that @@JediBantha was workin on force destruction and also another i see worked on deadly sight power. the missing are the force throw and the ESP experience and illusion power.

Posted

Force Hate done. now is the turn of the Force Control Mind act like level 4 Mindtrick with some edits.

and now it's hard.

XD

@@Ramikad yep, i found in wp_saber.cpp old voids related to force_throw power :)

there is in the code, but is passive, need just to be connected and make available.

Daedra likes this
Posted

control mind work... until certain point... i need a little hint about how fix it.

the bug are that:

1: enemy charmed not go to playerteam. (i wanna they go to playerteam so enemy can atk and slam they)

2: jump key to exit no work.

3: charm not expire on forcecontrolmind time out effect.

(is duration should be 1 min for level 3, 40 sec for level 2 and 20 second for level 1.

:\

void ForceControlMind( gentity_t *self )
{
    trace_t    tr;
    vec3_t    end, forward;
    gentity_t    *traceEnt;
    qboolean    targetLive = qfalse;

    if ( WP_CheckBreakControl( self ) )
    {
        return;
    }
    if ( self->health <= 0 )
    {
        return;
    }
    //FIXME: if mind trick 3 and aiming at an enemy need more force power
    if ( !WP_ForcePowerUsable( self, FP_CONTROLMIND, 0 ) )
    {
        return;
    }

    if ( self->client->ps.weaponTime >= 800 )
    {//just did one!
        return;
    }
    if ( self->client->ps.saberLockTime > level.time )
    {//FIXME: can this be a way to break out?
        return;
    }

    AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
    VectorNormalize( forward );
    VectorMA( self->client->renderInfo.eyePoint, 2048, forward, end );
    
    //Cause a distraction if enemy is not fighting
    gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_BODY, (EG2_Collision)0, 0 );
    if ( tr.entityNum == ENTITYNUM_NONE || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
    {
        return;
    }
    
    traceEnt = &g_entities[tr.entityNum];
    
    if( traceEnt->NPC && traceEnt->NPC->scriptFlags & SCF_NO_FORCE )
    {
        return;
    }

    if ( traceEnt && traceEnt->client  )
    {
        switch ( traceEnt->client->NPC_class )
        { // CLASS CANNOT BE DOMINATED
        case CLASS_GALAKMECH:
        case CLASS_ATST:
        case CLASS_SAND_CREATURE:
        case CLASS_TAVION:
        case CLASS_DESANN:
        case CLASS_JAN:
        case CLASS_GALAK:
        case CLASS_LIZARD:
        case CLASS_MURJJ:
        case CLASS_FLIER2:
        case CLASS_GLIDER:
        case CLASS_FISH:
        case CLASS_CLAW:
        case CLASS_REBORN:
        case CLASS_JEDI:
        case CLASS_ALORA:
        case CLASS_MORGANKATARN:
        case CLASS_WAMPA:
        case CLASS_MINEMONSTER:
        case CLASS_KYLE:
        case CLASS_LUKE:
        case CLASS_SHADOWTROOPER:
        case CLASS_LANDO:
        case CLASS_BARTENDER:
        case CLASS_UGNAUGHT:
        case CLASS_WEEQUAY:
        case CLASS_NOGHRI:
        case CLASS_TUSKEN:
        case CLASS_SWAMPTROOPER:
        case CLASS_GRAN:
        case CLASS_BESPIN_COP:
        case CLASS_SABOTEUR:
        case CLASS_HAZARD_TROOPER:  
        case CLASS_ROCKETTROOPER:
        case CLASS_REBEL:
        case CLASS_PROBE:
        //no droids either
        case CLASS_GONK:
        case CLASS_R2D2:  
        case CLASS_MARK1:
        case CLASS_MARK2:
        case CLASS_MOUSE:
        case CLASS_JAWA:
        case CLASS_HOWLER:
        case CLASS_SEEKER:
        case CLASS_SENTRY:
        case CLASS_REMOTE:
        case CLASS_PROTOCOL:
        case CLASS_ASSASSIN_DROID:
        case CLASS_SABER_DROID:
        case CLASS_BOBAFETT: // you wanna to control galesh and arcidemon? Just try!
            break;
        case CLASS_RANCOR:
            if ( !(traceEnt->spawnflags&1) )
            {
                targetLive = qtrue;
            }
            break;
        default:
            targetLive = qtrue;
            break;
        }
    }
    if ( targetLive
        && traceEnt->NPC
        && traceEnt->health > 0 )
    {//hit an organic non-player
        if ( G_ActivateBehavior( traceEnt, BSET_MINDTRICK ) )
        {//activated a script on him
            //FIXME: do the visual sparkles effect on their heads, still?
            WP_ForcePowerStart( self, FP_CONTROLMIND, 0 );
        }
        else if ( traceEnt->client->playerTeam != self->client->playerTeam )
        {//an enemy
            int override = 0;
            if ( (traceEnt->NPC->scriptFlags&SCF_NO_MIND_TRICK) )
            {
                if ( traceEnt->client->NPC_class == CLASS_GALAKMECH )
                {
                    G_AddVoiceEvent( traceEnt, Q_irand( EV_CONFUSE1, EV_CONFUSE3 ), Q_irand( 3000, 5000 ) );
                }
            }
            else if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] > FORCE_LEVEL_0 )
            {//control them, even jedi
                G_SetViewEntity( self, traceEnt );
                traceEnt->NPC->controlledTime = level.time + 30000;
            }
            else if ( /*traceEnt->s.weapon != WP_SABER
                &&*/ traceEnt->client->NPC_class != CLASS_REBORN )
            {//haha!  Jedi aren't easily confused!
                if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] > FORCE_LEVEL_0
                    && traceEnt->s.weapon != WP_NONE        //don't charm people who aren't capable of fighting... like ugnaughts and droids, just confuse them
                    /*&& traceEnt->client->NPC_class != CLASS_TUSKEN//don't charm them, just confuse them
                    && traceEnt->client->NPC_class != CLASS_NOGHRI//don't charm them, just confuse them*/
                    // CLASS CHARMABLES
                    && traceEnt->client->NPC_class == CLASS_SWAMP
                    && traceEnt->client->NPC_class == CLASS_INTERROGATOR
                    && traceEnt->client->NPC_class == CLASS_PRISONER
                    && traceEnt->client->NPC_class == CLASS_RODIAN
                    && traceEnt->client->NPC_class == CLASS_STORMTROOPER
                    && traceEnt->client->NPC_class == CLASS_IMPWORKER
                    && traceEnt->client->NPC_class == CLASS_IMPERIAL
//                    && !Pilot_AnyVehiclesRegistered()        //also, don't charm guys when bikes are near
                    )
                {//turn them to our side
                    //if mind trick 3 and aiming at an enemy need more force power
                    override = 50;
                    if ( self->client->ps.forcePower < 90 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_DEFAULT;
                        traceEnt->client->leader = self;
                    }
                    //FIXME: maybe pick an enemy right here?
                    //FIXME: does nothing to TEAM_FREE and TEAM_NEUTRALs!!!
                    team_t    saveTeam = traceEnt->client->enemyTeam;
                    traceEnt->client->enemyTeam = traceEnt->client->playerTeam;
                    traceEnt->client->playerTeam = saveTeam;
                    //FIXME: need a *charmed* timer on this...?  Or do TEAM_PLAYERS assume that "confusion" means they should switch to team_enemy when done?
                    traceEnt->NPC->controlledTime = level.time + ControlMindTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]];
                    if ( traceEnt->ghoul2.size() && traceEnt->headBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/controlmind" ), traceEnt->playerModel, traceEnt->headBolt, traceEnt->s.number, traceEnt->currentOrigin, mindTrickTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]], qtrue );
                    }
                }
                else
                {//turn them to our side
                    //if mind trick 3 and aiming at an enemy need more force power
                    override = 50;
                    if ( self->client->ps.forcePower < 90 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_DEFAULT;
                        traceEnt->client->leader = self;
                    }
                    //FIXME: maybe pick an enemy right here?
                    //FIXME: does nothing to TEAM_FREE and TEAM_NEUTRALs!!!
                    team_t    saveTeam = traceEnt->client->enemyTeam;
                    traceEnt->client->enemyTeam = traceEnt->client->playerTeam;
                    traceEnt->client->playerTeam = saveTeam;
                    //FIXME: need a *charmed* timer on this...?  Or do TEAM_PLAYERS assume that "confusion" means they should switch to team_enemy when done?
                    traceEnt->NPC->controlledTime = level.time + ControlMindTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]];
                    if ( traceEnt->ghoul2.size() && traceEnt->headBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/controlmind" ), traceEnt->playerModel, traceEnt->headBolt, traceEnt->s.number, traceEnt->currentOrigin, mindTrickTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]], qtrue );
                    }
                    NPC_PlayConfusionSound( traceEnt );
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                }
            }
            else
            {
                NPC_Jedi_PlayConfusionSound( traceEnt );
            }
            WP_ForcePowerStart( self, FP_CONTROLMIND, override );
        }
        else if ( traceEnt->client->playerTeam == self->client->playerTeam )
        {//an ally
            //maybe just have him look at you?  Respond?  Take your enemy?
            if ( traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
            {
                NPC_UseResponse( traceEnt, self, qfalse );
                WP_ForcePowerStart( self, FP_CONTROLMIND, 1 );
            }
        }//NOTE: no effect on TEAM_NEUTRAL?
        vec3_t    eyeDir;
        AngleVectors( traceEnt->client->renderInfo.eyeAngles, eyeDir, NULL, NULL );
        VectorNormalize( eyeDir );
        G_PlayEffect( "force/controlmind", traceEnt->client->renderInfo.eyePoint, eyeDir );

        //make sure this plays and that you cannot press fire for about 1 second after this
        //FIXME: BOTH_FORCEMINDTRICK or BOTH_FORCEDISTRACT
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEGRIP_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
        //FIXME: build-up or delay this until in proper part of anim
    }
    else
    {
        if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] > FORCE_LEVEL_1 && tr.fraction * 2048 > 64 )
        {//don't create a diversion less than 64 from you of if at power level 1
            //use distraction anim instead
            G_PlayEffect( G_EffectIndex( "force/force_controlmind_touch" ), tr.endpos, tr.plane.normal );
            //FIXME: these events don't seem to always be picked up...?
            AddSoundEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, qtrue, qtrue );
            AddSightEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, 50 );
            WP_ForcePowerStart( self, FP_CONTROLMIND, 0 );
        }
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEGRIP_RELEASE, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
    }
    self->client->ps.saberMove = self->client->ps.saberBounceMove = LS_READY;//don't finish whatever saber anim you may have been in
    self->client->ps.saberBlocked = BLOCKED_NONE;
    self->client->ps.weaponTime = 1000;
    if ( self->client->ps.forcePowersActive&(1<<FP_SPEED) )
    {
        self->client->ps.weaponTime = floor( self->client->ps.weaponTime * g_timescale->value );
    }
}

because this power is.... overpowerful, i wanna that only few classes are charmable. that's point seems to work. :)

Posted

Ended the force freeze... it's not exactly freezing the target animation (animation is the unique thing i not know how to freeze) but npc not attack with weapons and with sabers they stay toe the idle stand without react to nothing.

if someone know how to freeze the animations let me know ^_^

here's the freeze code:

 

 

void ForceFreeze( gentity_t *self )
{
    trace_t    tr;
    vec3_t    end, forward;
    gentity_t    *traceEnt;
    qboolean    targetLive = qfalse;

    if ( WP_CheckBreakControl( self ) )
    {
        return;
    }
    if ( self->health <= 0 )
    {
        return;
    }
    //FIXME: if mind trick 3 and aiming at an enemy need more force power
    if ( !WP_ForcePowerUsable( self, FP_FREEZE, 0 ) )
    {
        return;
    }

    if ( self->client->ps.weaponTime >= 800 )
    {//just did one!
        return;
    }
    if ( self->client->ps.saberLockTime > level.time )
    {//FIXME: can this be a way to break out?
        return;
    }

    AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
    VectorNormalize( forward );
    VectorMA( self->client->renderInfo.torsoPoint, 2048, forward, end );
    
    //Cause a distraction if enemy is not fighting
    gi.trace( &tr, self->client->renderInfo.torsoPoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_BODY, (EG2_Collision)0, 0 );
    if ( tr.entityNum == ENTITYNUM_NONE || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
    {
        return;
    }
    
    traceEnt = &g_entities[tr.entityNum];
    
    if( traceEnt->NPC && traceEnt->NPC->scriptFlags & SCF_NO_FORCE )
    {
        return;
    }

    if ( traceEnt && traceEnt->client  )
    {
        switch ( traceEnt->client->NPC_class )
        { // NON SONO INCAPACITABILI
        case CLASS_GALAKMECH:
        case CLASS_ATST:
        case CLASS_SAND_CREATURE:
        case CLASS_TAVION:
        case CLASS_DESANN:
        case CLASS_IMPERIAL:
        case CLASS_IMPWORKER:
        case CLASS_LIZARD:
        case CLASS_MURJJ:
        case CLASS_FLIER2:
        case CLASS_GLIDER:
        case CLASS_FISH:
        case CLASS_CLAW:
        case CLASS_MORGANKATARN:
        case CLASS_MINEMONSTER:
        case CLASS_REELO:
        case CLASS_KYLE:
        case CLASS_LUKE:
        case CLASS_LANDO:
        case CLASS_GALAK:
        case CLASS_JAN:  
        //no droids either
        case CLASS_MOUSE:  
        case CLASS_SEEKER:
        case CLASS_SENTRY:
        case CLASS_REMOTE:
        case CLASS_ASSASSIN_DROID:
        case CLASS_WAMPA:
        case CLASS_BOBAFETT: // tutti gli elementali e i boss non posson esser stunnati!
            break;
        case CLASS_RANCOR:
            if ( !(traceEnt->spawnflags&1) )
            {
                targetLive = qtrue;
            }
            break;
        default:
            targetLive = qtrue;
            break;
        }
    }
    if  ( targetLive
        && traceEnt->NPC
        && traceEnt->health > 0 )
    {//hit an organic non-player
        if ( G_ActivateBehavior( traceEnt, BSET_MINDTRICK ) )
        {//activated a script on him
            //FIXME: do the visual sparkles effect on their heads, still?
            WP_ForcePowerStart( self, FP_FREEZE, 0 );
        }
        else if ( traceEnt->client->playerTeam != self->client->playerTeam )
        {//an enemy
            int override = 0;
            if ( (traceEnt->NPC->scriptFlags&SCF_NO_MIND_TRICK) )
            {
                if ( traceEnt->client->NPC_class == CLASS_GALAKMECH )
                {
                    G_AddVoiceEvent( traceEnt, Q_irand( EV_CONFUSE1, EV_CONFUSE3 ), Q_irand( 3000, 5000 ) );
                }
            }
            else if ( /*traceEnt->s.weapon != WP_SABER
                &&*/ traceEnt->client->NPC_class != CLASS_REBORN )
            {//haha!  Jedi aren't easily confused!
                if ( self->client->ps.forcePowerLevel[FP_FREEZE] > FORCE_LEVEL_1
                    && traceEnt->s.weapon != WP_NONE        //don't charm people who aren't capable of fighting... like ugnaughts and droids, just confuse them
                    /*&& traceEnt->client->NPC_class != CLASS_TUSKEN//don't charm them, just confuse them
                    && traceEnt->client->NPC_class != CLASS_NOGHRI//don't charm them, just confuse them*/
                    && !Pilot_AnyVehiclesRegistered()        //also, don't charm guys when bikes are near
                    )
                {//turn them to our side
                    //if mind trick 3 and aiming at an enemy need more force power
                    override = 50;
                    if ( self->client->ps.forcePower < 50 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_WAIT;
                        NPC_SetAnim( self, SETANIM_TORSO, BOTH_PULLED_INAIR_B, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
                    }
                    //FIXME: maybe pick an enemy right here?
                    //FIXME: does nothing to TEAM_FREE and TEAM_NEUTRALs!!!
                    /*team_t    saveTeam = traceEnt->client->enemyTeam;
                    traceEnt->client->enemyTeam = traceEnt->client->playerTeam;
                    traceEnt->client->playerTeam = saveTeam;*/
                    //FIXME: need a *charmed* timer on this...?  Or do TEAM_PLAYERS assume that "confusion" means they should switch to team_enemy when done?
                    traceEnt->NPC->confusionTime = level.time + FreezeTime[self->client->ps.forcePowerLevel[FP_FREEZE]];
                    if ( traceEnt->ghoul2.size() && traceEnt->chestBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/incapacitate" ), traceEnt->playerModel, traceEnt->chestBolt, traceEnt->s.number, traceEnt->currentOrigin, FreezeTime[self->client->ps.forcePowerLevel[FP_FREEZE]], qtrue );
                        G_SoundOnEnt( self, CHAN_ITEM, "sound/weapons/force/incapacitate.mp3" );
                
                    }
                    if ( WP_ForcePowerStop, FP_FREEZE )
                    {
                    traceEnt->NPC->tempBehavior = BS_DEFAULT;
                    NPC_PlayConfusionSound( traceEnt );
                    }
                }
                else
                {//just confuse them
                    //somehow confuse them?  Set don't fire to true for a while?  Drop their aggression?  Maybe just take their enemy away and don't let them pick one up for a while unless shot?
                    if ( self->client->ps.forcePower < 30 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_CINEMATIC;
                        NPC_SetAnim( self, SETANIM_TORSO, BOTH_PULLED_INAIR_B, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
                    }
                    traceEnt->NPC->confusionTime = level.time + FreezeTime[self->client->ps.forcePowerLevel[FP_FREEZE]];//confused for about 10 seconds
                    if ( traceEnt->ghoul2.size() && traceEnt->chestBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/slowtime" ), traceEnt->playerModel, traceEnt->chestBolt, traceEnt->s.number, traceEnt->currentOrigin, FreezeTime[self->client->ps.forcePowerLevel[FP_FREEZE]], qtrue );
                        G_SoundOnEnt( self, CHAN_ITEM, "sound/weapons/force/slowtime.mp3" );
                    }
                    if ( WP_ForcePowerStop, FP_FREEZE )
                    {
                    traceEnt->NPC->tempBehavior = BS_DEFAULT;
                    NPC_PlayConfusionSound( traceEnt );
                    }
                }
            }
            else
            {
                NPC_Jedi_PlayConfusionSound( traceEnt );
            }
            WP_ForcePowerStart( self, FP_FREEZE, override );
        }
        else if ( traceEnt->client->playerTeam == self->client->playerTeam )
        {//an ally
            //maybe just have him look at you?  Respond?  Take your enemy?
            if ( traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
            {
                NPC_UseResponse( traceEnt, self, qfalse );
                WP_ForcePowerStart( self, FP_FREEZE, 1 );
            }
        }//NOTE: no effect on TEAM_NEUTRAL?
        vec3_t    torsoDir;
        AngleVectors( traceEnt->client->renderInfo.eyeAngles, torsoDir, NULL, NULL );
        VectorNormalize( torsoDir );
        G_PlayEffect( "force/incapacitate_touch", traceEnt->client->renderInfo.torsoPoint, torsoDir );

        //make sure this plays and that you cannot press fire for about 1 second after this
        //FIXME: BOTH_FORCEMINDTRICK or BOTH_FORCEDISTRACT
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEGRIP3, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
        //FIXME: build-up or delay this until in proper part of anim
    }
    else
    {
        if ( self->client->ps.forcePowerLevel[FP_FREEZE] = FORCE_LEVEL_1 && tr.fraction * 2048 > 64 )
        {//don't create a diversion less than 64 from you of if at power level 1
            //use distraction anim instead
            G_PlayEffect( G_EffectIndex( "force/force_incapacitatetouch" ), tr.endpos, tr.plane.normal );
            //FIXME: these events don't seem to always be picked up...?
            AddSoundEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, qtrue, qtrue );
            AddSightEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, 50 );
            WP_ForcePowerStart( self, FP_FREEZE, 0 );
        }
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEGRIP3, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
    }
    self->client->ps.saberMove = self->client->ps.saberBounceMove = LS_READY;//don't finish whatever saber anim you may have been in
    self->client->ps.saberBlocked = BLOCKED_NONE;
    self->client->ps.weaponTime = 1000;
    if ( self->client->ps.forcePowersActive&(1<<FP_SPEED) )
    {
        self->client->ps.weaponTime = floor( self->client->ps.weaponTime * g_timescale->value );
    }
}

when i end with the control mind power i think i will write a tutorial using forcefreeze as example.

Posted

@@Noodle

@@ensiform

void ForceControlMind( gentity_t *self )
{
    trace_t    tr;
    vec3_t    end, forward;
    gentity_t    *traceEnt;
    qboolean    targetLive = qfalse;

    if ( WP_CheckBreakControl( self ) )
    {
        return;
    }
    if ( self->health <= 0 )
    {
        return;
    }
    //FIXME: if mind trick 3 and aiming at an enemy need more force power
    if ( !WP_ForcePowerUsable( self, FP_CONTROLMIND, 0 ) )
    {
        return;
    }

    if ( self->client->ps.weaponTime >= 800 )
    {//just did one!
        return;
    }
    if ( self->client->ps.saberLockTime > level.time )
    {//FIXME: can this be a way to break out?
        return;
    }

    AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
    VectorNormalize( forward );
    VectorMA( self->client->renderInfo.headPoint, 2048, forward, end );
    
    //Cause a distraction if enemy is not fighting
    gi.trace( &tr, self->client->renderInfo.torsoPoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_BODY, (EG2_Collision)0, 0 );
    if ( tr.entityNum == ENTITYNUM_NONE || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
    {
        return;
    }
    
    traceEnt = &g_entities[tr.entityNum];
    
    if( traceEnt->NPC && traceEnt->NPC->scriptFlags & SCF_NO_FORCE )
    {
        return;
    }

    if ( traceEnt && traceEnt->client  )
    {
        switch ( traceEnt->client->NPC_class )
        { // CLASS CANNOT BE DOMINATED
        case CLASS_GALAKMECH:
        case CLASS_ATST:
        case CLASS_SAND_CREATURE:
        case CLASS_TAVION:
        case CLASS_DESANN:
        case CLASS_JAN:
        case CLASS_GALAK:
        case CLASS_LIZARD:
        case CLASS_MURJJ:
        case CLASS_FLIER2:
        case CLASS_GLIDER:
        case CLASS_FISH:
        case CLASS_CLAW:
        case CLASS_REBORN:
        case CLASS_JEDI:
        case CLASS_ALORA:
        case CLASS_MORGANKATARN:
        case CLASS_WAMPA:
        case CLASS_MINEMONSTER:
        case CLASS_KYLE:
        case CLASS_LUKE:
        case CLASS_SHADOWTROOPER:
        case CLASS_LANDO:
        case CLASS_BARTENDER:
        case CLASS_UGNAUGHT:
        case CLASS_WEEQUAY:
        case CLASS_NOGHRI:
        case CLASS_TUSKEN:
        case CLASS_SWAMPTROOPER:
        case CLASS_GRAN:
        case CLASS_BESPIN_COP:
        case CLASS_SABOTEUR:
        case CLASS_HAZARD_TROOPER:  
        case CLASS_ROCKETTROOPER:
        case CLASS_REBEL:
        case CLASS_PROBE:
        //no droids either
        case CLASS_GONK:
        case CLASS_R2D2:  
        case CLASS_MARK1:
        case CLASS_MARK2:
        case CLASS_MOUSE:
        case CLASS_JAWA:
        case CLASS_HOWLER:
        case CLASS_SEEKER:
        case CLASS_SENTRY:
        case CLASS_REMOTE:
        case CLASS_PROTOCOL:
        case CLASS_ASSASSIN_DROID:
        case CLASS_SABER_DROID:
        case CLASS_BOBAFETT: // you wanna to control galesh and arcidemon? Just try!
            
 // tutti gli elementali e i boss non posson esser stunnati!
            break;
        case CLASS_RANCOR:
            if ( !(traceEnt->spawnflags&1) )
            {
                targetLive = qtrue;
            }
            break;
        default:
            targetLive = qtrue;
            break;
        }
    }
    if  ( targetLive
        && traceEnt->NPC
        && traceEnt->health > 0 )
    {//hit an organic non-player
        if ( G_ActivateBehavior( traceEnt, BSET_MINDTRICK ) )
        {//activated a script on him
            //FIXME: do the visual sparkles effect on their heads, still?
            WP_ForcePowerStart( self, FP_CONTROLMIND, 0 );
        }
        else if ( traceEnt->client->playerTeam != self->client->playerTeam )
        {//an enemy
            int override = 0;
            if ( (traceEnt->NPC->scriptFlags&SCF_NO_MIND_TRICK) )
            {
                if ( traceEnt->client->NPC_class == CLASS_GALAKMECH )
                {
                    G_AddVoiceEvent( traceEnt, Q_irand( EV_CONFUSE1, EV_CONFUSE3 ), Q_irand( 3000, 5000 ) );
                }
            }
            else if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] > FORCE_LEVEL_3 )
            {//control them, even jedi
                G_SetViewEntity( self, traceEnt );
                traceEnt->NPC->controlledTime = level.time + 30000;
            }
            else if ( /*traceEnt->s.weapon != WP_SABER
                &&*/ traceEnt->client->NPC_class != CLASS_REBORN )
            {//haha!  Jedi aren't easily confused!
                if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] < FORCE_LEVEL_3
                    && traceEnt->s.weapon != WP_NONE        //don't charm people who aren't capable of fighting... like ugnaughts and droids, just confuse them
                    /*&& traceEnt->client->NPC_class != CLASS_TUSKEN//don't charm them, just confuse them
                    && traceEnt->client->NPC_class != CLASS_NOGHRI//don't charm them, just confuse them*/
                    && !Pilot_AnyVehiclesRegistered()        //also, don't charm guys when bikes are near
                    )
                {//turn them to our side
                    //if mind trick 3 and aiming at an enemy need more force power
                    override = 50;
                    if ( self->client->ps.forcePower < 50 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_HUNT_AND_KILL;
                    }
                    //FIXME: maybe pick an enemy right here?
                    //FIXME: does nothing to TEAM_FREE and TEAM_NEUTRALs!!!
                    team_t    saveTeam = traceEnt->client->enemyTeam;
                    traceEnt->client->enemyTeam = traceEnt->client->playerTeam;
                    traceEnt->client->playerTeam = saveTeam;
                    G_SetViewEntity( self, traceEnt );
                    //FIXME: need a *charmed* timer on this...?  Or do TEAM_PLAYERS assume that "confusion" means they should switch to team_enemy when done?
                    traceEnt->NPC->confusionTime = level.time + ControlMindTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]];
                    if ( traceEnt->ghoul2.size() && traceEnt->headBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/wrack" ), traceEnt->playerModel, traceEnt->headBolt, traceEnt->s.number, traceEnt->currentOrigin, ControlMindTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]], qtrue );
                        G_SoundOnEnt( self, CHAN_ITEM, "sound/weapons/force/charm.mp3" );
                    }
                    /*if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] = FORCE_LEVEL_1 && traceEnt->NPC->controlledTime > 20000)
                        //traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
                    {
                        NPC_UseResponse( traceEnt, self, qfalse );
                        WP_ForcePowerStart( self, FP_CONTROLMIND, 1 );
                        G_SetViewEntity( self, player );
                    }*/
                    /*if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] = FORCE_LEVEL_2 && traceEnt->NPC->controlledTime > 40000)
                        //traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
                    {
                        NPC_UseResponse( traceEnt, self, qfalse );
                        WP_ForcePowerStart( self, FP_CONTROLMIND, 1 );
                        G_SetViewEntity( self, player );
                    }*/
                }
                else
                {//enemy will not attack at this control mind mastery
                    //somehow confuse them?  Set don't fire to true for a while?  Drop their aggression?  Maybe just take their enemy away and don't let them pick one up for a while unless shot?
                    if ( self->client->ps.forcePower < 90 )
                    {
                        return;
                    }
                    if ( traceEnt->enemy )
                    {
                        G_ClearEnemy( traceEnt );
                    }
                    if ( traceEnt->NPC )
                    {
                        traceEnt->NPC->tempBehavior = BS_HUNT_AND_KILL;
                    }
                    team_t    saveTeam = traceEnt->client->enemyTeam;
                    traceEnt->client->enemyTeam = traceEnt->client->playerTeam;
                    traceEnt->client->playerTeam = saveTeam;
                    G_SetViewEntity( self, traceEnt );
                    traceEnt->NPC->confusionTime = level.time + ControlMindTime[self->client->ps.forcePowerLevel[FP_CONTROLMIND]];//confused for about 10 seconds
                    if ( traceEnt->ghoul2.size() && traceEnt->headBolt != -1 )
                    {//FIXME: what if already playing effect?
                        G_PlayEffect( G_EffectIndex( "force/wrack" ), traceEnt->playerModel, traceEnt->chestBolt, traceEnt->s.number, traceEnt->currentOrigin, FreezeTime[self->client->ps.forcePowerLevel[FP_FREEZE]], qtrue );
                        G_SoundOnEnt( self, CHAN_ITEM, "sound/weapons/force/charm.mp3" );
                    }
                    /*if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] = FORCE_LEVEL_3 && traceEnt->NPC->controlledTime > 60000)
                        //traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
                    {
                        NPC_UseResponse( traceEnt, self, qfalse );
                        WP_ForcePowerStart( self, FP_CONTROLMIND, 1 );
                        G_SetViewEntity( self, player );
                    }*/
                }
            }
            else
            {
                NPC_Jedi_PlayConfusionSound( traceEnt );
            }
            WP_ForcePowerStart( self, FP_CONTROLMIND, override );
        }
        else if ( traceEnt->client->playerTeam == self->client->playerTeam )
        {//an ally
            //maybe just have him look at you?  Respond?  Take your enemy?
            if ( traceEnt->client->ps.pm_type < PM_DEAD && traceEnt->NPC!=NULL && !(traceEnt->NPC->scriptFlags&SCF_NO_RESPONSE) )
            {
                NPC_UseResponse( traceEnt, self, qfalse );
                WP_ForcePowerStart( self, FP_CONTROLMIND, 1 );
            }
        }//NOTE: no effect on TEAM_NEUTRAL?
        vec3_t    eyeDir;
        AngleVectors( traceEnt->client->renderInfo.eyeAngles, eyeDir, NULL, NULL );
        VectorNormalize( eyeDir );
        G_PlayEffect( "force/controlmind_touch", traceEnt->client->renderInfo.eyePoint, eyeDir );

        //make sure this plays and that you cannot press fire for about 1 second after this
        //FIXME: BOTH_FORCEMINDTRICK or BOTH_FORCEDISTRACT
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEPUSH, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
        //FIXME: build-up or delay this until in proper part of anim
    }
    else
    {
        if ( self->client->ps.forcePowerLevel[FP_CONTROLMIND] = FORCE_LEVEL_1 && tr.fraction * 2048 > 64 )
        {//don't create a diversion less than 64 from you of if at power level 1
            //use distraction anim instead
            G_PlayEffect( G_EffectIndex( "force/force_controlmind_fail" ), tr.endpos, tr.plane.normal );
            //FIXME: these events don't seem to always be picked up...?
            AddSoundEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, qtrue, qtrue );
            AddSightEvent( self, tr.endpos, 512, AEL_SUSPICIOUS, 50 );
            WP_ForcePowerStart( self, FP_CONTROLMIND, 0 );
        }
        NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEPUSH, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD );
    }
    self->client->ps.saberMove = self->client->ps.saberBounceMove = LS_READY;//don't finish whatever saber anim you may have been in
    self->client->ps.saberBlocked = BLOCKED_NONE;
    self->client->ps.weaponTime = 1000;
    if ( self->client->ps.forcePowersActive&(1<<FP_SPEED) )
    {
        self->client->ps.weaponTime = floor( self->client->ps.weaponTime * g_timescale->value );
    }
}
 

sorry for disturb, guys. i make my new force power for single player. it's a force controlmind. well, this power it's like mindtrick level 4: it control an NPC (only certain classes, not bosses) and the NPC can be moved by the player. also, after a loong evening of test and debugging, i get a goal: npcs controlled are targetted as playerteam.. and so, enemy can attack and kill controlled npc. also, controlled npc can attack and kill enemies. if a controlled npc die, player take again the control of the jedi.

what i need is a little suggest or help for end this power..

the "press jump to space" function is displayed on the screen, but "jump" button not work. (simply controlled character jump, but camera not turn on player jedi ) also, after is the power time is expired (possession during 20 sec for level 1, 40 sec for level 2 and 60 sec for level 3. ) , Npc never stop to be controlled by player. only if Nppc controlled die, the controls turn on the main character.

so, i am asking about two thing:

- what's wrong in this code about the timing expiring of the power? it nullify visual efx of possession into the front of NPC, but not turn camera to the jedi and not get again available the main character as player.

- how can i add a bind for a button key in the code of this power, so if i press a key, the power is stopped and disconnetted and player can take again the control of itself?

 

power is builded around the original mindtrick code.

thanks for any answer. ^_^

Posted

@@Ramikad yep, i found in wp_saber.cpp old voids related to force_throw power :)

there is in the code, but is passive, need just to be connected and make available.

 

Are you sure that's what it is? It seems more related to the thrust the enemies affected by Force Push / Pull receive.

 

if someone know how to freeze the animations let me know ^_^

 

I suggest you take a look at the code, BehavED has commands such as SET_ANIM_HOLDTIME_BOTH and SET_ICARUS_FREEZE (though this one may be unrelated).

 

About that "Press JUMP to exit", that worked in Jedi Outcast on the Doomgiver, when controlling the R4 Unit. And since the effect seems similar (if not the same) in all the cases of controlling through scripts, the /control command and Force Persuasion level 4, it may just be some sort of leftover.

Asgarath83 likes this
Posted

@@Ramikad thanks for hints. tomorrow i will give a look.

yes, also for the force throw i need to examinate better. :)

my main problem now is to find almost a way to esc for the force control mind. XD if not, the only method is to be slay by enemies or to suicide the NPC. XD really funny but can give some trouble in some map if there aren't enemies and trigger_hurt :D

Posted

I don't know much about coding, but the level 4 of mindtrick on the base game was designed for controlling droids. At least, that's how it worked in Jedi Outcast, where in some instances you controlled an R4 unit and a mouse droid. In those instances, when you jumped you stopped controlling the droid and could keep playing as kyle. Those instances didn't have a timer either, and I believe that if you use mind trick 4 on JA,  it will work in a similar fashion. 

 

So that makes me think that maybe the code is incomplete?

Posted

I don't know much about coding, but the level 4 of mindtrick on the base game was designed for controlling droids. At least, that's how it worked in Jedi Outcast, where in some instances you controlled an R4 unit and a mouse droid. In those instances, when you jumped you stopped controlling the droid and could keep playing as kyle. Those instances didn't have a timer either, and I believe that if you use mind trick 4 on JA,  it will work in a similar fashion. 

 

So that makes me think that maybe the code is incomplete?

 

mmmm, i am thinking that the "press jump to escape" function is strongly hardcoded only for level 4 of mindtrick and so not work in other force power or with other force power level. D: i need to investigate about this for discover where is the trick. thanks for hint.

okay if power is not expiring... but almost a escape function is necessary. for the rest the force control is perfect. :) it work also with saberist XD

controlling is enable by the function G_SetViewEntity

 

this function is programmed into g_active.cpp

 

 

extern void CG_SetClientViewAngles( vec3_t angles, qboolean overrideViewEnt );
qboolean G_ClearViewEntity( gentity_t *ent )
{
    if ( !ent->client->ps.viewEntity )
        return qfalse;

    if ( ent->client->ps.viewEntity > 0 && ent->client->ps.viewEntity < ENTITYNUM_NONE )
    {
        if ( &g_entities[ent->client->ps.viewEntity] )
        {
            g_entities[ent->client->ps.viewEntity].svFlags &= ~SVF_BROADCAST;
            if ( g_entities[ent->client->ps.viewEntity].NPC )
            {
                g_entities[ent->client->ps.viewEntity].NPC->controlledTime = 0;
                SetClientViewAngle( &g_entities[ent->client->ps.viewEntity], g_entities[ent->client->ps.viewEntity].currentAngles );
                G_SetAngles( &g_entities[ent->client->ps.viewEntity], g_entities[ent->client->ps.viewEntity].currentAngles );
                VectorCopy( g_entities[ent->client->ps.viewEntity].currentAngles, g_entities[ent->client->ps.viewEntity].NPC->lastPathAngles );
                g_entities[ent->client->ps.viewEntity].NPC->desiredYaw = g_entities[ent->client->ps.viewEntity].currentAngles[YAW];
            }
        }
        CG_SetClientViewAngles( ent->pos4, qtrue );
        SetClientViewAngle( ent, ent->pos4 );
    }
    ent->client->ps.viewEntity = 0;
    return qtrue;
}

void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
{
    if ( !self || !self->client || !viewEntity )
    {
        return;
    }

    if ( self->s.number == 0 && cg.zoomMode )
    {
        // yeah, it should really toggle them so it plays the end sound....
        cg.zoomMode = 0;
    }
    if ( viewEntity->s.number == self->client->ps.viewEntity )
    {
        return;
    }
    //clear old one first
    G_ClearViewEntity( self );
    //set new one
    self->client->ps.viewEntity = viewEntity->s.number;
    viewEntity->svFlags |= SVF_BROADCAST;
    //remember current angles
    VectorCopy( self->client->ps.viewangles, self->pos4 );
    if ( viewEntity->client )
    {
        //vec3_t    clear = {0,0,0};
        CG_SetClientViewAngles( viewEntity->client->ps.viewangles, qtrue );
        //SetClientViewAngle( self, viewEntity->client->ps.viewangles );
        //SetClientViewAngle( viewEntity, clear );
        /*
        VectorCopy( viewEntity->client->ps.viewangles, self->client->ps.viewangles );
        for ( int i = 0; i < 3; i++ )
        {
            self->client->ps.delta_angles[i] = viewEntity->client->ps.delta_angles[i];
        }
        */
    }
    if ( !self->s.number )
    {
        CG_CenterPrint( "@SP_INGAME_EXIT_VIEW", SCREEN_HEIGHT * 0.95 );
    }
}

qboolean G_ControlledByPlayer( gentity_t *self )
{
    if ( self && self->NPC && self->NPC->controlledTime > level.time )
    {//being controlled
        gentity_t *controller = &g_entities[0];
        if ( controller->client && controller->client->ps.viewEntity == self->s.number )
        {//we're the player's viewEntity
            return qtrue;
        }
    }
    return qfalse;
}
 
 

 

i need to study this >.<

Posted

@@Ramikad yes i know, also with jump button you can escape from control modality.

but on the void forcetelepathy there is only this related to control mind:

 

 

else if ( self->client->ps.forcePowerLevel[FP_TELEPATHY] > FORCE_LEVEL_3 )
            {//control them, even jedi
                G_SetViewEntity( self, traceEnt );
                traceEnt->NPC->controlledTime = level.time + 30000;
            }

 

G_SetViewEntity is the key, but if you put in another code part or in another force power, these never expired and jump escape not work. i really not know how to fix this. i am again a beginner as coder.

the function G_SetViewEntity is programmed on g_active.cpp

 

 

 
void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
{
    if ( !self || !self->client || !viewEntity )
    {
        return;
    }

    if ( self->s.number == 0 && cg.zoomMode )
    {
        // yeah, it should really toggle them so it plays the end sound....
        cg.zoomMode = 0;
    }
    if ( viewEntity->s.number == self->client->ps.viewEntity )
    {
        return;
    }
    //clear old one first
    G_ClearViewEntity( self );
    //set new one
    self->client->ps.viewEntity = viewEntity->s.number;
    viewEntity->svFlags |= SVF_BROADCAST;
    //remember current angles
    VectorCopy( self->client->ps.viewangles, self->pos4 );
    if ( viewEntity->client )
    {
        //vec3_t    clear = {0,0,0};
        CG_SetClientViewAngles( viewEntity->client->ps.viewangles, qtrue );
        //SetClientViewAngle( self, viewEntity->client->ps.viewangles );
        //SetClientViewAngle( viewEntity, clear );
        /*
        VectorCopy( viewEntity->client->ps.viewangles, self->client->ps.viewangles );
        for ( int i = 0; i < 3; i++ )
        {
            self->client->ps.delta_angles[i] = viewEntity->client->ps.delta_angles[i];
        }
        */
    }
    if ( !self->s.number )
    {
        CG_CenterPrint( "@SP_INGAME_EXIT_VIEW", SCREEN_HEIGHT * 0.95 );
    }
}

but they are view and camera setting, there is nothing about escape buttons or expiring. o.o i think expiring is setted by that:

 

 

traceEnt->NPC->controlledTime = level.time + 30000;

 

maybe i need to check the controlledTime function :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...