2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Water block not beeping
[Re: Wjbender]
#452983
07/02/15 20:58
07/02/15 20:58
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
action water()
{
fx_mirrorWater();
while(1) {
if(key_hit("1")) terrain_raise(me,-0.5);
if(key_hit("2")) terrain_raise(me,0.5);
// skills are defined as var, but shaders use float values
// conversion is not automatic here, thus we need floatv/fixv
if(key_hit("3")) my.skill43 = floatv(fixv(my.skill43)-5);
if(key_hit("4")) my.skill43 = floatv(fixv(my.skill43)+5);
if(key_hit("5")) my.skill44 = floatv(fixv(my.skill44)-5);
if(key_hit("6")) my.skill44 = floatv(fixv(my.skill44)+5);
if(key_hit("7")) mtl_hdr.skill2 = floatv(fixv(mtl_hdr.skill2)+1);
if(key_hit("8")) mtl_hdr.skill2 = floatv(fixv(mtl_hdr.skill2)-1);
----------------->>>>>> water_height = terrain_get_z(my,1);<<<<<---------------------------------------
water_ripple = fixv(my.skill43);
water_scale = fixv(my.skill44);
hdr_threshold = fixv(mtl_hdr.skill2);
wait(1);
}
}
yeah only one i can find too , have you assigned this action to a block or something ? Ah! Okay, I think you hit on something. I do have a texture in the WED with this same water() action assigned to it, with all the same code assigned to that action, such as fx_mirrorWater(), etc. I am at work right now. When I get home, I will try deleting this texture from the WED, and see what happens. Thank you! :-)
|
|
|
Re: Water block not beeping
[Re: Ruben]
#452986
07/03/15 06:35
07/03/15 06:35
|
Joined: Sep 2003
Posts: 9,859
FBL
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 9,859
|
next option is terrain.c level.c
Last edited by Firoball; 07/03/15 11:31.
|
|
|
Re: Water block not beeping
[Re: FBL]
#452987
07/03/15 09:45
07/03/15 09:45
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
/ get and set terrain height
function terrain_get_z(ENTITY* ent,number)
// returns the height of the next vertex at the given position
function terrain_height(ENTITY* ent,VECTOR* position)
// return a terrain position above ground
VECTOR* terrain_pos(ENTITY* terrain,x,y,z)
// raise all terrain vertices by the given value
function terrain_raise(ENTITY* terrain, var raise_z)
// raise one terrain vertex by the given value
function terrain_raisevertex(ENTITY* terrain,var x,var y,var raise_z)
function terrain_fence(ENTITY* terrain, var height)
// place an entity at a random position between two height values on terrain
// uses: terrain_buffer
function ent_terrain_place(ENTITY* ent,ENTITY* terrain,minheight,maxheight)
// create entities on terrain, guided from on color spots in a mask
var ent_seed(char* name,ENTITY* terrain,BMAP* mask,COLOR* color,var dist,var mode,EVENT act)
var ent_seed(char* name,ENTITY* terrain,BMAP* mask,COLOR* color,var dist,EVENT act)
are you using any of these functions, they are from "level.c" see if you can find theire function names somewhere in your scripts..
Compulsive compiler
|
|
|
Re: Water block not beeping
[Re: Wjbender]
#452990
07/03/15 12:01
07/03/15 12:01
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
screw it , try this .. assign this action to your water block
action water_block()
{
while(!me)wait(1);
//this will be the min/max of the water block
VECTOR water_min;
VECTOR water_max;
//this should be your player's min/max you dont need this
//i did this for the camera as a demo
VECTOR player_min;
VECTOR player_max;
while(me)
{
//water min/max values plus position
vec_set(water_min,my.min_x);
vec_set(water_max,my.max_x);
vec_add(water_min,my.x);
vec_add(water_max,my.x);
//player min/max
//this should be your player sizes you wish to test intersection against
vec_set(player_min,vector(camera.x-50,camera.y-50,camera.z-50));
vec_set(player_max,vector(camera.x+50,camera.y+50,camera.z+50));
//check if player min/max , intersects with , water min/max
if(c_intersect(water_min,water_max,NULL,player_min,player_max,NULL)==-1)
{
DEBUG_VAR(1,100);
draw_box3d(water_min,water_max,COLOR_GREEN,100);
}
else
{
DEBUG_VAR(0,100);
draw_box3d(water_min,water_max,COLOR_RED,100);
}
wait(1);
}
}
or go with in_passable, I am done.
Compulsive compiler
|
|
|
Re: Water block not beeping
[Re: Wjbender]
#452997
07/03/15 16:41
07/03/15 16:41
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Thank you Wjbender. However, I think I figured out why I kept getting the terrain_get_z error. I had this code in my main() function:
function main()
{
...
level_terrain = level_ent; // CAUSING terrain_get_z ERROR WHEN REGION IS PRESENT.
terrain_tile(level_terrain); // CAUSING terrain_get_z ERROR WHEN REGION IS PRESENT.
...
}
When I commented out this code, I no longer get the terrain_get_z error, even if I have a region in my WED file. I will try to make the region method work. If it does not, I will try your water_block() action method. Thank you.
Last edited by Ruben; 07/03/15 16:42.
|
|
|
Re: Water block not beeping
[Re: Ruben]
#452998
07/03/15 16:47
07/03/15 16:47
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
okay
Last edited by Wjbender; 07/03/15 17:01.
Compulsive compiler
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|