Allliance Changer..

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Allliance Changer..

Postby ~DJ~ » Fri Jul 01, 11 10:54 am

oh how I wish Scripting Society still existed..
anyhow, people are still here.. so yeah!

I need help at this code I'm working on.. I'm trying to make a single-player modification to change NPC alliances.

So far here's my code:
[spoiler]
Code: Select all
//=============================================================================
// WeaponAC. Alliance Changer for NPCs.
//=============================================================================

class WeaponAC extends WeaponPistol;

simulated function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
   //ChangeAlly(Name newAlly, optional float allyLevel, optional bool bPermanent, optional bool bHonorPermanence)

   local int i;

   for (i=0; i<8; i++)
   {
      if( (ScriptedPawn(Other).InitialAlliances[i].AllianceName == 'Player') && (ScriptedPawn(Other).InitialAlliances[i].AllianceLevel == -1) )
      {
         DeusExPlayer(Owner).ClientMessage(ScriptedPawn(Other).Tag$""@ScriptedPawn(Other).InitialAlliances[i].AllianceLevel);
         ScriptedPawn(Other).GotoState('Wandering');
         ScriptedPawn(Other).ChangeAlly('Player', 1.0, True, False);
         ScriptedPawn(Other).bAlliancesChanged=True;
      }
      else if( (ScriptedPawn(Other).InitialAlliances[i].AllianceName == 'Player') && (ScriptedPawn(Other).InitialAlliances[i].AllianceLevel == 1) )
      {
         DeusExPlayer(Owner).ClientMessage(ScriptedPawn(Other).Tag$""@ScriptedPawn(Other).InitialAlliances[i].AllianceLevel);
         ScriptedPawn(Other).GotoState('Wandering');
         ScriptedPawn(Other).ChangeAlly('Player', -1.0, True,  False);
         ScriptedPawn(Other).bAlliancesChanged=True;
      }
   }

   Super.ProcessTraceHit(Other,HitLocation,HitNormal,X,Y,Z);
}

defaultproperties
{
     GoverningSkill=Class'DeusEx.SkillWeaponPistol'
     EnviroEffective=ENVEFF_Air
     Concealability=CONC_Visual
     HitDamage=0
     AmmoName=Class'DeusEx.Ammo10mm'
     ReloadCount=6
     PickupAmmoCount=6
     bInstantHit=True
     bPenetrating=False
     bHasMuzzleFlash=True
     bHandToHand=False
     bFallbackWeapon=True
     bEmitWeaponDrawn=False
     shakemag=0.000000
     FireSound=Sound'DeusExSounds.Weapons.PistolFire'
     CockingSound=Sound'DeusExSounds.Weapons.PistolReload'
     SelectSound=Sound'DeusExSounds.Weapons.PistolSelect'
     InventoryGroup=1337115135532
     ItemName="Alliance Changer"
     Description="A handy weapon to change someone's alliance"
     beltDescription="ALNCECHNG"
}
[/spoiler]

I wanted to make it so it reverts the current alliance for the player too, meaning that one shot would've made it an ally, the other an enemy, and so forth.

Now I'm not that expert but it seems to be not working. It does convert the enemy to an ally, but doesn't revert him back on another shot. Not that I have any idea, but something occurs in my mind.. perhaps the statement I've written doesn't sound logical.. seeing as it checks for ANY 'InitialAlliance.AllianceName' as being player, then ANY other 'InitialAlliance.AllianceLevel', could it be that it can choose from any 8 default 'InitialAlliances' and mess the statement up so it's kinda bugy..

Hopefully someone gets my engrish.. if not atleast looking at the code might've made some sense..

Thanks in advance! :oops:
Last edited by ~DJ~ on Fri Jul 01, 11 10:54 am, edited 1 time in total.
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby Poor » Fri Jul 01, 11 6:49 pm

InitialAlliances is only used to initialize the default alliances and doesn't hold information about the current alliances. It doesn't update when alliances change.

Code: Select all
var            AllianceInfoEx      AlliancesEx[16];


From what I see this array holds the real time alliance info.

But this function in ScriptedPawn provides a better way to check if the pawn is an enemy or an ally.

Code: Select all
native(2105) final function bool IsValidEnemy(Pawn TestEnemy, optional bool bCheckAlliance);
Last edited by Poor on Fri Jul 01, 11 6:51 pm, edited 2 times in total.
Poor
Poster
 
Posts: 190
Joined: Tue Jan 04, 11 7:42 pm

Postby ~DJ~ » Fri Jul 01, 11 7:34 pm

Thank you!

However.. the part about 'AllianceInfoEx' and 'InitialAlliance'...that somewhat sounds a bit wrong to me, if it wasn't real time it shouldn't have worked.. that and the fact that the other one has 'Ex' in it's name.. doesn't that give away it's purpose.. however I'm not certain.. I'll try. :oops:

Thanks for that native function. I'll see if I can get it to any use too! :oops:

EDIT: Currently on my laptop, it seems as you might be right. Thanks, I'll try when I get on my PC!
Last edited by ~DJ~ on Fri Jul 01, 11 7:37 pm, edited 1 time in total.
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby Varsarus » Sat Jul 23, 11 4:51 pm

Hello

Seeing as your discussing Alliances, is there a way to change the InitialAlliances to more than 8? or is it scripted to stay like that?

Thanks
Varsarus
Newbie
 
Posts: 5
Joined: Sat Jul 23, 11 4:47 pm

Postby Poor » Sat Jul 23, 11 11:27 pm

I don't know why you would need more than 8 but you can make a larger array and override the function that Initializes alliances.
Poor
Poster
 
Posts: 190
Joined: Tue Jan 04, 11 7:42 pm

Postby Varsarus » Sat Jul 23, 11 11:51 pm

Poor wrote:I don't know why you would need more than 8 but you can make a larger array and override the function that Initializes alliances.


Hi

It's because I ran out of spaces on the initialalliances.

interesting what you said about the larger array though, is it possible that you can tell me what I need to do?
Varsarus
Newbie
 
Posts: 5
Joined: Sat Jul 23, 11 4:47 pm

Postby Poor » Sun Jul 24, 11 12:48 am

You would create a new class that extends ScriptedPawn or a specific pawn you want, and override the function InitializeAlliances() to something like this.

Code: Select all
class MaxChenB extends MaxChen;

var(Alliances) InitialAllianceInfo InitialAlliancesExtra[8];

function InitializeAlliances()
{
   local int i;

   for (i=0; i<8; i++)
      if (InitialAlliances[i].AllianceName != '')
         ChangeAlly(InitialAlliances[i].AllianceName,
                    InitialAlliances[i].AllianceLevel,
                    InitialAlliances[i].bPermanent);

   for (i=0; i<8; i++)
      if (InitialAlliancesExtra[i].AllianceName != '')
         ChangeAlly(InitialAlliancesExtra[i].AllianceName,
                    InitialAlliancesExtra[i].AllianceLevel,
                    InitialAlliancesExtra[i].bPermanent);

}


Here you would use Max Chen's InitialAlliances as normal and when they are filled, you would use InitialAlliancesExtra; having 16 in total. Don't go over 16 though because ScriptedPawns can only have 16 real time alliances and you would need to override more functions to handle more.
Poor
Poster
 
Posts: 190
Joined: Tue Jan 04, 11 7:42 pm

Postby Varsarus » Sun Jul 24, 11 1:14 am

Thanks very much :D
Varsarus
Newbie
 
Posts: 5
Joined: Sat Jul 23, 11 4:47 pm

Postby Varsarus » Sun Jul 24, 11 1:22 pm

Poor wrote:You would create a new class that extends ScriptedPawn or a specific pawn you want, and override the function InitializeAlliances() to something like this.

Code: Select all
class MaxChenB extends MaxChen;

var(Alliances) InitialAllianceInfo InitialAlliancesExtra[8];

function InitializeAlliances()
{
   local int i;

   for (i=0; i<8; i++)
      if (InitialAlliances[i].AllianceName != '')
         ChangeAlly(InitialAlliances[i].AllianceName,
                    InitialAlliances[i].AllianceLevel,
                    InitialAlliances[i].bPermanent);

   for (i=0; i<8; i++)
      if (InitialAlliancesExtra[i].AllianceName != '')
         ChangeAlly(InitialAlliancesExtra[i].AllianceName,
                    InitialAlliancesExtra[i].AllianceLevel,
                    InitialAlliancesExtra[i].bPermanent);

}


Here you would use Max Chen's InitialAlliances as normal and when they are filled, you would use InitialAlliancesExtra; having 16 in total. Don't go over 16 though because ScriptedPawns can only have 16 real time alliances and you would need to override more functions to handle more.


Hi Again

Just wondering if I ever come across the need of having more than 16 real time alliances what sort of functions would i need to override?

Thanks
Last edited by Varsarus on Sun Jul 24, 11 5:19 pm, edited 1 time in total.
Varsarus
Newbie
 
Posts: 5
Joined: Sat Jul 23, 11 4:47 pm

Postby ~ô¿ô~Nobody~ » Sun Jul 24, 11 8:20 pm

If you need more, you can just make a larger InitialAlliancesExtra array from what I see. :?
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Poor » Sun Jul 24, 11 10:07 pm

The array that holds current alliances is limited to 16.

Code: Select all
var            AllianceInfoEx      AlliancesEx[16];


If you wanted more than 16, you would need to create another array and update the code to use it in the functions that refer to AlliancesEx.

There are some native functions dealing with alliances so it may not properly work. Probably better to just stay below 16.
Last edited by Poor on Sun Jul 24, 11 10:10 pm, edited 2 times in total.
Poor
Poster
 
Posts: 190
Joined: Tue Jan 04, 11 7:42 pm

Postby Varsarus » Sun Jul 24, 11 10:31 pm

Poor wrote:The array that holds current alliances is limited to 16.

Code: Select all
var            AllianceInfoEx      AlliancesEx[16];


If you wanted more than 16, you would need to create another array and update the code to use it in the functions that refer to AlliancesEx.

There are some native functions dealing with alliances so it may not properly work. Probably better to just stay below 16.


Funnily enough I think I've seemed to have got it working without the need for that allianceinfoex...

Thanks again for your help :)
Last edited by Varsarus on Sun Jul 24, 11 10:31 pm, edited 1 time in total.
Varsarus
Newbie
 
Posts: 5
Joined: Sat Jul 23, 11 4:47 pm


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 16 guests
cron