How do i reference individual dummy bots?

I was making a gamemode where genji has hammond’s grappling hook. I attached an invisible hammond bot that is spawned in for each player to genji. Upon firing the hook, genji becomes attached to the hammond and upon retracting the hook the roles revert. Im using “last created entity” to reference each individual player’s “pet” wrecking ball dummy bot.
I then decided that i also wanted the player to be able to use widow’s grappling hook as well. However, if the player has two pet dummy bots created by them, how do i reference the bots individually? “Last created entity” no longer works in this scenario. Keep in mind this is a free-for-all gamemode where each player gets their own pet widow and hammond, so i cannot reference them using “hero = wreckingball/widowmaker” as this would affect all players’ bots at once.

As for a completely seperate issue, i want the player to be able to boost in whatever direction theyre looking in using the “start accelerating” action. Stragely, this hardly moves the player forward. It mostly only really affect’s their movement on the Y axis, and by an extreme amount. Should i maybe have the player move towards a vector that’s a meter in front of their face instead or something?

Each Genji will need their Hammond/Widow saved in a player variable to be referenced.

For the second issue, are you moving them in their Facing Direction, or a different vector?

1 Like

I did figure the answer had something to do with using player variables, but I still dont exactly see what im supposed to do. From what I know, there isnt a way to reference players by their variables. You may have to give me an example some sort.

As for the boost, im using Start Accelerating in the Facing Direction of the Event Player

rule(“Spawn/Assign Bots”)
{
event
{
Ongoing - Each Player;
All;
All;
}

conditions
{
Has Spawned(Event Player) == True;
Is Dummy Bot(Event Player) == False;
Event Player.X == False;
}

actions
{
Create Dummy Bot(Hero(Wrecking Ball), All Teams, -1, Event Player, Vector(0, 0, 0));
Event Player.X[0] = Last Created Entity;
Wait(0.016, Ignore Condition);
Create Dummy Bot(Hero(Widowmaker), All Teams, -1, Event Player, Vector(0, 0, 0));
Event Player.X[1] = Last Created Entity;
Wait(0.016, Ignore Condition);
Attach Players(Event Player.X[0], Event Player, Vector(0, 0.750, 0));
Attach Players(Event Player.X[1], Event Player, Vector(0, 0, 0));
Set Invisible(Event Player.X, All);
Start Facing(Event Player.X, Facing Direction Of(Event Player), 9999, To World, Direction and Turn Rate);
Set Status(Event Player.X, Null, Phased Out, 9999);
}
}

rule(“UseHook”)
{
event
{
Ongoing - Each Player;
All;
All;
}

conditions
{
Is Button Held(Event Player, Button(Interact)) == True;
}

actions
{
Set Ability Cooldown(Event Player.X[0], Button(Secondary Fire), 0);
Start Holding Button(Event Player.X[0], Button(Secondary Fire));
Wait(0.033, Ignore Condition);
Detach Players(Event Player.X[0]);
Detach Players(Event Player.X[1]);
Wait(0.033, Ignore Condition);
Attach Players(Event Player, Event Player.X[0], Vector(0, 0, 0));
Attach Players(Event Player.X[1], Event Player.X[0], Vector(0, 0, 0));
Wait Until(!Is Button Held(Event Player, Button(Interact)), 10);
Wait(0.033, Ignore Condition);
Stop Holding Button(Event Player.X[0], Button(Secondary Fire));
Detach Players(Event Player);
Attach Players(Event Player.X[0], Event Player, Vector(0, 0.750, 0));
Attach Players(Event Player.X[1], Event Player, Vector(0, 0, 0));
}
}

rule(“UseGrapple”)
{
event
{
Ongoing - Each Player;
All;
All;
}

conditions
{
(Is Button Held(Event Player, Button(Jump)) && Is Button Held(Event Player, Button(Melee))) == True;
}

actions
{
Set Ability Cooldown(Event Player.X[1], Button(Ability 1), 0);
Press Button(Event Player.X[1], Button(Ability 1));
Wait(0.033, Ignore Condition);
Detach Players(Event Player.X[0]);
Detach Players(Event Player.X[1]);
Wait(0.066, Ignore Condition);
Attach Players(Event Player, Event Player.X[1], Vector(0, 0, 0));
Attach Players(Event Player.X[0], Event Player.X[1], Vector(0, 0, 0));
Wait Until(!Is Button Held(Event Player, Button(Jump)), 10);
Press Button(Event Player.X[1], Button(Jump));
Wait(0.033, Ignore Condition);
Detach Players(Event Player);
Attach Players(Event Player.X[0], Event Player, Vector(0, 0.750, 0));
Attach Players(Event Player.X[1], Event Player, Vector(0, 0, 0));
}
}

The first rule will spawn and attach a Hammond + Widowmaker bot to the player, and store them in the players X variable. The other two are for controlling the links and abilities to allow the player to grapple/hook.

The Hammond hook just uses the interact button. For Widows hook, it’s set up for jump+melee, and drops the hook when letting go of jump. The only thing I forgot is for Hammond’s high speed bump so it doesn’t affect the user.

thank you! late reply because i had to spend some time understanding how your version works and how to implement it. its working quite well and i’ve learned quite a bit.

Still struggling to think of what to do with the boost, however. I assumed the issue was that “start accelerating player” was looking for a positional vector instead of a directional vector, but upon testing I see that isn’t the case.

1 Like