1 registered members (TipmyPip),
15,499
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: random question
[Re: MrGuest]
#358434
02/11/11 10:40
02/11/11 10:40
|
Joined: Sep 2010
Posts: 97
carla_mariz
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 97
|
hello mr. guest, i'm glad you answered my question. can you check on the code that i posted if its correct? i changed a bit from yours and changed "bmap" to "questions". the picture file are in the same folder with the script. pls help me.thanks.
Last edited by carla_mariz; 02/11/11 10:46.
|
|
|
Re: random question
[Re: carla_mariz]
#358442
02/11/11 11:34
02/11/11 11:34
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
i've already mentioned that in my 1st post
//rnd_q[int_rndQuestionSelected].model; //stores the model name
use
ent_create(rnd_q[int_rndQuestionSelected].model, vector(-10, 0, 0), NULL);
to create it, obviously change the position to where you want it created and add an action should it need one. Make syoure you're creating it AFTER you've set the random number
|
|
|
Re: random question
[Re: MrGuest]
#359101
02/15/11 17:37
02/15/11 17:37
|
Joined: Sep 2010
Posts: 97
carla_mariz
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 97
|
oopss..sorry  i first run the menu:
#include <acknex.h>
#include <default.c>
#include "level1.c"
......
function main()
{
screen_size.x = 800;
screen_size.y = 600;
mouse_map = cur;
mouse_mode = 4;
}
function redlevel1()
{
selectchar.flags &= ~SHOW;
level1();
wait(-2);
level_load("maze1.wmb");
wait(3);
gui.flags = SHOW | OVERLAY;
health_pan.flags = SHOW | OVERLAY;
left_bar.flags = SHOW | OVERLAY;
media_stop(soundtrack_handle);
}
function bluelevel1()
{
selectchar.flags &= ~SHOW;
level1();
wait(-2);
level_load("maze1.wmb");
wait(3);
gui.flags = SHOW | OVERLAY;
health_pan.flags = SHOW;
left_bar.flags = SHOW | OVERLAY;
media_stop(soundtrack_handle);
}
next is the level 1
#include <acknex.h>
#include <default.c>
#include "mainmenucode.c"
#include "structq.c"
.....
function main()
{
screen_size.x = 800;
screen_size.y = 600;
sun_light=100;
}
/////some functions here..
i want the struct file to run when the level is loaded so i include it in level1 code. but nothing shows.  when i try to put the script to menucode, it becomes like this:
#include <acknex.h>
#include <default.c>
#include "level1.c"
typedef struct RND_Q {
BMAP* questions;
char* model;
} RND_Q;
RND_Q* rnd_q;
int int_rndQuestionCount;
int int_rndQuestionSelected;
PANEL* pnl_question = {
layer = 4;
pos_x = 673;
pos_y = 490;
flags = SHOW | OVERLAY;
}
void question_add(char* questions, char* model)
{
int i = int_rndQuestionCount;
int_rndQuestionCount++;
rnd_q = realloc(rnd_q, sizeof(RND_Q) * (int_rndQuestionCount));
rnd_q[i].questions = bmap_create(questions);
rnd_q[i].model = model;
}
function main()
{
screen_size.x = 800;
screen_size.y = 600;
mouse_map = cur;
mouse_mode = 4;
wait(1);
question_add("tanong1.tga", "paccherry.mdl");
question_add("tanong2.tga", "bilog.mdl");
question_add("tanong3.tga", "heart.mdl");
question_add("tanong4.tga", "strip.mdl");
random_seed(0);
int_rndQuestionSelected = random(integer(int_rndQuestionCount));
pnl_question.bmap = rnd_q[int_rndQuestionSelected].questions;
ent_create(rnd_q[int_rndQuestionSelected].model, vector(-240, -16, 48), NULL);
}
and then a syntax error appears on "typedef struct" line. 
|
|
|
|