SOLVED: Chars PPC using Character* variable

Started by Slasher, Thu 20/04/2017 12:12:07

Previous topic - Next topic

Slasher

Hi,

I have made a Character* variable for 3 players which I have named RoboMan

I am using these to change the player via buttons:

button1
RoboMan = cSentinal;
RoboMan.SetAsPlayer();

button2
RoboMan = cExcalibur;
RoboMan.SetAsPlayer();

button3
RoboMan = cCenturian;
RoboMan.SetAsPlayer();


I should then be able to control the selected player with the command RoboMan I believe.

Such as:

Code: ags
RoboMan.Say("hello");


However it seems I am unable to add collision detection when using the PPC module, because error says it can't change strings to int.

Code: ags

 if(PPColliding.CWithC(RoboMan,cpLANET1) && Game.DoOnceOnly("Planet found")){ // String error
OR
 if(PPColliding.CWithC(player,cpLANET1) && Game.DoOnceOnly("Planet found")){  // only works with default player



Am I able to salvage this or is it a case of using x y collision maths?

help appreciated...





dayowlron

Could this be a matter of scope?

Is RoboMan set before you get to that statement?

before the if put something to display the contents of RoboMan like
Code: ags

    Display(RoboMan.Name);
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Slasher

QuoteDisplay(RoboMan.Name);
Gives the Display as: RoboMan....as per variable name..

and i put it after the 'if' because in rep exec...

dayowlron

Really? I was expecting Sentinal or Excalibur or Centurian.
How is RoboMan defined? maybe we can display a different property to be sure it is setting properly.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Slasher

#4
QuoteReally? I was expecting Sentinal or Excalibur or Centurian.
It does now i have changed all the names from RoboMan.. (nod)

Edit:
I'v got it to work plus:

SSH added this piece of updated script for PPC..

Code: ags

 if(player.PPCollidesWithC(cpLANET1))
{




dayowlron

And still giving the String error? I am not familiar with the PPColliding module but tried to see why it would work for player.

Well i tried, but if you ever do get it to work I would be curious as to what was wrong.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Slasher

#6
Hi  dayowlron

I don't know quite why it never worked and showed an error but somehow i overcame it.. Probably a script error by yours truly :-[

dayowlron

Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Khris

ALWAYS post the exact error message. "can't change String to int" means AGS encountered a String where it's expecting an int, so this has nothing to do with collision math or unassigned pointers.

The error message will point to the exact line, and also state multiple lines which point to the exact function calls and ultimately the offending line.

If you post asking about an error message, why not provide ALL the info, instead of making us resort to vague guesses? How long have we been doing this by now?

SMF spam blocked by CleanTalk