Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, Quad), 903 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 5 of 5 1 2 3 4 5
Re: Shade-C all in one FX [Re: DLively] #440267
04/21/14 19:35
04/21/14 19:35
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Can you do a screenshot of the issue?
Maybe i can see what's going wrong.


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: Shade-C all in one FX [Re: rojart] #440268
04/21/14 22:43
04/21/14 22:43
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I could send you the compiled version if you like but it seems pointless as the problem is as soon as i approach the floor torch it freezes and crashes.

I could instead show you the code I use:



Code:
FONT* arial_font = "Arial#20b";

//ACTION TEXTS
STRING* Light_candle_str = "LIGHT CANDLE [HOLD ACTION]";
STRING* Light_torch_str = "LIGHT TORCH [HOLD ACTION]";
STRING* Keep_candle_lit_str = "KEEP CANDLE LIT [ACTION]";
STRING* AT_opencabinet = "OPEN CABINET [HOLD ACTION]";
STRING* AT_lockedcabinet = "THIS CABINET IS LOCKED, YOU DON'T HAVE THE KEY!";
//TEMP ACTION STR
STRING * action_str = "text";

TEXT* action_text =	
{
	font = arial_font;
  	string = action_str;
  	layer = 15;
  	flags = CENTER_X;
} 

..........

action candle_stick(){
	
	var light_snd_once = 0;
	var lighting_snd;
	var action_panel_trigger = 0;//triggers the Hold action panel
	var wick_vec_num = 130;
	if(my.skill3 == 0){wick_vec_num = 130;}
	else{wick_vec_num = my.skill3;}
	if(my.skill5 == 0){wick_vec_num = 130;}
	else{wick_vec_num = my.skill5;}
	// 130 is for a standard candle / wall candle
	// 49 is for a skull candle
	
	var light_displacement = 30;//how far from the fire is the light source?
	var light_timer = 0;//how long has it taken to light the flame?
	var light_time = 10;//how long it takes to light the flame
	VECTOR wick_pos, temp_vec;
	
	if(is(my,POLYGON)){set(my,POLYGON);}
	else{set(my,PASSABLE);}
	my.material = mtl_levelDefaultNM;
	
	while(1){wait(1);
		
		while(left_hand_slot == lighter_slot){wait(1);//if there is no lightsource then wait until there is one.
			
			while(!fire_source){wait(1);}
			
			if(is(my,FLAG6)){vec_set(wick_pos.x,vector(my.x,my.y,my.z));wick_pos.z += 125;}
			else{vec_for_vertex(wick_pos,me,wick_vec_num);}//vector position in the modle
			if (my.skill1==0) {//if im not lit
				
				if(vec_dist(wick_pos.x,fire_source.x) <= source_min_dist && light_timer < light_time){
					
					//.............................................
					//action bar has been determined
					//the player is now ready to follow instructions
					if(is(action_text, SHOW)){//if the action key is on screen
						if(action_keys==1){//if action keys have been pressed
							
							if(light_snd_once == 0 && light_timer >= 6){lighting_snd=ent_playsound(me,candle_ignite_snd,100);light_snd_once = 1;}
							
							light_timer += 0.5;//start the timer
							//progress_bar_y = light_timer * 25;//calculations
							progress_bar_y = floor(light_timer)*25;
							set(progress_bar_pan,SHOW);//show the progressbar
						}
						else{//action has been released
							snd_stop(lighting_snd);
							light_snd_once = 0;
							reset(progress_bar_pan,SHOW);//reset progress bar
							light_timer = 0;//reset lighting time
						}
					}
					//.............................................
					//the action bar has not been determined yet
					else{
						action_panel_trigger = 1;//has been trigger to make sure action can be removed
						if(is(my,FLAG7)==0 && is(my,FLAG6)==0){str_cpy(action_str, "LIGHT CANDLE [HOLD ACTION]");}
						if(is(my,FLAG7)==1 || is(my,FLAG6)==1){str_cpy(action_str, "LIGHT TORCH [HOLD ACTION]");}
						iconlist_x = 64;iconlist_y = 0;// set to lighter icon
						set(action_text,SHOW);//show the action map
						set(iconlist_pan,SHOW);//show the icon map
					}	
					//.............................................
					
				}//light source is close, lighting up
				if(vec_dist(wick_pos.x,fire_source.x) > source_min_dist){//light source is not close enough
					if(action_panel_trigger == 1){//if it hasn't been reset yet...
						action_panel_trigger = 0;//reset it
						reset(progress_bar_pan,SHOW);//remove these panels
						reset(action_text,SHOW);
						reset(iconlist_pan,SHOW);
					}
					light_timer = 0;
				}
				
				if(light_timer >= light_time){//if the light source has lit me up	
					
					reset(progress_bar_pan,SHOW);//remove these panels now
					reset(action_text,SHOW);
					reset(iconlist_pan,SHOW);
					
					vec_set(temp_vec.x,wick_pos.x);//temp how holds the wicks location
					//if the light is on the wall, then it needs to be moved away:
					//FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8FLAG8
					if(is(my,FLAG8)){//for wall lights only
						temp_vec.x += light_displacement * cos(my.pan-90);
						temp_vec.y += light_displacement * sin(my.pan-90);
					}
					
					//temp_vec.z += candle_light_height;//prepare to move the light upwards so its not pushing through the this model
					if(is(my,FLAG6)){
						candle_light_height = torch_height;
						//temp_vec.z += candle_light_height;
						you = ent_create("cube.mdl",temp_vec.x,floortorch_fire);
					}//create the candles lightsource
					else{
						candle_light_height = candle_height;
						temp_vec.z += candle_light_height;
						if(is(my,FLAG7)){you = ent_create("cube.mdl",temp_vec.x,torch_fire);}//create the candles lightsource
						else{you = ent_create("cube.mdl",temp_vec.x,candle_fire);}
					}
					you.skill1 = candle_max_light;
					my.skill2 = handle(you);//the candles lightsource is now stored for using later
					
					my.skill1=1;//I am now lit
					light_timer = 0;//reset the light_timer for relighting
					
				}	
				
			}
			
			if(my.skill1 == 1){//if I am lit
				you = ptr_for_handle(my.skill2);//I must be reminded you is the candles lightsource
				if(you.skill1 > 85 && you.skill1 < 200){
					if(vec_dist(wick_pos.x,fire_source.x) < source_min_dist){//if the light_source is close enough
						
						if(is(action_text, SHOW)){//if the action key is on screen
							if(action_keys==1){//if action keys have been pressed
								you = ptr_for_handle(my.skill2);//I must be reminded you is the candles lightsource
								you.skill1 = candle_max_light;
								action_panel_trigger = 0;//reset it
								reset(action_text,SHOW);//remove these panels
								reset(iconlist_pan,SHOW);
							}
							
						}
						//.............................................
						//the action bar has not been determined yet
						else{
							action_panel_trigger = 1;//has been trigger to make sure action can be removed
							str_cpy(action_str, "KEEP CANDLE LIT [ACTION]");
							iconlist_x = 64;iconlist_y = 0;// set to lighter icon
							set(action_text,SHOW);//show the action map
							set(iconlist_pan,SHOW);//show the icon map
						}	
						//.............................................
						
					}
					
				}
				if(vec_dist(wick_pos.x,fire_source.x) > source_min_dist || you.skill1 < 81){//door is not close enough
					if(action_panel_trigger == 1){//if it hasn't been reset yet...
						action_panel_trigger = 0;//reset it
						reset(action_text,SHOW);//remove these panels
						reset(iconlist_pan,SHOW);
					}
				}
				
			}
			if(left_hand_slot != lighter_slot){reset(progress_bar_pan,SHOW);reset(action_text,SHOW);reset(iconlist_pan,SHOW);}
	}
	}	
	
}



Keeping in mind this worked in a compiled copy before I upgraded to shade-c EVO MASTER

Last edited by DLively; 04/21/14 22:45.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Shade-C all in one FX [Re: DLively] #440277
04/22/14 09:35
04/22/14 09:35
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
At first glance i can only speculate what's wrong.

In the top of your candle action put this:
Code:
action candle_stick(){
while (!me) {wait (1);}
 ...
}



Check also this:
Code:
// set camera sizes (this is only needed if you use "camera" as main):
camera.size_x = screen_size.x;
camera.size_y = screen_size.y;
// set camera as main view of sc_screen_default:
sc_screen_default = sc_screen_create(camera);



Try and compile without shader //my.material = mtl_levelDefaultNM;

Your game is an interior, exterior level?
If interior make sure you have sun light and shadows disabled vec_set(sun_color, vector(0,0,0)); sc_screen_default.settings.lights.sunShadows = 0; //enable shadows for the sun

Originally Posted By: DLively
I could send you the compiled version if you like but it seems pointless as the problem is as soon as i approach the floor torch it freezes and crashes.

What error message?

You can use the sys_marker command to mark positions in the code and find the place where the crash happens.

Make your action small as possible and expand step by step to find your issue, good luck.


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Page 5 of 5 1 2 3 4 5

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1