100GPing100
02-20-2011, 08:24 AM
This is for my Viper import from UT3, I made an interaction to change the vehicle's speed when the jump key is being pressed:
UT3ViperInteraction.uc
class UT3ViperInteraction extends Interaction;
var UT3Viper2v Viper;
simulated function bool KeyEvent(out Interaction.EInputKey Key, out Interaction.EInputAction Action, FLOAT Delta)
{
local string KeyName, KeyBind;
KeyName = ViewportOwner.Actor.ConsoleCommand("keyname "$int(Key));
KeyBind = ViewportOwner.Actor.ConsoleCommand("keybinding "$KeyName);
if (KeyBind ~= "Jump")
{
if (Action == IST_Press)
{
Viper.AirSpeed *= 0.001;
Viper.GroundSpeed *= 0.001;
}
else if (Action == IST_Release)
{
Viper.AirSpeed = Viper.default.AirSpeed;
Viper.GroundSpeed = Viper.default.GroundSpeed;
}
}
return false;
}
defaultproperties
{
bVisible=True
bRequiresTick=True
}
I want to add this interaction to the Viper's driver interactions, how can this be done?
In the Jetpack mutator, the interaction is added to the player with this code in the jetpack inventory:
if (AttachedPlayer.Player != None)
{
for (i = 0; i < AttachedPlayer.Player.LocalInteractions.Length; i++)
{
if (AttachedPlayer.Player.LocalInteractions[i].IsA('JetpackInteraction'))
{
if (!bD) JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(Self, bOn);
else JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(None, bOn);
b = true;
break;
}
}
if (!b && (AttachedPlayer.Player.InteractionMaster != none))
{
AttachedPlayer.Player.InteractionMaster.AddInterac tion("Jetpack.JetpackInteraction", AttachedPlayer.Player);
for (i = 0; i < AttachedPlayer.Player.LocalInteractions.Length; i++)
{
if (AttachedPlayer.Player.LocalInteractions[i].IsA('JetpackInteraction'))
{
if (!bD) JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(Self, bOn);
else JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(None, bOn);
break;
}
}
}
}
There they add the interaction to the attached player. for me the attached player would be what? I don't know what I should reference as the player driving the Viper.
Conclusion: I want to know how I add this interaction to what is driving the Viper.
UT3ViperInteraction.uc
class UT3ViperInteraction extends Interaction;
var UT3Viper2v Viper;
simulated function bool KeyEvent(out Interaction.EInputKey Key, out Interaction.EInputAction Action, FLOAT Delta)
{
local string KeyName, KeyBind;
KeyName = ViewportOwner.Actor.ConsoleCommand("keyname "$int(Key));
KeyBind = ViewportOwner.Actor.ConsoleCommand("keybinding "$KeyName);
if (KeyBind ~= "Jump")
{
if (Action == IST_Press)
{
Viper.AirSpeed *= 0.001;
Viper.GroundSpeed *= 0.001;
}
else if (Action == IST_Release)
{
Viper.AirSpeed = Viper.default.AirSpeed;
Viper.GroundSpeed = Viper.default.GroundSpeed;
}
}
return false;
}
defaultproperties
{
bVisible=True
bRequiresTick=True
}
I want to add this interaction to the Viper's driver interactions, how can this be done?
In the Jetpack mutator, the interaction is added to the player with this code in the jetpack inventory:
if (AttachedPlayer.Player != None)
{
for (i = 0; i < AttachedPlayer.Player.LocalInteractions.Length; i++)
{
if (AttachedPlayer.Player.LocalInteractions[i].IsA('JetpackInteraction'))
{
if (!bD) JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(Self, bOn);
else JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(None, bOn);
b = true;
break;
}
}
if (!b && (AttachedPlayer.Player.InteractionMaster != none))
{
AttachedPlayer.Player.InteractionMaster.AddInterac tion("Jetpack.JetpackInteraction", AttachedPlayer.Player);
for (i = 0; i < AttachedPlayer.Player.LocalInteractions.Length; i++)
{
if (AttachedPlayer.Player.LocalInteractions[i].IsA('JetpackInteraction'))
{
if (!bD) JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(Self, bOn);
else JetpackInteraction(AttachedPlayer.Player.LocalInte ractions[i]).TrapJetpackMovement(None, bOn);
break;
}
}
}
}
There they add the interaction to the attached player. for me the attached player would be what? I don't know what I should reference as the player driving the Viper.
Conclusion: I want to know how I add this interaction to what is driving the Viper.