ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
207 stars 24 forks source link

[bug?] globalvar doesnot working in the OngoingPlayer rule #447

Closed Erythritee closed 1 year ago

Erythritee commented 1 year ago
globalvar Vector[] InfectionOrign ;
rule: ''
Event.OngoingPlayer
Team.Team2
Player.Ana
if (IsButtonHeld(EventPlayer(),Button.Ability1))
{
    InfectionOrign.Append(PositionOf(EventPlayer()));
    Wait(0.275);
    CancelPrimaryAction(EventPlayer());

}

InfectionOrign.Append(PositionOf(EventPlayer()));doesnot work and i got this

rule("")
{

    event
    {
        Ongoing - Each Player;
        Team2;
        Ana;
    }

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

    // Action count: 2
    actions
    {
        Wait(0.275, Ignore Condition);
        Cancel Primary Action(Event Player);
    }
}
nathan130200 commented 1 year ago

Try use InfectionOrign = Append(InfectionOrign, PositionOf(EventPlayer())); instead.

Append will return an copy of array:

An small alternative is simple do array += value that will produce same workshop action to append element(s) to array using Modify Global Variable action.

Example:

InfectionOrign += PositionOf(EventPlayer());

Will result in:

Modify Global Variable(InfectionOrign, Append To Array, Position Of(Event Player));
CactusPuppy commented 1 year ago

ModAppend is the way to do the above without writing =, as follows:

InfectionOrigin.ModAppend(PositionOf(EventPlayer()));

The output of this line in Overwatch settings would be

Modify Global Variable(InfectionOrigin, Append To Array, Position Of(Event Player));