Change weapon script

Aerisetta

Active member
This seemed pretty simple but it's not working for some reason, am i doing something wrong?

I want the player to press a button and change weapon

should change to Girl_Kick, but nothing happens atm.


Code:
weapons            Girl Girl_Kick

anim    freespecial33 #################################################################
@script
  if(frame==6){
    void self = getlocalvar("self");
    changeentityproperty(self, "weapon", 1);
  }
@end_script
    delay    3
    offset    800 750
    frame    data/chars/Girl/spin101.png
    frame    data/chars/Girl/spin102.png
    frame    data/chars/Girl/spin103.png
    frame    data/chars/Girl/spin104.png
    frame    data/chars/Girl/spin105.png
    frame    data/chars/Girl/spin106.png
    frame    data/chars/Girl/spin107.png
    frame    data/chars/Girl/spin108.png
 
Weapons don't start at 0 they start at 1 so it should be

@script
if(frame==6){
void self = getlocalvar("self");
changeentityproperty(self, "weapon", 2);
}
@end_script

If you want Girl_Kick.

Girl = 1
Girl_Kick = 2
 
Weapons don't start at 0 they start at 1 so it should be

@script
if(frame==6){
void self = getlocalvar("self");
changeentityproperty(self, "weapon", 2);
}
@end_script

If you want Girl_Kick.

Girl = 1
Girl_Kick = 2
Sorry but I don't think that is the case.

Girl_Kick is indeed 1, setting it to 2 didn't work
Although When I try to switch to 0, it didn't work either.

@Kratus helped me solve it, he said you must change the weapon model too

First need to make this script
Code:
void changeModel(void model)
{//Change current model
        void self = getlocalvar("self");
    changeentityproperty(self, "model", model, 1);
}

Then this in the character
Code:
@script
  if(frame==6){
    void self = getlocalvar("self");
    changeentityproperty(self, "weapon", 1);
  }
@end_script
    delay    3
    offset    800 750
    frame    data/chars/Girl/spin101.png
    frame    data/chars/Girl/spin102.png
    frame    data/chars/Girl/spin103.png
    frame    data/chars/Girl/spin104.png
    frame    data/chars/Girl/spin105.png
    frame    data/chars/Girl/spin106.png
    frame    data/chars/Girl/spin107.png
    @cmd changeModel "Girl_Kick"
    frame    data/chars/Girl/spin108.png
 
Back
Top Bottom