3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: Lecithin]
#314730
03/10/10 16:13
03/10/10 16:13
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
When you scroll to the bottom of the earthball.c file you'll see a while(1) loop to control the camera. Before the wait(1) at the end of that while loop you can insert some code to check the z value of the eBall entity:
if(eBall.z < - 100)
{
eBall.z = 500;
}
edit: You cannot attach a function to an already created entity. But you could attach an already created entity to a function. So this could be another way:
void earthball_Control(ENTITY* _ent)
{
my = _ent;
while(my)
{
if(my.z < -100)
{
my.z = 500;
}
wait(1);
}
}
Now add this line to your main function _before_ the while(1) loop:
earthball_control(eBall);
Last edited by Xarthor; 03/10/10 16:16.
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: Xarthor]
#314736
03/10/10 16:40
03/10/10 16:40
|
Joined: Oct 2009
Posts: 49
Lecithin
OP
Newbie
|
OP
Newbie
Joined: Oct 2009
Posts: 49
|
GAH scratch this entire post! I had a simple syntax error and need more sleep....
thanks for your help
Last edited by Lecithin; 03/10/10 16:41.
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: Xarthor]
#314737
03/10/10 16:41
03/10/10 16:41
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
You cannot attach a function to an already created entity.
Are you sure of this Xarthor? Shouldnt this work?
action earthball_Control()
{ while(my)
{ if(my.z < -100)
{ my.z = 500; }
wait(1);
}
}
function main()
{
...
...
me = eBall;
earthball_Control(); //OUTSIDE of any loop
...
...
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: Lecithin]
#314738
03/10/10 16:42
03/10/10 16:42
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Well you may need to read my post again. The correct syntax for an if branch is:
if(condition)
{
instruction;
}
so please write:
if(eBall.z < -100)
{
eBall.z = 500;
}
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: EvilSOB]
#314739
03/10/10 16:44
03/10/10 16:44
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
True, that is seems to be another possibility. So, no, I'm not sure anymore  edit: When you look at my first post you'll see that I presented the same idea. While looking closer at your code I'm not sure if you can call an action like that. But it should definatly work when you'd write function instead of action.
Last edited by Xarthor; 03/10/10 16:49.
|
|
|
Re: checking an entitiy's position w/out attaching an action?
[Re: Xarthor]
#314744
03/10/10 17:02
03/10/10 17:02
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
You can CALL actions that way with no problem, I do it all the time.
But Ive never tested the process far enough to know if these actions self-terminate when the entity they've been attached to gets removed by a different function.
[EDIT]Im purely discussing the 'cant attach an action to an existing entity' issue. I agree with all else youve said / suggested.
"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
|