Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
earthball sample functions not working in wed #324639
05/22/10 12:57
05/22/10 12:57
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Hey guys!

I created a level in wed, placed the earth model in it and assigned an action to it. The action includes edited functions from that of the earthball sample but whenever I try to call the kick function, I get an error. empty pointer called in kick.

Another problem I have is how to relate different entities. Suppose I have three different entities with different actions and I want them do something like shake hands when they are close to each other. I don't understand how I'll differentiate them since they are all using 'my' in their actions. The vec_dist I have is then vec_dist(my.x, my.x) and that creates run time errors then because they are all called my. How do you solve this?

regarding the first question, here's my code... anything wrong?

[code]

function kick();


action move_me()
{

set(my, SHADOW);

phent_settype(my, PH_RIGID, PH_SPHERE);
phent_setmass(my, 1, PH_SPHERE);
phent_setfriction(my,90);
phent_setelasticity(my,75,100);
phent_setdamping(my,30,5);
phent_addvelcentral(my,vector(10,10,0));
ph_setgravity(vector(0,0,-500));

my.emask |= ENABLE_FRICTION;
while(1){
on_space = kick;
wait(1);
}

}

function kick()
{
VECTOR vKick;
vKick.x = 150; vKick.y = 0; vKick.z = 75;
vec_rotate(vKick, camera.pan);
phent_addvelcentral(my, vKick);
}

[\code]


I know I can.
Re: earthball sample functions not working in wed [Re: gameaddict] #324641
05/22/10 13:11
05/22/10 13:11
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
i am not sure, but i think if you call a function with on_space, the my pointer is zero and so you become this error.
Try to use a entity pointer:

Code:
ENTITY* test_ent;

action move_me()
{
   test_ent = me;
   ...
}

function kick()
{
   ...
   phent_addvelcentral(test_ent, vKick);
}



For your second problem use 3 different entity pointers for each ent. You can use also a array:
ENTITY* test_ent[3];

edit: if move_me is the player, there is already a entity pointer:
player = me;

edit 2: EvilSobs solution is better wink

Last edited by Widi; 05/22/10 13:18.
Re: earthball sample functions not working in wed [Re: gameaddict] #324642
05/22/10 13:15
05/22/10 13:15
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
replace your "on_space = kick;" line with the following...
"if(key_space) { kick(); }"

and then have a re-read of the "on_key" section of the manual
to see where you went wrong. Easy mistake for beginners BTW.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: earthball sample functions not working in wed [Re: EvilSOB] #324647
05/22/10 13:39
05/22/10 13:39
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Thanks guys, it worked! Sent the ball into space.
I'll try the second one now.


I know I can.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1