Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Ok, here is the scoop. In the game that I am working on, the hero has to complete training in three areas to move on to the more perilous adventures. In each area, he has to get 100 training points to complete the training, this is easily done with globals, but that is not the problem. In two of the areas (sword fighting and spellcasting) I created special NPC's whose deaths I linked to a change globals event, but how do I do this with blocking? I thought about linking the block key to a change globals event, but I want to award points when the hero actually blocks something, not just when he raises his shield.
Any suggestions would be greatly appreciated.
------------------ I think the surest sign of intelligent life in the universe is that none of it has tried to contact us.
You could try requiring the player to last a certain amount of time. I don't know what you're making the player block, but if it's like some sort of enemy that just keeps swinging, maybe you could but a spell on it that will kill the creature after a specified amount of time and award the player for surviving the creature's assault at the same time.
That's what I came up with off the top of my head . . .
------------------
I forgot to mention this in my opening post, or I didn't think that it was important to mention, but I was thinking about having the bad guy hurl spears at the player and he would get points if he stops a spear that would otherwise hurt him.
Quote
Originally posted by BryceCubed: **I forgot to mention this in my opening post, or I didn't think that it was important to mention, but I was thinking about having the bad guy hurl spears at the player and he would get points if he stops a spear that would otherwise hurt him.
**
Ok, this suggestion comes off the top of my head without any thought going into it(well, not much really, heh).
Anyhow, what you can do is set up a global, name it something like gb_hps. Set up a second global and name it something like gb_hasblocked. Make a keydown event with the same key as the blocking key(z) and have it set gb_hasblocked to 1. Next set up an event that ticks down at a rate a bit longer than what your npc's attack rate is(if you have the bad guy hurling spears every 2 seconds, have the event timer set to run at 4 second intervals or so).
So you have the following: gb_hps; gb_hasblocked; keydown z {sets gb_hasblocked to 1} evt_timer { timer set to a couple seconds longer than attack cycle of npc }
With the above, do the following:
Set evt_timer upon entering the area, clear gb_hasblocked, and set gb_hps to equal the player's current hitpoints. Whenever evt_timer reaches 0 have it call an event evt_hitcheck.
evt_hitcheck should look something like this: evt_hitcheck { conditional ((if gb_hps > current hitpoints) OR (gb_hasblocked == 0)) then clean gb_hasblocked and set gb_hps to equal the player's current hitpoints. If the conditional is false(ie, gb_hps is less than or equal to player's current hitpoints(ie, he hasn't taken damage or has been healed) AND the gb_hasblocked global is tripped to 1) then you would do the following: award your training points, then clear gb_hasblocked, set gb_hps to equal player's current hitpoints, and then trigger the timer.
Basically, since you can't trigger an event upon the NPC attacking(wouldn't that be nice?), you would need to synthesize it. What the above does is check the player's current hitpoints against what they were a few seconds previously. If they are the same or higher then he didn't take damage or has been healed(a way around healing would be either have this early enough in the game when the player doesn't have access to healing potions, or to make the condtional check to make sure gb_hps is equal to current hitpoints. Thus if the player got hit and healed it would not count.. but I like the greater than conditional, personally). I added the additional check to see if the player blocked(gb_hasblocked), so that if the player is just running around dodging they won't get points.
This system isn't perfect; they can tap the block key then run around dodging missiles, tap it again, keep dodging, and they will get credit for blocking. They could also block, get hit by a missile, chug a healing potion(if available) and if they are fast enough get credit for blocking.
But the above should be a quick and dirty way to get it done. Hopefully there is a better solution out there though.
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
I also had another idea that utilizes the idea you had Stark, but with a different twist. If I give the NPC that is throwing spears a spell called 'spear throw', I could link an event to the spell being cast that changes a new global(gb_has_thrown, or something like that). Then, make the event with a double conditional check to see if the shield is raised AND if the NPC has attacked. If gb_has_blocked and gb_has_thrown are both at 1 and the timer expires, then the points were awarded and everything started over again. I will take what you said into consideration, but I think that using a spell with a linked event might work better.
Thanks for the help, and if you have any more ideas, I will listen to them!
Originally posted by BryceCubed: ~snip~
Yeah, spell idea would work even better, except for only one problem that I can see... Can spells be blocked? If you just want to make sure that the player is trying to block then this would work fine. But if you want them to actually block the attack and not get credit even when they get hit through a block, then I don't think this would work. If spells can be blocked though then this is a much easier/better way to do things.
I GOT IT!!!!!!! I know what to do now, using the gb_has_thrown and gb_has_blocked variables, I can make it work. Coldstone spells also allow you to link an event to when the spell hits the target. Instead of using gb_has_thrown, I can use a new variable called gb_has_hit and have the event check this and the gb_has_blocked variables. If both are true then I can award points to the player because the shield was raised and the spear actually hit. In response to your question, stark, I can always set the damage to 0 in the spell whenever gb_has_blocked is equal to 1.
I never would have been able to figure this out without your help stark, thanks.
Originally posted by BryceCubed: I GOT IT!!!!!!! I never would have been able to figure this out without your help stark, thanks.
You're more than welcome. I'm glad my suggestions helped you come up with a solution.
Um, small problem, it seems that using the wait action will actually freeze the game for the time specified, meaning I have to figure out another way to do my event. Here is the current event linked to the z key:
Event: Raise shield Change Globals "Shields up": sets gb_has_blocked to 1 Wait: set to 4 secs Change Globals "Shields down": sets gb_has_blocked back to 0
This event also actually prevents blocking, as the player will snap to the block pose and then back again to let the event run its course.
To those working on the current coldstone update, could you give the player the option to decide whether the wait action will freeze the game, or if it will let the game run while it is waiting to execute the next action.
Originally posted by BryceCubed: Um, small problem, it seems that using the wait action will actually freeze the game for the time specified
Mr. BryceCubed,
Yeah, the Wait engine call is a wait_state where the whole game is paused. You want to create a timed event where as you have a global tick down 1 number per second, and when it hits 0 fire off the event.
I haven't made a timer as of yet so I can't explain how to do it. There have been some posts about how to do it though. I'd suggest using the search function and locating one of those threads. Hopefully you should be able to get it set up.
I tried to post it earlier, but things have come up. There would probably be another easier way to do this. I have not tested this myself.
First set the NPC to do 1 damage (plus whatever the heroes defense is, minus defense added by the shield), set the attack event to cast a spell which takes away 1 damage from the caster. Set the NPC's health to 6 in this example, and the hero's health to 4. Give the hero a shield that blocks at least 1 damage. Give the creature an absurd amount of defense, enough to block everything that the player will attack with.
The NPC will attack 6 times before he dies, but the hero will have to block at least three times in order to survive. If he uses his shield, then he will block 3 or more times and live.
Questions, comments, revisions anyone?
------------------ Nothing is foolproof to a sufficiently talented fool.
(This message has been edited by spitfire (edited 07-03-2002).)
Originally posted by spitfire: **First set the NPC to do 1 damage (plus whatever the heroes defense is, minus defense added by the shield), set the attack event to cast a spell which takes away 1 damage from the caster. Set the NPC's health to 6 in this example, and the hero's health to 4. Give the hero a shield that blocks at least 1 damage. Give the creature an absurd amount of defense, enough to block everything that the player will attack with.
It does not seem to work, whenever I get hit by the spear the HP decreasing spell is cast on me! It is definitly not what I wanted.
(This message has been edited by BryceCubed (edited 07-03-2002).)
Yes!! This time I tested this idea before I posted it, so believe me, it works! I did not realize that weapons had hit actions also. (silly me!) When I found this in the Coldstone manual it hit me like a pile of bricks, use a weapon, not a spell. The reason, weapons can actually be blocked while spells travel through the shield. (you were right about that one stark) Now for the NPCs health, I had to get a little creative: I started by creating a new global called Chucker_health; (the NPC was named 'spearchucker') then, in the same local event that set the players health, I set the variable to twice the amount that the players health was at; after that, I created a new ranged weapon called 'spear' and linked the following event to the 'hit' action:
Change Globals "subtract health": subtracts 1 from the global gb_chucker_health Conditional "check health": IF gb_chucker_health is less than or equal to 0 Then Call event 'advance to spells' which kills the spearchucker and sets up the field for the last part of training.
Basically, since I could not find a tag value or anything similar for the NPCs health, I had to fake it by using the global. The result, If the hero blocks enough times, he gets to advance and if he doesn't, he dies.
A big thanks to everyone who gave me suggestions on what to do about this problem, you helped me find the solution, and this problem gave me better knowlege of how to use Coldstone in clever and devious ways.
Have a happy 4th of July, and don't blow up your computers with fireworks!
(This message has been edited by BryceCubed (edited 07-04-2002).)
Originally posted by BryceCubed: **It does not seem to work, whenever I get hit by the spear the HP decreasing spell is cast on me! It is definitly not what I wanted.
Make sure the spell target is set to caster.
Originally posted by spitfire: **Make sure the spell target is set to caster.
It was set to target the caster, but for some reason, I got wounded by the spell. (I know this because the animation appeared over the player map icon instead of the NPC.)
Weird, oh well. I did say that it wasn't tested. Don't know what to tell you there.
Well, I guess the whole spell thing is for a different topic on the web board, but it is weird.