Counstep or random encounters
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
DarkPrince

I'd like to know how to do a step counter for a random encounter or for a poison effect. In the manual, there's the trigger.onStep variable but how do I use this or is there a better way to do it ?

Thanks.

Posted on 2009-02-25 14:40:16

Overkill

The trigger.onStep is a pretty new thing, you might want this version of Verge for now (save this into a folder over your old verge.exe): http://www.bananattack.com/stuff/verge.exe

Anyhow, to use it, give it the name of a function, and it'll be called on every step.

The function would look something like this.
int steps;
void PlayerStep()
{
// Increases step counter by 1 on every step
steps++;
}


So in autoexec or one of your scripts, do something like this and it'll call that function whenever you take a step:
trigger.onStep = "PlayerStep";


If you wanted a poison function, assuming you declare some sort of player hp stats in your code, you can do something like this, maybe (adjust this as needed, it's just the general idea)
void PlayerStep()
{
// Increases step counter by 1 on every step
steps++;
// Lose hp every step if you have more than 1 health.
if(player.poison && player.hp > 1)
{
player.hp--;
PlaySound(poison_sound_effect, 100);
DoNiftyPoisonVisualEffectForAShortPeriodOfTime();
}
}


If you want a super fancy poison effect that doesn't interrupt movement, you'll probably also need to use HookRetrace so you can move while the damage effects are going on.

Does that at least get you started on the right path?

EDIT:

And stuff like random encounter stuff, would be something like a random number you generate, and it decreases. When it hits zero, it triggers battle, and rerandomizes the step countdown after battle.
int battle_countdown = Random(8, 16);
void PlayerStep()
{
battle_countdown--;
if(battle_countdown == 0)
{
battle_countdown = Random(8, 16);
RandomBattle();
}
}


Just the general idea, with a random 8-16 steps between each fight (that'd be too annoying for most games unless it's copying FF4 or something :D).

Posted on 2009-02-25 19:57:23 (last edited on 2009-02-25 20:06:44)

DarkPrince

Thank you very much Overkill, that is exactly what I needed.

I'm doing an old projet of mine that is 15 years old but I never finished it completely. I started out with QuickBasic at the time and I was almost finished but now that I discover Verge, I think I can do it again and this time finish it :)

It's a Dragon Quest clone but with a completly different story.

And up until now, all was going perfectly, so I needed the trigger.onStep to work :)

Thank you again.

Posted on 2009-02-26 07:17:42

DarkPrince

Hi Overkill, it's me again, I have another question. I set the playerstep variable to 16 so my player moves tile by tile. But when the trigger.onStep is activated, my player is in between 2 tiles. Is there a way to make him continue until he reach the next tile ?

Thanks again.

Posted on 2009-02-26 10:02:10

DarkPrince

I found something with the PlayerMove function. I do a PlayerMove pixel accurate of 9 pixel and it works fine.

But if you got something better, just tell me :)

Thanks.

Posted on 2009-02-26 10:08:59


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.