2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Water block not beeping
[Re: Reconnoiter]
#452952
07/02/15 02:15
07/02/15 02:15
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
I tried a different method that I just recently learned, and it seems to partially work. I went into the WED file and applied the water block to a region titled "water". I then used the region_check() function in the player_code() function to see if the player made contact with the "water" region. Sure enough, the player did. The game is beeping like crazy when the player makes contact with the water block, but I keep getting this error pop-up message every time before the game loads as follows:
Error E1513
Script crash in terrain_get_z:
OK Cancel
When I click the OK button, the player starts moving on its own without me moving it. Once I fiddle with the move buttons, then the player will stay put, and move according to my commands. However, the pop-up error above will not go away every time I restart the game, even when I erase the new code that I put in the program. This is the new code I put:
...
action player_code()
{
...
player = me;
...
my.shadow = 1;
vec_fill(move_vec, 0); // always reset a vector to zero when creating
...
my.JUMP_FORCE = 13;
var gravity_var = 0;
var gravity_force = 2;
var jumplck = 0;
var space_lck = 0;
my.FEET_HEIGHT = -my.min_z+1; // ORIGINAL
my.eflags |= FAT | NARROW; // set both flags to prevent automatic recalculation on
// scale changes.
my.emask |= ENABLE_SHOOT;
...
// set FLAG2 to make the guard detectable by c_scan,
// and store the guard pointer in its own CREATOR skill
// so that the detecting entity knows its enemy
set(my,FLAG2);
my.CREATOR = me;
set(my, POLYGON);
camera.tilt = -5;
...
wait(1);
while (1)
{
VECTOR vMin,vMax; // NEW CODE
vec_set(vMin,my.x); // NEW CODE
vec_set(vMax,my.x); // NEW CODE
vec_add(vMin,my.min_x); // NEW CODE
vec_add(vMax,my.max_x); // NEW CODE
if(region_check("water",vMin,vMax)) // NEW CODE
{
beep(); // NEW CODE
}
...
wait(1);
}
}
...
Does anyone have an idea why I might be getting this error?
Last edited by Ruben; 07/02/15 03:22.
|
|
|
Re: Water block not beeping
[Re: Ruben]
#452953
07/02/15 04:10
07/02/15 04:10
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Okay, I believe I figured out what is causing the pop-up error, and it has nothing to do with my code in SED. When I delete the "region" I created in the WED file, and I restart the game, the error is gone. However, when I place the region back into the WED file, the error comes back when I restart the game. Specifically, the pop-up error is:
Error E1513
Script crash in terrain_get_z:
OK Cancel
Has anyone else had this particular situation? If so, any ideas on how you solved it?
|
|
|
Re: Water block not beeping
[Re: FBL]
#452955
07/02/15 06:55
07/02/15 06:55
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
I don't know about that error (sounds strange to me), but for checking things with passable and solid blocks you can use following keywords in your entity function:
in_passable (inside passable block) on_passable (standing on passable block)
Those temporary variables are set after each c_move and c_trace automatically. For more details check the manual pages of those commands. So, you do not recommend using regions?
|
|
|
Re: Water block not beeping
[Re: Ruben]
#452956
07/02/15 07:43
07/02/15 07:43
|
Joined: Sep 2003
Posts: 9,859
FBL
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 9,859
|
The last time I did "water code" was several years ago, regions were not existing back then. I just added inmformation to the c_trace approach.
It also depends on how you plan to build your level. in_passable/on_passable is for level blocks (referred to as "water entities" in the manual), but as soon as you add models with polygon flag as level surfaces, it won't work anymore.
A water entity should be a level entity (which is a pre-built level block) with water texture.
Last edited by Firoball; 07/02/15 07:46.
|
|
|
Re: Water block not beeping
[Re: Ruben]
#452959
07/02/15 09:09
07/02/15 09:09
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Okay, I believe I figured out what is causing the pop-up error, and it has nothing to do with my code in SED. When I delete the "region" I created in the WED file, and I restart the game, the error is gone. However, when I place the region back into the WED file, the error comes back when I restart the game. Specifically, the pop-up error is:
Error E1513
Script crash in terrain_get_z:
OK Cancel
Has anyone else had this particular situation? If so, any ideas on how you solved it? , hmm strange error, maybe memory error? Removing/adding a region should not matter with this. What is in this terrain_get_z function? Just incase, better check if your not trying to access empty pointer somewhere cause memory errors are a pain the ass to solve once your project is bigger. It can become really random.
|
|
|
Re: Water block not beeping
[Re: FBL]
#452960
07/02/15 09:11
07/02/15 09:11
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
I am not sure about this , but the terrain thingy sounds familiar to me , I had the issue once and figured out that the terrain min and max were empty directly after a terrain creation , it could be that the water surface (if it had waves) is when its created as a piece of terrain ?
then just after its created it needs the c_setminmax or something to update min and max or else they remain uninitialised .
will check it out of curiosity.
Compulsive compiler
|
|
|
Re: Water block not beeping
[Re: Wjbender]
#452964
07/02/15 10:07
07/02/15 10:07
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
http://wikisend.com/download/686600/test.zipI couldn't find a issue , what are you doing different in yours? terrain_get_z could only have a few possible empty pointers/whatever , a non existing entity or empty min max I believe .. but I did what you said and didn't get the same issue , you must be using / doing something more than just that , are you using water planes and shaders or something ,something is missing from your explanation.
Compulsive compiler
|
|
|
Re: Water block not beeping
[Re: FBL]
#452979
07/02/15 17:43
07/02/15 17:43
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
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 ?
Compulsive compiler
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|