3 registered members (vicknick, 7th_zorro, 1 invisible),
890
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: player problem
[Re: DAVIDMORETON]
#291551
09/26/09 11:49
09/26/09 11:49
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
If you are definately using the pointer "player" in all your script then it shouldnt be a problem. Its probably just a timing issue. That is, if the "moveit" function starts BEFORE player gets assigned, then the problem occurs... Here are two suggestions for "moveit" to bypass the problem, my perferred one is the second one.
//commonly used process
function moveit
{
while(player==NULL) { wait(1); }
while (platform.x<200)
{
platform.x+=2*time;
player.x+=2*time;
wait(1);
}
}
//my preferred process
function moveit
{
while (platform.x<200)
{
platform.x+=2*time;
if(player!=NULL) { player.x+=2*time; }
wait(1);
}
}
Mind you, I assume you are aware that this code isnt checking to be sure the player is actually ON the platform? If they step off it whilst it is moving, they'll continue to be moved by it....
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: player problem
[Re: DAVIDMORETON]
#291558
09/26/09 13:14
09/26/09 13:14
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I myself dont use c-script, but did do some c-script->lite-c conversions in the past. So Im helping in lite-c in my head, then converting to c-script as I type my posts. So there may be some conversion errors there.
For instance, the 'bad or missing parameter' error MAY be due to both versions of 'moveit' MAY need parameter brackets after thier names. eg "moveit()" instead of just "moveit". In lite-c you need to, but it seems optional in c-script. Put em on and try and see if the error goes away.
Anyway, regardless of the brackets issue, if the second one didnt work, there are several possible reasons. 1> The "moveit" function is not being run. 2> The player pointer is not pointing to your player entity. 3> The player is a physics entity, and so cannot be moved with simple co-ordinate adjustments. 4> There is another action somewhere limiting the players movements in the x direction.
I think options #1 or #3 are the most likely causes...
So unless you can supply some of the code then I cant help out more... Say, the opening part of the players action? (up to the start of its while loop). Or are you using the templates? In that case try replacing "player" with "plBiped01_entity" in the "moveit" function. Otherwise Im out of ideas of how to help.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: player problem
[Re: DAVIDMORETON]
#291566
09/26/09 14:33
09/26/09 14:33
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hmm, Ive never really used the templates at all, overly complex for my tastes. I like to do things my way, and the template make that hard. But hey, thats my problem, back to yours.... The "PIBiped01" templates dont actually use the "player" pointer, unless youve modded it in. They use their own pointer which is called "plBiped01_entity" instead. So try changing "moveit" to be this, and see how it goes...
function moveit()
{
while(platform.x<300)
{
platform.x+=2*time;
if(plBiped01_entity!=NULL) { plBiped01_entity.x+=2*time; }
wait(1);
}
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|