2 registered members (Martin_HH, TipmyPip),
1,279
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
1: Length of array 2: same entity's skills
#277105
07/07/09 19:20
07/07/09 19:20
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
1.:Short question that I couldn't find here on the fomrums or in the manual. Is it possible to find out the length of an array? GER: Kurze Frage, kann man die Länge eines Arrays herausfinden? 2.: I just set at the beginning of an action for example "my.skill1 =1;". But If I try top get that value from another entity with the same action it returns only 0. Example:
action my_action()
{
my.skill1 = 1;
wait(1);
.....
c_trace(...);//to another entity with the same action
if(you.skill1 == 1)
{
Do_something;
}
}
This doesn't work. And a Diag returnes 0 too I'm sure that I've got the right entity (checked it with dieag too). Is this generally possible or can't I read skills from same-action ents?
Last edited by Nicotin; 07/07/09 19:52.
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: Nicotin]
#277112
07/07/09 20:33
07/07/09 20:33
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
1: Sometimes, if you are lucky. Depends on the type of array. What are you trying to find the length of?
2: Put the my.skill1 = 1; AFTER the wait(1);, and always start an action with a wait(1); Sometimes entity is not fully created till after its first wait, if so then its skills are not yet available.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: EvilSOB]
#277115
07/07/09 20:38
07/07/09 20:38
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
1: I want to get the index of an STRING* array. 2: Still doesn't work
wait(1);
[...]
c_setminmax(me);
wait(1);
my.skill1 = 1;
I tested it with diag. The "my.skill1" is 1 at this point, the you.skill1 is still 0.
Last edited by Nicotin; 07/07/09 20:46.
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: Nicotin]
#277117
07/07/09 20:59
07/07/09 20:59
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
1: Not that I know of.
2: Drop the second wait. (the one after c_setminmax). And are you SURE the trace is hitting the right entity?
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: EvilSOB]
#277118
07/07/09 21:07
07/07/09 21:07
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Yes I am 100% sure. Here see the code where I test it:
if(you)
{
diag("\n");diag("Ist ent: ");diag(str_for_entfile(NULL,me));
diag("\n");diag("you.Iscar:");diag(str_for_num(NULL,you.iscar));
diag("\n");diag("my.Iscar:");diag(str_for_num(NULL,my.iscar));
if(you.iscar ==1)//wenn du ein auto bist
{
brems_speed=0;//werde langsamer
diag("\n");diag("ist auto und bremst");
}
(skill1 is defined as iscar) The models that have this actions are: "accent_white.mdl" "renault4.mdl" "yugo_red.mdl" And here is the Logfile: ... Ist ent: YUGO_RED.MDL you.Iscar:0 my.Iscar:1 ...
Last edited by Nicotin; 07/07/09 21:08.
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: Nicotin]
#277139
07/07/09 22:42
07/07/09 22:42
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Can you try adding in a diag("\n");diag("2nd ent: ");diag(str_for_entfile(NULL,you)); just as a test of my stubborn-ness please?
Ooh, can I se the whole c_trace line too please...
Last edited by EvilSOB; 07/07/09 22:44.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: EvilSOB]
#277173
07/08/09 07:30
07/08/09 07:30
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Oh damn. THAT could be the misstake...I thought it was me -.-. Ok the c_trace line is:
vec_set(temp_vec,vector(my.x+my.max_x,my.y,my.z));
vec_rotate(temp_vec,my.pan);
vec_set(temp_vec2,vector(my.x+my.max_x+5,my.y,my.z));//scanne ein kleines wenig vor
vec_rotate(temp_vec2,my.pan);
c_trace(temp_vec,temp_vec2,IGNORE_ME);
I want that the ent traces a little bit infront of itself. But now it makes sense. It doesn't find the car^^. Sorry as I sayed. I thought I had "you" standing there ![smile smile](/ubb7/images/graemlins/default_dark/smile.gif) . Then I can finally search why it isn't finding. Thanks already
|
|
|
Re: 1: Length of array 2: same entity's skills
[Re: Nicotin]
#277195
07/08/09 09:16
07/08/09 09:16
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
No problems. I got stuck like that once before.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|