|
2 registered members (steyr, alibaba),
534
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: If comparison is strange
[Re: Liamissimo]
#346383
11/05/10 00:49
11/05/10 00:49
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
you don't reset standard to the entities position if the entity has moved probably leading to something being below where the player originally was, and you are tracing from the players position to the players original position, not below it. in your example afk is the only thing that has a different trace point. c_trace can solve that for you without using c_content.
function isfrei()
{
c_setminmax(me);
VECTOR standard;
vec_set(standard,my.x);
// VECTOR afk;
// vec_set(afk, vector(my.x - 224,my.y, my.z));
while(me)
{
you = NULL; //clear previous you
vec_set(standard, vector(my.x, my.y, my.z - 224); //set position to trace to
c_trace(my.x,standard,IGNORE_MAPS|IGNORE_ME|USE_BOX);
if(you)
{
squeeze = 1;
}
else
{
squeeze = 0;
}
wait(1);
}
}
|
|
|
Re: If comparison is strange
[Re: Liamissimo]
#346395
11/05/10 09:42
11/05/10 09:42
|
Joined: May 2009
Posts: 5,367 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,367
Caucasus
|
Dude, this was so easy)) Here is the demo: Download link Enjoy Edit:if you don't want to download, here is the script:
var squeeze = 0;
function isfrei()
{
c_setminmax(me);
while(1)
{
//trace under models for 100 quants
c_trace(my.x,vector(my.x,my.y,my.z-100),IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
if(trace_hit){squeeze = 1;}else{squeeze = 0;}
wait(1);
}
}
Last edited by 3run; 11/05/10 10:54.
|
|
|
Re: If comparison is strange
[Re: MasterQ32]
#346404
11/05/10 12:11
11/05/10 12:11
|
Joined: Aug 2008
Posts: 482
bart_the_13th
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 482
|
hey 3run! this code won't work at all! i've seen the whole code, so i know a little more it will be the same problem as before! this function is called from a action. and this action is assigned to more than one block. so the last action of the scheduler will define the status squeeze!
so liam should check it otherwise, like from the ball to the other site and not from a block to the ball, because the ball is the player and the code is to check for a player under a block.
Felix Yes, that will be the best solution, having one action do all the checking will be a good practise instead of having lot of action do the same checking. Not just it will run faster(just my opinion though) but it will make sure your program do exactly what they supposed to do. @3run: try to post the code here instead of having to d/l it, It will save everyone's breath  . Just a piece is fine.
|
|
|
Re: If comparison is strange
[Re: 3run]
#346416
11/05/10 14:02
11/05/10 14:02
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I think 'sueezing' it back down to just a single function WOULD be best... But, if becomes too difficult to manage, you could change the code a bit so that the "isfrei" function only thinks about setting squeeze is it is currently ==0, but if it is already ==1, then dont even try to do the c_trace. AND whatever function is "reading" the squeeze variable, have it reset it to zero after each 'read'... ie
1. function isfrei checks and leaves "squeeze=0;"
2. function isfrei checks and leaves "squeeze=0;"
3. function isfrei checks and SETS "squeeze=1;"
4. function isfrei no longer even checks
5. function isfrei no longer even checks
6. function isfrei no longer even checks
7. action 'something' uses squeeze then sets "squeeze=0;"
Ya get me?
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: If comparison is strange
[Re: EvilSOB]
#346434
11/05/10 17:52
11/05/10 17:52
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Hey,
nice you all had fun with my problem, I will try EvilSob's solution as It sounds nice, or I will just c_trace from my charakter if something is above him :3
Thanks at all, also at Richi007 for explaining it and to 3run to even make a downloadable script.
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
|