Basic Melee Weapon Issues

stevenshepherd

New member
Sorry, but what video explains setting up a melee weapon? The adventure tutorial doesn't really explain everything, and the getting started one's don't seem to (input management video just covers walking). When I try to add it based on what I remember from beta, it crashes because of this:

Routines\Basic\ModuleScripts\InputScripts\Adventure\b_create_melee.asm(26): Label already defined.
Routines\Basic\ModuleScripts\InputScripts\Adventure\b_create_melee.asm(40): Label already defined.
Routines\Basic\ModuleScripts\InputScripts\Adventure\b_create_melee.asm(45): Label already defined.
demo.txt written.
 

dale_coop

Moderator
Staff member
The message seems to indicate you already assign another melee script? (check your "Scripts > Input Scripts", and remove if another one there)
 

stevenshepherd

New member
I wondered if that was it. I loaded the text box script but i wanted it to be assigned to the A button. I knew "b button" was in the name of the script but figured i would try it,and it worked assigning it to A.

So I went and deleted the text box script from input and also scripts and put back in the script for B melee. Game loads now, although the melee doesn't work (which makes sense given that I am probably missing something or several things; not sure where it is found in the tutorials)

Then there is the question of how do I change the code so that I can make A for text boxes, not B.

Also, in looking at my "b melee" script, a lot of it appears to be about text boxes and a lot appears the same as the text box script?

I'm really confused because in the adventure tutorial there doesn't seem to be a text box script loaded, just melee and projectile. But in the #9 getting started video, he does load the b text box script.
 

dale_coop

Moderator
Staff member
The NPC textbox in basic modules of 4.1 are create with the b_melee script.
But yes, you could separate them and have 3 scripts: one for textbox, one for melee, one for projectile.

If you want, I can make you those scripts...
 

stevenshepherd

New member
Ok I was wondering that, except that the text boxes don't seem to work with the b melee script loaded. Only works with the text script loaded. I'll double check though and try to figure it out, thanks!

Thanks very much for the offer! I don't think I am there yet (I am not sure how I want to handle weapons yet) so I would hate for you to do the work for nothing.
 

stevenshepherd

New member
I got the melee working in a basic form, but the problem I am having is that changing the "melee" under game object doesn't seem to do anything (also it appears that "melee" under game object in the menu isn't actually the melee? in the adventure tutorial he loads the projectile under melee, as opposed to projectile, which I find very confusing). My melee weapon on screen appears to be the 10th tile on the top row of my player tileset (which corresponds to the same place as his sword in the adventure tutorial). I don't know how to change this. intuitively I would click on melee under game objects, and instead of it being the first tile in my player tileset, I would change it to whatever I want. In the adventure tutorial, I never see the sword sprite loaded anywhere under the game objects.

I also wanted my melee to have an animation but I am unsure how this would work if it is just loading a single 8x8 sprite from the 10th row of my player's tileset.

I am not sure what I am missing. It seems like some important information is not in the videos but again I could be completely missing something.
 

dale_coop

Moderator
Staff member
Yep, the basic modules use a sprite based sword. That means, basically, when you press the "A" button, the player changes his state, he become to Attacking (action step and a flag). The pre-draw routines (that literally draw on the screen) check if the player is in attacking state, then it draws the weapon tile next to the player.
You can change the index of the tile used in your "Project Settings > User Constants":

2019-01-12-17-56-04-Project-Settings.png


It would be doable to change for object based weapon (like in the 4.0) but would required to deactivate some (or maybe a lot of ?) code in the Pre Draw and maybe Extra Controll Read control scripts.
 

stevenshepherd

New member
I figured out how to do a makeshift animated object melee weapon by just using the projectile and setting its movement speed to very low and to destroy itself when the animation is over :) In the end I don't think I'll need it but it is fun to play around with what is available without getting into code (not that I am averse to getting into code, just not quite there yet).
 

nroflmao

New member
So I'm going to attempt to follow the conversion to melee object per Dale's instruction here, but before I do just wanted to try using this method and i am able to get an 8x8 sprite by changing the values of the user constants as described, but i wonder how would you change the palette that is used, looks like it uses Sub2 by default, i want it to use Sub1.
 

nroflmao

New member
So I did give this a shot and it worked as advertised! I couldn't figure out how to do the vertical code so i just made a 16x16 sprite that can contain 8x16 and 16x8 (horizontal and vertical).

The only problem I have is if i slash the sword while walking the sword object doesn't move with the player object and thus it looks like the player is walking into the sword. The only way to avoid this is to make the sword animation extremely fast (1-2 frames, fast animation) just to minimize the effect.

I went back and checked 4.0.11 where i did the exact same thing and didn't have the issue. I notice in that version that my player stops movement while my sword animation plays and then continues once the animation is finished. Any ideas how i might implement the same behavior from 4.0.11?
 

nroflmao

New member
OK so I found my issue...it seems somewhere along the line i have my input scripts set up to use the Base Input scripts rather than the adventure ones. Once I switch to the ones specifically for Adventure module, the player stops moving when attacking. Thanks again for the help Dale!
 

dale_coop

Moderator
Staff member
We are still learning guys, still searching how to customize, fix some stufs.
Even myself I changed my Weapon game object tutorial ru use the end of action instead of end of animations, and I modified the StartMovingPlayerXxx.asm movement scripts.

To be more like it was in the 4.0

There can be still some issues, we are all trying to find solutions and tweak them.
 

Joshua Mason

New member
Quick melee question. I have my melee object appearing when I press the B button. Im in adventure module and set the constants to the correct sprite. they're one frame animations - basically a poke. Ive tried playing around with the settings, destroy after animation, etc, but the weapon doesnt disappear after it appears. It just sits there, and the main character cant move anywhere, but can face any direction with the appropriate facing melee. How can i get the weapon to disappear and get the character moving again? What should my action, end action and end animation be?
 

dale_coop

Moderator
Staff member
Check your Player 's action step 3 : the "End of animation" needs to be set to "goToFirst" and don't forget to set an animation speed (or you could use "End of action" to "GotoFirst" and use a Timer value instead) .
 
Top Bottom