Gamestudio Links
Zorro Links
Newest Posts
Zorro and IB Gateway
by cwford. 04/07/20 00:31
MT4 bridge: Check account number
by tradingest. 04/06/20 12:36
Loging off automatically ?
by jcl. 04/06/20 12:25
zorro contract example
by jcl. 04/06/20 09:22
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
4 registered members (Lozoteva, jbhunter, 3run, Stansmedia), 642 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
vishal, tanhwuser, beo, marsz, gonzalez21
18413 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
player #458860
04/03/16 11:46
04/03/16 11:46
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
Hi Folks,
I want my player to move with a platform (when he steps onto it and the platform is triggered).
I have tried 'PIBiped01' and 'player' in my script (c-script), but they do not work.
Is there another 'name ' to call the player please?

.....example
{
while(platform.x<300)
{
platform.x+=3*time-step;
player.x+=3*time_step; //'player' does not work!
wait(1);
....
David

Last edited by DAVIDMORETON; 04/04/16 09:03.
Re: player [Re: DAVIDMORETON] #458862
04/03/16 15:37
04/03/16 15:37
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
I think all template scripts use the player pointer.

See if the mistake is somewhere else in your code...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: player [Re: EpsiloN] #458864
04/03/16 15:59
04/03/16 15:59
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I never personally worked with c-script and the templates, but I heard the templates can be buggy. Also c-script is really old right? I would recommend switching to lite-c (check "How to convert C-Script code to lite-C" in the manual), it should not be to hard unless it is a really big project ofcourse. Also as soon it is lite-c, probably many more people will be able to help you (atleast I can than grin ).

Re: player [Re: Reconnoiter] #458875
04/04/16 09:08
04/04/16 09:08
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
Thanks Epsilon and Reconnector for you answers - I have added the actual code to my query - does this help?
It is what to call the player that is the problem - any ideas please?
David

Re: player [Re: DAVIDMORETON] #458880
04/04/16 11:14
04/04/16 11:14
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
First check if player isn't null. The following is for lite-c but might also work for c-script:

if (player == null) error("player pointer is null");


And also try;

if (!player) error("player pointer is not valid");


If no error message pops up, than you have some kind of weird memory error or such, or it is some bug (older version?).
If an error message does pop up, if it is for the if() than you haven't set the player pointer correctly or is set null somewhere in your code.
If an error message pops up and it is in the second if() than the pointer to the player is not valid anymore. Perhaps after loading a savegame??

Last edited by Reconnoiter; 04/04/16 11:17.
Re: player [Re: DAVIDMORETON] #458881
04/04/16 11:42
04/04/16 11:42
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Reconnoiter, from what I remember, I think you need braces in C-Script (one-liners didn't work), but I may be wrong...

DAVIDMORETON, I guess you assigned the action in WED, right?
Try doing it the dynamic way, in your main function:
Code:
player = ent_create("player.mdl",vector(0,0,32),template_function);


This is in case the templates don't assign the player pointer to the actual player... This way you assign it explicitly when you're creating the entity.

PS.: I hope you understand enough to substitute the values in my example, eg. the position from WED and the function/action from the template scripts.
Oh, and I think "error" isn't available in the old C-Script. Use beep();

Last edited by EpsiloN; 04/04/16 11:43.

Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: player [Re: Reconnoiter] #458882
04/04/16 11:46
04/04/16 11:46
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
Thanks to all who helped.
I have now solved the problem - after much (hours) fiddling about and trying everything I could think of - the name to call the player such that it will move along with a platform is
piBiped01_entity....
Could not find this anywhere in the manual or templates!
This might be useful to others with the same problem
Once again, thanks for your help.

so the code is:-
......
{
while(platform.x<300)
{
platform.x+=3*time_step;
piBiped01_entity.x+=3*time_step;
wait(1);
.....
David

Last edited by DAVIDMORETON; 04/04/16 11:50.
Re: player [Re: DAVIDMORETON] #458883
04/04/16 13:10
04/04/16 13:10
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Your welcome.

Originally Posted By: DAVIDMORETON
- the name to call the player such that it will move along with a platform is
piBiped01_entity.... Could not find this anywhere in the manual or templates!
This might be useful to others with the same problem
, I have a better idea, ditch those templates as soon as you can.

If you want some templates for Lite-c, I can write you some small ones and Realspawn also has quite a nice selection for beginners to Lite-c (http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=458483#Post458483).

cheers

Re: player [Re: Reconnoiter] #458885
04/04/16 16:14
04/04/16 16:14
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
Many thanks for your kind offer Reconnoiter - I don't like to be a nuisance - but sometimes I get stuck when I can't find the necessary data in the manual.
I intend to covert my code to lite-c when I have completed this section of the game (it's quite a lot of code!)
Kind regards, David


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

Gamestudio download | chip programmers | 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