Solved Control when an entity drops their weapon (?)

Question that is answered or resolved.

Crimsondeath

Active member
Hi again,
the weapons entities I use in my project have this property:
Code:
name Atlas6
type none
score 40000 5
shadow 5
weaploss 0 6 <---- weapon is lost and dropped on any hit.
weapnum 6
atchain 1
paingrab 1
knockdowncount 15

Which is working great, but there are types of attacks that use invisible hitboxes, or attacks that are ineffective against some entities, such as bullets that ricochet off Atlas's armor:
Mkz5YfX.gif


Atlas has the "nopain" property for the bullet attacktype, but his weapon still falls :( .

I could use the property: weaploss 1 (weapon is lost only on knockdown hit), plus a script that makes it drop its weapon on onpainscript, something like this I thought:

onpainscript:
C++:
void main(){
    // for atlas and robots semi inmune to bullets
    changeentityproperty(getlocalvar("self"), "weapon", 0);
}

The problem is that when the script is executed, the weapon doesn't fall just "disappear":
aU3H03R.gif


Is there any way to make him drop the weapon? Or a script equivalent of "weaponframe" property :(
 
Last edited:
Solution
Hi again,
the weapons entities I use in my project have this property:
Code:
name Atlas6
type none
score 40000 5
shadow 5
weaploss 0 6 <---- weapon is lost and dropped on any hit.
weapnum 6
atchain 1
paingrab 1
knockdowncount 15

Which is working great, but there are types of attacks that use invisible hitboxes, or attacks that are ineffective against some entities, such as bullets that ricochet off Atlas's armor:
Mkz5YfX.gif


Atlas has the "nopain" property for the bullet attacktype, but his weapon still falls :( .

I could use the property: weaploss 1 (weapon is lost only on knockdown hit), plus a script that makes it drop its weapon on onpainscript, something like this I thought:

onpainscript:
C++:
void...
Hi again,
the weapons entities I use in my project have this property:
Code:
name Atlas6
type none
score 40000 5
shadow 5
weaploss 0 6 <---- weapon is lost and dropped on any hit.
weapnum 6
atchain 1
paingrab 1
knockdowncount 15

Which is working great, but there are types of attacks that use invisible hitboxes, or attacks that are ineffective against some entities, such as bullets that ricochet off Atlas's armor:
Mkz5YfX.gif


Atlas has the "nopain" property for the bullet attacktype, but his weapon still falls :( .

I could use the property: weaploss 1 (weapon is lost only on knockdown hit), plus a script that makes it drop its weapon on onpainscript, something like this I thought:

onpainscript:
C++:
void main(){
    // for atlas and robots semi inmune to bullets
    changeentityproperty(getlocalvar("self"), "weapon", 0);
}

The problem is that when the script is executed, the weapon doesn't fall just "disappear":
aU3H03R.gif


Is there any way to make him drop the weapon? Or a script equivalent of "weaponframe" property :(
@Crimsondeath I didn't test yet but I had an idea. You can maybe try alternating the weaploss flags inside the ondoattackscript event based on the attack type, since it works before the collision is confirmed.

Something like this:
Code:
void main()
{
    //WORKS FOR DEFENDER ONLY
    if(getlocalvar("which")){
        void self        = getlocalvar("self");
        void atkType    = getlocalvar("attacktype");
        
        //DETECT ATTACK TYPES
        if(atkType == openborconstant("ATK_NORMAL7")) //SHOT TYPE
        {
            changeentityproperty(self, "weaploss", 1, 1); //knockdown hit
        }
        else //OTHER TYPES
        {
            changeentityproperty(self, "weaploss", 0, 1); //any hit
        }
    }
}
 
Solution
Something like this:
Code:
void main()
{
    //WORKS FOR DEFENDER ONLY
    if(getlocalvar("which")){
        void self        = getlocalvar("self");
        void atkType    = getlocalvar("attacktype");
     
        //DETECT ATTACK TYPES
        if(atkType == openborconstant("ATK_NORMAL7")) //SHOT TYPE
        {
            changeentityproperty(self, "weaploss", 1, 1); //knockdown hit
        }
        else //OTHER TYPES
        {
            changeentityproperty(self, "weaploss", 0, 1); //any hit
        }
    }
}
Thanks Kratus this works great, the problem is solved now :D .

... ondoattackscript ... since it works before the collision is confirmed.
I'm understanding now how "ondoattack" works (y).
 
Last edited:
Back
Top Bottom