flag problem
oblomov
20 Nov 2009, 13:14hi, i just happened to have another problem..
in my game the player has to collect 5 items and bring them to the master, thats when he wins the game.
so for every item he brings to the master, i set up a flag "item one brought to master", "item two brought to master",...
and then i set up a function, saying: if all the five flags are set up, then run win procedure. but that doesnt happen! i thought, thats what the "function"function is there for, no? how can i solve this?
its pretty urgent yet, as i have to finish the game by tonight..
thanx for your help,
cheers,
o.
in my game the player has to collect 5 items and bring them to the master, thats when he wins the game.
so for every item he brings to the master, i set up a flag "item one brought to master", "item two brought to master",...
and then i set up a function, saying: if all the five flags are set up, then run win procedure. but that doesnt happen! i thought, thats what the "function"function is there for, no? how can i solve this?
its pretty urgent yet, as i have to finish the game by tonight..
thanx for your help,
cheers,
o.
Freak
20 Nov 2009, 13:17Where do you call the "If all five flags are set, then win" function?
oblomov
20 Nov 2009, 14:38it is a "function". as i understood, these are scripts that always run automatically, no?
Wonderjudge
20 Nov 2009, 15:28I don't usually use functions but I think they are usually used to return a value.
Instead of a function you could call a procedure i do that alot for checks.
for example in your scenario.
Whenever the player returns with an item set the items flag to on then run a procedure.
"wincheck" for example.
In wincheck
if flag1 is set
and flag2 is set
and flag3 is set
etc.
then run the "win" procedure.
Wonderjuge.
Instead of a function you could call a procedure i do that alot for checks.
for example in your scenario.
Whenever the player returns with an item set the items flag to on then run a procedure.
"wincheck" for example.
In wincheck
if flag1 is set
and flag2 is set
and flag3 is set
etc.
then run the "win" procedure.
Wonderjuge.
oblomov
20 Nov 2009, 15:32you´re marvellous! thats it, it can be so easy.. thanks a lot!
Wonderjudge
20 Nov 2009, 15:34No problem.
Wonderjudge (aka Tim Hamilton)
Wonderjudge (aka Tim Hamilton)
Freak
21 Nov 2009, 11:10Functions are not run automatically. You have to call them somewhere.
ender
22 Nov 2009, 21:32Not sure if this is solved ... but instead of using a procedure, I would have run the 'if flag' check as part of the script for giving the objects to the master ... that way when you go to the master and give him/her the final object it wins the game...