Weapon Help

Hey guys this is my first time working with weapons and I realized for what I want to be able to do it would require multiple versions of weapons for the character and I want to cut that down if possible so here's my problem, I want the character to switch between projectiles for a freespecial attack but still have the same attacks and freespecials so I was wondering if there's a way to bypass creating different weapon models of the same character or at least a simpler way to do it I wanted to try what Oillusionista used in his avengers mod for hawkeye and brand but he said there's a bug with the script he used so any help would be great
 
they can work that way, so you only need to add the animations that are different, so the weapon freespecial would replace the original.

the setting is controlled by modelflag
Code:
modelflag {int}

    ~Determines how weapon model copies animation and weaponlist from original model.
        0 = Animation and weaponlist are copied
        1 = Animation aren't copied but weaponlist are still copied
        3 = Animation and weaponlost aren't copied
    ~Use this with weapon models of course.
 
Thegr8test said:
I want the character to switch between projectiles for a freespecial attack but still have the same attacks and freespecials

If you only want switching projectiles, then you don't need multiple weapon models. Those models are best used for different move set i.e punch mode and gun mode. If you've played Castlevania Collab demo, you can see that all players (except for Charlotte and Maria) can shoot various subweapon without changing weapon model

Anyways, it's best to use script for this and some variables
So let's get to details: how many different projectiles you have for switching?
 
Okay, you need 2 scripts i.e one for switching projectile and the other for shooting projectile based on selected projectile

Let me try making or editing a small mod to show that
 
I edited map mod adding elf with ability to change arrow by pressing attack2 or attack3, you can get it here:

https://www.mediafire.com/?x3cmhcrzwohfhq4

As a reminder, that mod was used to show how to unlock and lock character with script as I mentioned here:

http://www.chronocrash.com/forum/index.php?topic=1955.msg30171#msg30171

elf isn't locked though
Currently, elf only has 4 arrows to choose from but it can easily be expanded :)

You can learn the script method with this mod
 
Alright I added the keyscript to the character folder and I edited the bowshoot function for the ten projectiles I'll be using and the problems I'm having are 1) when I add the keyscript to the character it cause that character to lag a bit in game for some reason not sure whats causing that and 2) I see that attack2 switches between arrows but in my mod attack2 is used for different freespecials and in this case its the default button to shoot the weapon projectiles so I need to change that to a command like UP and Special/Block to switch projectiles.

Also I wanted to limit the amount of times the different projectiles can be shot is that doable with this script or would I still need to create a weapon for the specific projectiles for that?
 
I don't understand why it could cause lagness as it's not laggy at all here

As for #2, you can change the required key to switch arrow

Code:
void main()
{
    int iPlIndex = getlocalvar("player"); //Get Player's index
    void vSelf = getlocalvar("self"); //Get player
    void vAniID = getentityproperty(vSelf,"animationID"); //Get current animation ID
    void vAniPos = getentityproperty(vSelf, "animpos"); //Get current animation frame
    int Arrow = getentityvar(vSelf,1);
    int SFX = loadsample("data/sounds/ganti.wav");

    void iUp = playerkeys(iPlIndex, 1, "moveup"); // New key status of "Up"
    void iDown = playerkeys(iPlIndex, 1, "movedown"); // New key status of "Down"
    void iLeft = playerkeys(iPlIndex, 1, "moveleft"); // New key status of "Left"
    void iRight = playerkeys(iPlIndex, 1, "moveright"); // New key status of "Right"
    void iAttack2 = playerkeys(iPlIndex, 1, "attack2");// New key status of "Attack2"
    void iAttack3 = playerkeys(iPlIndex, 1, "attack3");// New key status of "Attack3"

// Arrow switch
    if (iAttack2){ // change arrow left
      if (vAniID != openborconstant("ANI_DIE") && vAniID != openborconstant("ANI_RESPAWN") && vAniID != 

openborconstant("ANI_SELECT")){ // Not in invalid animations?
        Arrow = Arrow - 1;

        if(Arrow <= 0){
          Arrow = 4;
        }

        setentityvar(vSelf, 1, Arrow);
        playsample(SFX, 0, 120, 120, 100, 0);
      }
    } else if (iAttack3){ // change arrow right
      if (vAniID != openborconstant("ANI_DIE") && vAniID != openborconstant("ANI_RESPAWN") && vAniID != 

openborconstant("ANI_SELECT")){ // Not in invalid animations?
        Arrow = Arrow + 1;

        if(Arrow >= 5){
          Arrow = 1;
        }

        setentityvar(vSelf, 1, Arrow);
        playsample(SFX, 0, 120, 120, 100, 0);
      }
    }
}

As you can see, attack2 is used to change arrow left while attack3 for changing arrow right. You can just change those

I wanted to limit the amount of times the different projectiles can be shot is that doable with this script or would I still need to create a weapon for the specific projectiles for that?

That's doable but the question is : what is limiting the projectiles? is it MP or something else?
 
That's doable by storing the amount of projectiles in certain variables. You will need update script to display this amount
BTW will this amount be carried to next levels or not?
 
Ah thanks, I asked cause you'd need global variables to store the amount. Entity variables can do that but their values will be resetted at end of level

I may need to edit that map demo to show you how but you can see example of this in D&D : Rise of Warduke. Crossbow weapon has 4 kinds of bolts and 3 of them have their own bolt amount stored in specific global variable
 
sorry for the late reply I'll try setting up a demo mod so you can see what I mean about the character lagging when the keyscript is added to the text file and hopefully figure out whats the cause and thanks I'll take a look into that mod when I get the chance
 
Okay, here's the updated demo:

https://www.mediafire.com/?7057hdw1rq7gq41

In this demo, elf's alternate arrows have limited amount of arrows and it's shown in the HUD below. To reset the arrows, complete the mountain level
Alternatively, wolven enemies drop arrows on their death which adds some of the 2nd type arrows
 
Hey guys I'm trying to limit a weapon to only 10 shots and I'm using type shot 1 and shootnum 10 but nothing changes am I missing something or doing something wrong?

Code:
weapons   Hawkeye HawkFrze
weaploss 2
shootnum 10
typeshot 1
 
For some reason, the counter only decrements if the projectile is fired with throwframe. Scripted version didn't work either
So to fool the engine to decrement the counter, declare throwframe which shoots a blank knife (invisible entity with no attackbox at all) in the shooting animation
 
Back
Top Bottom