OpenBOR

OpenBOR 4.0 7556

No permission to download
There is a little issue/typo in ondoattackscript : as you can see below sometimes the local var referring to the "attack ID" is accessed through "attackid", and sometimes "attack_id".

In most tutorials I saw this var is accessed through "attackid", but currently you actually have to use "attack_id", otherwise you'll get a null value. It's only cleaned as "attackid".

Code:
void execute_ondoattack_script(entity *ent, entity *other, s_attack *attack, e_exchange which, int attack_id)
{
    ScriptVariant tempvar;
    Script *cs = ent->scripts->ondoattack_script;
    if(Script_IsInitialized(cs))
    {
        ScriptVariant_Init(&tempvar);
        ScriptVariant_ChangeType(&tempvar, VT_PTR);
        tempvar.ptrVal = (VOID *)ent;
        Script_Set_Local_Variant(cs, "self",        &tempvar);

        tempvar.ptrVal = (VOID *)other;
        Script_Set_Local_Variant(cs, "other",    &tempvar);

        ScriptVariant_ChangeType(&tempvar, VT_INTEGER);

        tempvar.lVal = (LONG)attack->attack_force;
        Script_Set_Local_Variant(cs, "damage",      &tempvar);

        tempvar.lVal = (LONG)attack->attack_drop;
        Script_Set_Local_Variant(cs, "drop",        &tempvar);

        tempvar.lVal = (LONG)attack->attack_type;
        Script_Set_Local_Variant(cs, "attacktype",  &tempvar);

        tempvar.lVal = (LONG)attack->no_block;
        Script_Set_Local_Variant(cs, "noblock",     &tempvar);

        tempvar.lVal = (LONG)attack->guardcost;
        Script_Set_Local_Variant(cs, "guardcost",   &tempvar);

        tempvar.lVal = (LONG)attack->jugglecost;
        Script_Set_Local_Variant(cs, "jugglecost",  &tempvar);

        tempvar.lVal = (LONG)attack->pause_add;
        Script_Set_Local_Variant(cs, "pauseadd",    &tempvar);

        tempvar.lVal = (LONG)attack->meta_tag;
        Script_Set_Local_Variant(cs, "tag",    &tempvar);

        tempvar.lVal = (LONG)which;
        Script_Set_Local_Variant(cs, "which",    &tempvar);

        tempvar.lVal = (LONG)attack_id;
        Script_Set_Local_Variant(cs, "attack_id",    &tempvar);

        Script_Execute(cs);
        //clear to save variant space
        ScriptVariant_Clear(&tempvar);
        Script_Set_Local_Variant(cs, "self",        &tempvar);
        Script_Set_Local_Variant(cs, "other",        &tempvar);
        Script_Set_Local_Variant(cs, "damage",      &tempvar);
        Script_Set_Local_Variant(cs, "drop",        &tempvar);
        Script_Set_Local_Variant(cs, "attacktype",  &tempvar);
        Script_Set_Local_Variant(cs, "noblock",     &tempvar);
        Script_Set_Local_Variant(cs, "guardcost",   &tempvar);
        Script_Set_Local_Variant(cs, "jugglecost",  &tempvar);
        Script_Set_Local_Variant(cs, "pauseadd",    &tempvar);
        Script_Set_Local_Variant(cs, "which",        &tempvar);
        Script_Set_Local_Variant(cs, "attackid",    &tempvar);
        Script_Set_Local_Variant(cs, "tag",            &tempvar);
    }
}

Thanks for the catch @Piccolo. It should be "attack_id" across the board.

DC
 
Another small issue, in openborscript.c :

Code:
 case _ep_hitbyid:
    {
        ScriptVariant_ChangeType(*pretvar, VT_INTEGER);
        (*pretvar)->lVal = (uintptr_t)ent->attack_id_incoming;
        break;
    }

This is relating to the getter of "hitbyid". It seems "ent->attack_id_incoming" was previously an integer, but now it's an array, so the code should be something like this I guess :

Code:
 case _ep_hitbyid:
    {
        ScriptVariant_ChangeType(*pretvar, VT_INTEGER);
        (*pretvar)->lVal = (uintptr_t)ent->attack_id_incoming[0];
        break;
    }

The setter of this property seems to already have been updated to take this change into account, but not the getter.
 
Back
Top Bottom