Page 1 of 1

new attribute heat should have effect on health

Posted: Mon Jan 08, 2007 11:19 pm
by stvsteve
hi there!

I have added the Attribute 'heat' to my Player. It starts at 0 and counts up to 100.
When it reaches 100 it should reduce the Players health to 0 (or simply kill him ^^). Can somebody tell me how to do this?
I tried to add a pawn with the following script:

{Start[()
{
if(GetAttribute("heat", "Player") > 99){
SetAttribute("health", 0, "Player);
}
Delay(IDLE, 5, "");
RestartOrder();
}
]
}

it is meant to check every 5 seconds if the 'heat' attribute of the Player is 100 and if so, the player should die.
Anyway it doesnt work that way. Any ideas how to solve that problem or maybe an easier way to have the same effect?

thx for your help and ideas!

Posted: Tue Jan 09, 2007 2:50 am
by jonas
do you have another script or something adding heat to the attribute? if not you might want to have a levelcontroller script that makes the attribute increase when he touches something that is hot.

Posted: Tue Jan 09, 2007 4:56 am
by stvsteve
hi!

Im sorry, i think i sound noobish... ^^
I added a heat attribute to the player.ini . I even have a heatbar ingame that shows me my current heat.
i have no idea what a levelcontroller script is, or how i could use something like that. :oops:
making the heat increase is not the problem (i simply added a changeattribute entity to the level that triggers when i access a certain area).
The problem is that something... no ANYTHING should happen when heat is 100 (full) (something like restart the level, die, teleport to a certain point...)
Im sorry, im such a noob... but can you explain in easy to understand for me, how i can add a script or anything that works to my level?

sorry again for my noobishness and thanx for your patience. :lol:

Posted: Tue Jan 09, 2007 12:04 pm
by QuestOfDreams
SetAttribute("health", 0, "Player);

is missing a quotation mark ->

SetAttribute("health", 0, "Player");

Posted: Tue Jan 09, 2007 12:37 pm
by stvsteve
thats right ^^
but still no idea how to make this work..

Posted: Tue Jan 09, 2007 1:48 pm
by stvsteve
i finally found a way! thx for your help!

{
Start[ ()
{
Console(true);
AddTriggerOrder("Check", "heat", 0);
} ]
Check[ ()
{
if(GetAttribute("heat", "Player") = 100) {
ModifyAttribute("health", -100, "Player");
}
Delay("", 1, "");
AddTriggerOrder("Check", "heat", 0);
} ]
}

When heat is 100 and the player triggers the hot area he dies.
I put it in a 'robot' pawn... I dont know if thats necessary, but i wont change it. (First rule of informatics: never touch a working System :D , i'll simply hide that guy somewhere :wink: )

Posted: Tue Jan 09, 2007 5:03 pm
by Juutis
The best way to hide a pawn is to add PawnRender(false) to the script. This way the pawn isn't rendered at all.
And you don't have to think where to place it in the level. :wink: