Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Thu 20/04/2017 12:12:07

Title: SOLVED: Chars PPC using Character* variable
Post by: Slasher on Thu 20/04/2017 12:12:07
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) Select
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) Select

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...




Title: Re: Chars PPC using Character* variable
Post by: dayowlron on Thu 20/04/2017 13:04:28
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

    Display(RoboMan.Name);
Title: Re: Chars PPC using Character* variable
Post by: Slasher on Thu 20/04/2017 13:11:13
QuoteDisplay(RoboMan.Name);
Gives the Display as: RoboMan....as per variable name..

and i put it after the 'if' because in rep exec...
Title: Re: Chars PPC using Character* variable
Post by: dayowlron on Thu 20/04/2017 15:34:50
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.
Title: Re: Chars PPC using Character* variable
Post by: Slasher on Thu 20/04/2017 17:40:08
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) Select

if(player.PPCollidesWithC(cpLANET1))
{



Title: Re: Chars PPC using Character* variable
Post by: dayowlron on Thu 20/04/2017 17:54:33
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.
Title: SOLVED: Re: Chars PPC using Character* variable
Post by: Slasher on Thu 20/04/2017 18:43:02
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 :-[
Title: Re: SOLVED: Chars PPC using Character* variable
Post by: dayowlron on Thu 20/04/2017 21:38:51
Glad you got it working
Title: Re: SOLVED: Chars PPC using Character* variable
Post by: Khris on Sat 22/04/2017 12:32:33
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?