|
|
Event driven reload never works :(
#87371
08/24/06 13:26
08/24/06 13:26
|
Joined: Jan 2006
Posts: 20
carcorde
OP
Newbie
|
OP
Newbie
Joined: Jan 2006
Posts: 20
|
I´m trying to make my game reload as soon as the player receives a predefined number of impacts, but no matter what I try, the script never seems to work, I must be making some kind of very basic mistake. I was capable of making the game reload after a countdown and after pressing a key, and also of making a scale that responds to the number of impacts, but cound not make the reload function work getting values from the var where the number of impacts is stored. I first declared a variable (I´m using the car template):
var cracking = 0;
After that, I included an function to increase its value at each impact:
function crash_event() { while(1) { if (EVENT_TYPE == Event_impact) // { // if (glass_health < 6)/// this was to limit the number of impacts///for testing purposes { ENT_playSOUND(MY,wham_wav,80); glass_health = glass_health + 0.04; glass_stats = glass_stats + 1; cracking = cracking + 0.04; } wait (1); } }
And, at the end, I use its value as follows:
function cracked() { while (1) { if (cracking == 6) { main_restart_game(); } { wait (1); } }
And, of course, it never works. I put a debugging digits window in my game interface to follow what is happening, and the var value increases at each impact, but the game never reloads. Won´t give me any error message either.
Could someone point to me what lowly and feeble minded mistake I´m doing?
thanks.
|
|
|
Re: Event driven reload never works :(
[Re: PHeMoX]
#87378
08/28/06 13:44
08/28/06 13:44
|
Joined: Jan 2006
Posts: 20
carcorde
OP
Newbie
|
OP
Newbie
Joined: Jan 2006
Posts: 20
|
PheMox: hahahaha, yes, you were right, of course. I did not call it. Stupid me  It is working now, as it should. Sometimes the obvious is absolutely invisible, isn´t? Till someone points it out, then it jumps at you... Thanks to all you guys for the help. I really appreciated it.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|