Solved Can the same command execute different skills based on the player’s level?

Question that is answered or resolved.

kimduck

Member
Like the D&D wizard’s Magic Missile, is it possible to make it fire 4 projectiles at low level and 7 projectiles at high level?
For example, can it be set so that at low level it uses anim freeSpecial2, and at high level it uses anim freeSpecial22?
Also, is it possible to have no skill at low level, and then unlock a skill at a certain level (for example, being able to use freeSpecial10 when reaching level 10)?
I would appreciate it if you could explain how to do this.
 
Solution
Alright, I'll tell you how to do it. But before that, I should tell you that there's no default level counter or anything in the engine. Therefore, I'll be using global variable to represent level. The value stored in the variable is the current level. 2 examples below will be using X1 variable. You can use other variable but make sure to adjust related scripts.

1. Different animation based on level.
Code:
anim    freespecial3
@script
  if(frame==1){
    void self = getlocalvar("self");
    int Lvl = getglobalvar("X1");
    int CodAt1 = openborconstant("ANI_FOLLOW1");
    int CodAt2 = openborconstant("ANI_FOLLOW2");

    if(Lvl==2){
      performattack(self, CodAt2);
    } else if(Lvl==1){
      performattack(self, CodAt1);
    }
  }...
is it possible to make it fire 4 projectiles at low level and 7 projectiles at high level?
For example, can it be set so that at low level it uses anim freeSpecial2, and at high level it uses anim freeSpecial22?

It is possible. You need to check your current level at first frame of FREESPECIAL then decide whether to change animation or not.
IIRC in Rise of Warduke, there's one character whose skill changes after gaining certain item.

is it possible to have no skill at low level, and then unlock a skill at a certain level (for example, being able to use freeSpecial10 when reaching level 10)?

It is possible also. Though I might need to confirm if my method might work.
 
It is possible. You need to check your current level at first frame of FREESPECIAL then decide whether to change animation or not.
IIRC in Rise of Warduke, there's one character whose skill changes after gaining certain item.



It is possible also. Though I might need to confirm if my method might work.
I would appreciate it if you could explain how to write it.
 
Alright, I'll tell you how to do it. But before that, I should tell you that there's no default level counter or anything in the engine. Therefore, I'll be using global variable to represent level. The value stored in the variable is the current level. 2 examples below will be using X1 variable. You can use other variable but make sure to adjust related scripts.

1. Different animation based on level.
Code:
anim    freespecial3
@script
  if(frame==1){
    void self = getlocalvar("self");
    int Lvl = getglobalvar("X1");
    int CodAt1 = openborconstant("ANI_FOLLOW1");
    int CodAt2 = openborconstant("ANI_FOLLOW2");

    if(Lvl==2){
      performattack(self, CodAt2);
    } else if(Lvl==1){
      performattack(self, CodAt1);
    }
  }
@end_script
...

This script checks current level and changes animation based on that.
Lvl 0 = no change.
Lvl 1 = change to FOLLOW1.
Lvl 2 = change to FOLLOW2.

2. Locking/unlocking freespecial
Declare energycost command in respective FREESPECIAL like this:
Code:
anim    freespecial2
    delay    5
    offset    35 80
    energycost 0 0 -1
...

This command will lock this FREESPECIAL.
Then code this script:
skill.c:
C:
void main(){
  void self = getlocalvar("self");
  int Lvl = getglobalvar("X1");

  if(Lvl >= 1){
    changeentityproperty(self, "energycost", "disable", openborconstant("ANI_FREESPECIAL2"), 0);
  }
}

Declare it in the header like this:
Code:
thinkscript    data/scripts/skill.c

That script will unlock FREESPECIAL2 if level is 1 or higher.

BTW it is possible to use #1 above to do this but I rather to use this method.

HTH
 
Solution
자, 이제 방법을 알려드리겠습니다. 하지만 그 전에, 게임 엔진에는 기본 레벨 카운터 같은 것이 없다는 점을 말씀드려야겠네요. 그래서 레벨을 나타내기 위해 전역 변수를 사용할 겁니다. 이 변수에 저장된 값이 현재 레벨입니다. 아래 두 예제에서는 X1이라는 변수를 사용합니다. 다른 변수를 사용해도 되지만, 관련 스크립트를 수정해야 합니다.

1. 레벨에 따라 다른 애니메이션이 적용됩니다.
[암호]
애니메이션 프리스페셜3
@스크립트
프레임이 1이면
void self = getlocalvar("self");
int Lvl = getglobalvar("X1");
int CodAt1 = openborconstant("ANI_FOLLOW1");
int CodAt2 = openborconstant("ANI_FOLLOW2");

레벨이 2이면
performattack(self, CodAt2);
} 그렇지 않으면 Lvl==1인 경우{
performattack(self, CodAt1);
}
}
@end_script
...
[/암호]

이 스크립트는 현재 레벨을 확인하고 그에 따라 애니메이션을 변경합니다.
레벨 0 = 변화 없음.
레벨 1 = FOLLOW1로 변경.
레벨 2 = FOLLOW2로 변경.

2. 무료 스페셜 잠금/잠금 해제
다음과 같이 각 FREESPECIAL에 energycost 명령을 선언하십시오 .
[암호]
애니메이션 프리스페셜2
지연 5
오프셋 35 80
에너지비용 0 0 -1
...
[/암호]

이 명령은 FREESPECIAL을 잠급니다.
그런 다음 다음 스크립트를 작성하세요.
스킬.c:
C:
void main(){
  void self = getlocalvar("self");
  int Lvl = getglobalvar("X1");

  레벨이 1 이상이면
    changeentityproperty(self, "energycost", "disable", openborconstant("ANI_FREESPECIAL2"), 0);
  }
}
[/암호]

 헤더에 다음과 같이 선언하세요:
[암호]
thinkscript data/scripts/skill.c
[/암호]

 해당 스크립트를 실행하면 레벨이 1 이상일 경우 FREESPECIAL2가 잠금 해제됩니다.

 참고로 위 1번 방법을 사용해도 되지만 저는 이 방법을 선호합니다.

도움이 되셨으면 좋겠습니다.
[/QUOTE]
나중에 시도해 볼게요. 감사합니다.
 
Back
Top Bottom