Transformation via score or via location

Metal Hero

New member
Hello guys. Sorry if this question is stupid. I am totally new to this engine and I have some queestions.

I downloaded the Beats of Power, the power rangers game and I saw that the characters are transforming via a weapon system. My questions ae the following.

Is it possible to make a character transform when it reaches a certain point of the map? If so, how can I make it?

Is it possible to make a character transform when a certain score bar reaches the limit? For example the players keep killing the enemies, this will count points that will make a score bar grows. When the bar is full the character will transform.


Thanks
 
Don't worry about it Metal Hero, it's not stupid question :D

Is it possible to make a character transform when a certain score bar reaches the limit?

There's a script to do that:
Code:
anim	idle
@script
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    int PScore = getplayerproperty(PIndex, "score");

    if(frame>1 && PScore>=2000){
      performattack(self, openborconstant("ANI_FOLLOW1"));
    }
@end_script

This script will forcefully change player's animation to FOLLOW1 when his/her score has reached 2000. In FOLLOW1 animation there's command to do the transformation, using this command:
Code:
weaponframe 1 1

It means, player will transform into 1st weapon model at 2nd frame

Is it possible to make a character transform when it reaches a certain point of the map?

Yes. I can alter the code above a bit to use global variable instead of score to check before transforming

The question is: will the transformation be permanent i.e carried to next levels?
 
Bloodbane said:
Don't worry about it Metal Hero, it's not stupid question :D

Is it possible to make a character transform when a certain score bar reaches the limit?

There's a script to do that:
Code:
anim	idle
@script
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    int PScore = getplayerproperty(PIndex, "score");

    if(frame>1 && PScore>=2000){
      performattack(self, openborconstant("ANI_FOLLOW1"));
    }
@end_script

This script will forcefully change player's animation to FOLLOW1 when his/her score has reached 2000. In FOLLOW1 animation there's command to do the transformation, using this command:
Code:
weaponframe 1 1

It means, player will transform into 1st weapon model at 2nd frame

Is it possible to make a character transform when it reaches a certain point of the map?

Yes. I can alter the code above a bit to use global variable instead of score to check before transforming

The question is: will the transformation be permanent i.e carried to next levels?

Hi Bloodbane. Any ideas how to do it with a level point? Or maybe you could tell me how to find the information?

Thanks very much!
 
As I posted above, you need to use global variable. Here's altered script for that:

Code:
anim	idle
@script
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    int PScore = getplayerproperty(PIndex, "score");
    int Tr = getglobalvar("Trans");

    if(frame>1 && Tr==1){
      performattack(self, openborconstant("ANI_FOLLOW4"));
    }
@end_script
...

Unlike the one for score, this one is activated by value of global variable called "Trans"
To set that variable in a level or certain point,  simply declare script like in this example:
Code:
spawn	Barrel # any entity will do
@script
void main()
{
    setglobalvar("Trans", 1);
}
@end_script
...
at 500

In this example, the variable is set to trigger transformation at scroll position 500. You have to ensure this entity is spawned to ensure the transformation
Since the variable is global, it can be read by other players as well

the transformation must not be permanent. It is just until the end of the level.

Hmmm...  global variable persists through levels and even menu so you'd need to reset the value using endlevel script like this:
endlevel.c
Code:
void main()
{
  setglobalvar("Trans", NULL());
}

Save this script as endlevel.c and place it in data/scripts folder

If the transformation is score based, it would be tough to cancel transformation since player's score is also persistent. Of course, there's a script to reset score but would you want to lose score?
 
Hello Bloodbane.


I think the solution triggered by level location is more elegant than the score (since that with score we would need to reset it).

I will test the suggestion you gave me.



Thanks very much!!
 
Back
Top Bottom