new attribute heat should have effect on health

Topics regarding Scripting with Reality Factory
Post Reply
stvsteve
Posts: 14
Joined: Wed Jan 03, 2007 11:29 pm

new attribute heat should have effect on health

Post 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!
I need this for my academic studies. Plz help ;)
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

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

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
stvsteve
Posts: 14
Joined: Wed Jan 03, 2007 11:29 pm

Post 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:
I need this for my academic studies. Plz help ;)
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

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

is missing a quotation mark ->

SetAttribute("health", 0, "Player");
stvsteve
Posts: 14
Joined: Wed Jan 03, 2007 11:29 pm

Post by stvsteve »

thats right ^^
but still no idea how to make this work..
I need this for my academic studies. Plz help ;)
stvsteve
Posts: 14
Joined: Wed Jan 03, 2007 11:29 pm

Post 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: )
I need this for my academic studies. Plz help ;)
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

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