Allliance Changer..
Posted: 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]
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!
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"
}
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!