Page 1 of 1

SetAttribute question

Posted: Sat Jan 14, 2006 7:56 pm
by Ransom

Code: Select all

	if(GetAttribute("Ladder","Recon") != 1)
		{
		SetAttribute("Ladder","1","Recon");
		}
	}
Why does this set the attribute to 774963301 instead of 1?

Posted: Sat Jan 14, 2006 8:10 pm
by bernie
remove the quotes from around the 1.
as below:

SetAttribute("Ladder", 1 ,"Recon");

that should sort it out for you.

Posted: Sat Jan 14, 2006 8:39 pm
by Ransom
Yeah, tried that... also tried using a variable name which was set to 1, but I still get the same results.

Posted: Sun Jan 15, 2006 2:19 pm
by Ransom
Well, I got what I wanted by using a Player Attribute instead of a pawn's attribute, but I still don't understand where that 774963301 came from. What is interesting is that it always returned that number, until I tried a different pawn/attribute. Then it generated a new number (still nine digits long) which was always the same for that pawn... ? Only the Player Attribute gives exactly what I want (i.e. a 1 or a 0).

Posted: Mon Jan 16, 2006 2:30 pm
by Juutis
I've had that problem too... really weird numbers come when using the SetAttribute/GetAttribute commands. I tried to get pawns to check what kind of projectile hit them by using different attributes but it didn't work out ... :(

Posted: Mon Jan 16, 2006 3:42 pm
by QuestOfDreams
Did you give the pawn the Attributwe with the AddAttribute command first?

Posted: Mon Jan 16, 2006 4:12 pm
by Juutis
Yes... I tried basically everything but couldn't make them work :(

Posted: Tue Jan 17, 2006 2:05 am
by Ransom
Did you give the pawn the Attributwe with the AddAttribute command first?
Yes. A GetAttribute("YouDidn'tAddthisAttribute") will return a zero.

Posted: Tue Jan 17, 2006 2:32 pm
by Juutis
It seems that you can add multiple attributes with the AttributeOrder() command ... but only only the last attribute acts as the health attribute. However, I managed to build a detection system for different kinds of projectiles.

But hey... if someone has got those AddAttribute/SetAttribute/GetAttribute commands working, please inform us. :wink: