ID:165894
Oct 18 2006, 3:49 pm
|
|
I've looked a few tutorials and I'm not sure how to do it still. I want the player to have to face the NPC to attack it, and then if damage is done a sprite pops up to show the hit. I'm new to attack systems
|
In response to The Conjuror
|
|
how could I make it into a proc so the player can choose the verb or attack by hud-button?
Also the above starts the attack, even if your not next to and/or facing the monster |
In response to FriesOfDoom
|
|
um......
bump |
In response to FriesOfDoom
|
|
How do you mean it starts the attack? If you run the above code, it'll only say "attack!" when you're facing/directly infront of a mob. Tested it myself. Ofcourse, you're not pasting the code into yours and hoping for it to work, right? You're learning from it, and adapting it to fit your code, riiiight?
And to put it in a proc its as simple as changing it from a verb definition to a proc definition (remove the verb word, replace with proc), and then call the proc when the verb is selected. |
In response to The Conjuror
|
|
A hud button is easy. Here is an EXAMPLE code...Dont try usin it tho.
Outlinel Just an example.. |
In response to Revojake
|
|
And if you want to show how much damage is done...
world << "[damage] damage is done!" ...Make sure you have a [damage] proc or var...i forgot wich it would be. |
In response to The Conjuror
|
|
The Conjuror wrote:
How do you mean it starts the attack? If you run the above code, it'll only say "attack!" when you're facing/directly infront of a mob. Tested it myself. Ofcourse, you're not pasting the code into yours and hoping for it to work, right? You're learning from it, and adapting it to fit your code, riiiight? The only thing I used was the for() command you showed, and I just noticed my attack code underneath was not indented under the for() command, causing it to work at anytime. Also what I dont get is, you have to define the mob right? Will the for() define it? im sure it will. But during the proc will the mob count as src, or will the usr using the command count as the src? Now I'm thinking the usr will count as the src, but I wrote the above post while i was fighting sleep. Sorry if I ticked you off |
In response to FriesOfDoom
|
|
Usr is the person who clicked the HUD, M in this case, is target infront of you. here's a quick, correctly done example.
obj/hud/Attack Ignore the spacing, I kinda spaced it a bit far...oh well. |
In response to Revojake
|
|
Revojake wrote:
And if you want to show how much damage is done... world << "[damage] damage is done!" ...Make sure you have a [damage] proc or var...i forgot wich it would be. |
It uses a loop to attack any monsters 1 tile infront of the source, using the get_step command (look it up in the ref if you're not sure how it works).
[EDIT]
You wont need to use a loop if all of your mobs are dense though. The above would work even if its possible for more than 1 mob to occupy the same location, if you know for a fact that that isn't going to happen in your game, then you can remove the loop and just have it attack the mob in the returned location from get_step.
- Conj'