SetAttribute question

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
Ransom
Posts: 30
Joined: Sat Jan 14, 2006 7:16 pm

SetAttribute question

Post 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?
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Post by bernie »

remove the quotes from around the 1.
as below:

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

that should sort it out for you.
User avatar
Ransom
Posts: 30
Joined: Sat Jan 14, 2006 7:16 pm

Post by Ransom »

Yeah, tried that... also tried using a variable name which was set to 1, but I still get the same results.
User avatar
Ransom
Posts: 30
Joined: Sat Jan 14, 2006 7:16 pm

Post 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).
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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 ... :(
Pain is only psychological.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

Did you give the pawn the Attributwe with the AddAttribute command first?
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Yes... I tried basically everything but couldn't make them work :(
Pain is only psychological.
User avatar
Ransom
Posts: 30
Joined: Sat Jan 14, 2006 7:16 pm

Post by Ransom »

Did you give the pawn the Attributwe with the AddAttribute command first?
Yes. A GetAttribute("YouDidn'tAddthisAttribute") will return a zero.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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:
Pain is only psychological.
Post Reply