ChangeVariableAction

Ideas for Game Editor evolution.

ChangeVariableAction

Postby DilloDude » Thu Jan 26, 2006 9:48 am

I would like to have an action that is activated when a variable is changed,
for example:
Code: Select all
on ChangeVariable(health, decrease, any amount)>play a sound
. First value is the variable, then how it is changed (deacrease, increase, increase or decrease, set to), then by how much (any amount, 1, 2,etc.). This would be good as in the above example, to play a sound or animation when the health is decreased, and would probably be useful for other things. You could also set it to different amounts, so if the health variable is decreased by 1-5 it plays one sound, from 6-10 another and so on.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby marathon332 » Thu Jan 26, 2006 1:39 pm

I second that request.

Having a variable update feature would make things more event driven and reduce the need to monitor variables with the draw actor event.

That should reduce the processor load, shouldn't it?

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Postby Kodo » Thu Jan 26, 2006 1:54 pm

But changing a variable and triggering an even is such an easy thing to do anyway. Say take health from your player character after it gets hit by a bullet you have to test for the collision, so why not just reduce the health and play the sound there, or call a subroutine that handles the event. If you were to put this new function in the global code it would need to check whether or not the relevant variable has changed on every frame instead of only when theres a collision between 2 objects, which would make the cpu load worse, wouldnt it?
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Postby Game A Gogo » Thu Jan 26, 2006 8:43 pm

i tink the feature that dilo dude is asking is already implent.

just to this
ex:
Code: Select all
if ( [your variable] == [The number or phrase that you want wwhen the action will be activated])
{
      [the action taken]
}


if this is not what your looking for, sorry.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby DilloDude » Thu Jan 26, 2006 9:03 pm

Game a Gogo wrote:
Code: Select all
if ( [your variable] == [The number or phrase that you want wwhen the action will be activated])
{
      [the action taken]
}


Sounds good, I might try that!
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby DilloDude » Thu Jan 26, 2006 9:20 pm

I got it working using an if statement in the health display's draw actor. I have it so it is activated before the textNumber is updated, so now my draw actor for Health looks like this:
Code: Select all
if (health > 100)
{
    health=100;//the health should not get greater than 100
}
if (health<0)
{
    MoveTo("Nindill", savx, savy, 5000.000000, "Game Center");
    health=100;// have an action when health is less than 0
}
if (health<textNumber)
{
    //have an action when you get hurt.(no acton yet)
}
textNumber=health;
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest