A stationary object as an NPC that must be destroyed

One of the tasks I want 'my hero' to have to do is destroy some objects...big magical gizmos..by attacking them.

So I created a test one as an npc and placed it on a map. Set its NPC stats to zero for just about everything (except stamina and gold).

In the game the object has moved on the map....and annoyingly if the player trys to attack it he hits nothing but air, coz its picture and actual position on the map are not the same!

If the player wanders around in the general area of the object swinging away...eventually the object is destroyed - an event is called that tells me so.

Sooo...two questions:
1.Is there any other way of doing this? I'm assuming this is a CS bug, as the developers assumed all NPCs would be charactors that move.

2. I want to change the picture representing the object based on its health. How do I go about this as there does not appear to be an 'on attack' or 'on injury' event? I'm guessing I need to have a conditional run each time the hero hits the object - how can I do this?

Thanks
-Neeko

------------------

in the NPC creation screen under the tab 'map' , change the range of motion to 0, and make all of the directional frames the same 'face forward'. also u might want to change the line of sight quality to 0. and expand the collision area. that way i doesn't move from its spot, can't see beyond its location and is easier to strike.

------------------
Download my current game 'Tandum- (*)' on my site at (url="http://"http://www.geocities.com/ellrx/index.html")Tandum is being rebuilt with CGE,Wait it will come(/url)
My%20%5burl=http://"http://www.geocities.com/ellrx/spritetest.jpg" target="_blank">My

Hey,
I am currently creating a gold mine plugin where the ore to be mined are npcs, so I have been playing around with this as well. ill_a_nois is basically correct with what he (she?) is saying about reducing the movement to 0. however the npc can still move. still working on this.

Also, speed 0 is the same as speed 1 as best as I can tell for BOTH npcs and the player. this does need to be changed because speed 0 should be at a stop.

as to the picture change, you might have multiple npcs that replace the previous one when it dies.

Gallandro

------------------
"(Even though you just obliterated a fleet of Galaxy Destroyers) Prepare to die!" says the confederate gunboat pilot.

Chalk up another reported but unfixed bug from the pre-release period. (1.0b4 in this case.) Teach me to report bugs and assume that they've been fixed just because the developer says so.... šŸ˜•

Once again, pointed out this thread to the beta list.

It's definitely a bug (speed zero should equal no movement), but there is a workaround, as ill_a_nois pointed out. Set the NPC's movement style to "Walk around original position" with a radius of zero, and it will stay put. šŸ™‚

Regarding the positioning problems: Are you sure the image(s) is/are positioned correctly in the animation file for the NPC? If you're not using an animation (just a picture) try creating an animation that just contains that picture (make sure it's a multiple of 4 or 8 frames) and see if that works.

------------------
I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams
Only member of the webboard to gain 2 karma points by writing a flame, and openly atychiphobic since 2000.

Thanks for the comments...

I've used a pic for the npc rather than an animation, since it is a stationary object.

The issue I'm having is that the npc is not where I placed it on the map! It has moved, or rather its image has moved, so that in order to attack it the user must attack the 'empty space' where it ought to be - ie where I placed it when creating the map.

Perhaps this is an issue with the map itself? I'll create a new simple map and try again.

Has anyone any ideas on how to create a conditional loop that tests the health of an object being attacked, so that when its health is at differing levels its image can be changed?

How can I test whether or not a single swing/attack was successful?

Thanks
-Neeko

------------------

Do like Glenn said, and make an animation. That is almost certainly your problem; pictures don't have collision circles and they aren't centered correctly, which would explain why you can never hit them.

------------------
The greatest of harm can result from the best of intentions Ā— Wizard's Second Rule, Stone of Tears.
Ā— Cafall

ya i had that problem, too. I wanted my hero to kill plants that had gold in them (just like in Zelda), but the bigger the picture is for the stationary NPC, the farther (i guess ill say southeast) the picture for the NPC is placed, but coldstone thinks that the object is still in the same place. I guess ill try what you all have been saying about making an animation of the stationary object (too bad i dont know how) o well, ill find out.

------------------
I'm not laughing at you,
I'm laughing with you in
min

Quote

Originally posted by Neeko:
Has anyone any ideas on how to create a conditional loop that tests the health of an object being attacked, so that when its health is at differing levels its image can be changed?

Have you tried Gallandro's suggestion? Create a set of NPCs, each with a different animation representing a different "health level" and each with a fraction of the total HP you want. Add a link to each one's death event which creates the next NPC in the group at the same location. (Maybe using "Actual Coordinates"?) I haven't tried it myself, but it seems like a good place to start.

------------------
I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams
Only member of the webboard to gain 2 karma points by writing a flame, and openly atychiphobic since 2000.

No I haven't tried that suggestion as I wasn't sure how it related to my question...now I understand the idea, thanks, I think that will work.

As for the map problem, I'll try the animation tip. I guess while I'm at it I may as well make the animation do something - small lights/fire/bits change color as the hero approaches or something.

Thanks for all the help

Neeko

------------------

Quote

Originally posted by Glenn:
Have you tried Gallandro's suggestion? Create a set of NPCs, each with a different animation representing a different "health level" and each with a fraction of the total HP you want. Add a link to each one's death event which creates the next NPC in the group at the same location. (Maybe using "Actual Coordinates"?) I haven't tried it myself, but it seems like a good place to start.

The only problem with this suggestion is if you have an ultra-uber-weapon that dishes out a lot of damage. For example, if your machine has 5 damage levels(and hence 5 animations that are swapped out depending on the damaged level) with each animation having 20 hitpoints. If your ultra-uber-weapon dishes out 100 damage, then you should be able to destroy the machine utterly in 1 hit.

However, with using the death animation to switch to the next animation you will hit the animation once and dish out 100 damage, and the animation will "die" and switch to the next animation which will have full health.

Anyways, my personally feeling is that this is a minor issue and Glenn's suggestion should work just fine. However be aware of the limitation.

Good luck.

------------------
"Usenet is like a herd of performing elephants with diarrhea --
massive, difficult to redirect, awe-inspiring, entertaining, and a
source of mind-boggling amounts of excrement when you least expect
it." -- Gene Spafford, 1992

Stark,

I did this in my game where depending on how many hitpoints a character has left it becomes different things. It can be done it just means you need to think out your conditionals very well - Such as if hp are less then 20 but greater then 10 then chang to character "a" but if they are equal to zero then remove character other wise show character "b"

------------------
Squak - the seal
makes the noise not
the approval

Quote

Originally posted by Squak:
**Stark,

I did this in my game where depending on how many hitpoints a character has left it becomes different things. It can be done it just means you need to think out your conditionals very well - Such as if hp are less then 20 but greater then 10 then chang to character "a" but if they are equal to zero then remove character other wise show character "b"**

Ok, so let me know if I get this wrong. What you are saying is the following:

Let's assume that your NPC has a total of 100 hit points. When it takes 100 damage it is dead.

You also have 5 graphics for the NPC:

  • Graphic 1 when the NPC is at 80-100 hit points.
  • Graphic 2 when the NPC is at 60-79 hit points.
  • Graphic 3 when the NPC is at 40-59 hit points.
  • Graphic 4 when the NPC is at 20-39 hit points.
  • Graphic 5 when the NPC is at 1-19 hit points.

But how do you change the graphics? There isn't a "if_hit" or "is_attacked" event to call for you to make an event to check the hit points of the NPC and change him to the appropriate graphic.

If you use the death event then they are dead when their hitpoints reach 0 and there would be no conditionals to check(ie, if the NPC has 20 hit points and was hit with 100 damage, I believe their hit points are set to 0, not -80. If this is incorrect then the above would work well with a death event and a conditional checking negative numbers).

So I guess I'm confused how you set this up.

------------------
"Usenet is like a herd of performing elephants with diarrhea --
massive, difficult to redirect, awe-inspiring, entertaining, and a
source of mind-boggling amounts of excrement when you least expect
it." -- Gene Spafford, 1992

I have an idea...
it'll involve percentage's rather than raw numbers

try if stamina is < .5*stamina then (trigger event to switch image) 'staminaLow_img'

you'll have to do some more tinkering in the conditional window , like having it match several conditions, because i'm almost sure u can accompluish that all in one statement however i believe that is the way...

------------------
Download my current game 'Tandum- (*)' on my site at (url="http://"http://www.geocities.com/ellrx/index.html")Tandum is being rebuilt with CGE,Wait it will come(/url)
My%20%5burl=http://"http://www.geocities.com/ellrx/spritetest.jpg" target="_blank">My