SOLVED Score in generic Portals

dantedevil

Well-known member
I try to use a generic portal llike an item, and give the player a score when touch the icon portal.
Code:
name       Portal
nomove      1
type       none
nolife     1
score      0 -1
antigravity     100
candamage     player
setlayer      100

anim idle
   loop   1
   delay   50
        followanim 1
        followcond 1
   offset   13 27
   attack   1 2 32 26 0 0 1 1
   noreflect   1
        hitfx   data/sounds/silent.wav
   frame   data/chars/misc/arrowr.png
   frame   data/chars/misc/empty.gif

anim follow1
   delay   50
   offset   13 27
   frame   data/chars/misc/arrowr.png
        @cmd    jumptobranch "Branch1" 1
   frame   data/chars/misc/empty.gif
   frame   data/chars/misc/arrowr.png

My portal is similar to this generic portal of Bloodbane.
In my mod after defeat a boss, a coin fall in the middle of the screen.
This coin is the portal and I want this coin give a certain score when you touch the icon. I try with some chenges but not work.
 
Solution
Okay then, here's the updated portal:

name      Portal
nomove      1
type      none
nolife    1
score      0 -1
antigravity    100
candamage    player
setlayer      100

anim idle
  loop  1
  delay  50
        followanim 1
        followcond 1
  offset  13 27
  attack  1 2 32 26 0 0 1 1
  noreflect  1
        hitfx  data/sounds/silent.wav
  frame  data/chars/misc/arrowr.png
  frame  data/chars/misc/empty.gif

anim follow1
@script
  if(frame==1){
    void target = getlocalvar("opponent");

    int PIndex = getentityproperty(target,"playerindex"); // Get player's index
    int PScore = getplayerproperty(PIndex, "score");
   
    changeplayerproperty(PIndex, "score", PScore+107);
  }
@end_script
  delay  50...
There are two ways to achieve that:
1. Use item to replace this and use didhitscript. You can set subtype touch to make the item picked on touch later
2. Update this portal or coin to give score to player touching it

Which one do you prefer?
 
Bloodbane said:
There are two ways to achieve that:
1. Use item to replace this and use didhitscript. You can set subtype touch to make the item picked on touch later
2. Update this portal or coin to give score to player touching it

Which one do you prefer?

I think the second option is the best .
Thanks my friend!

 
Okay then, here's the updated portal:

name      Portal
nomove      1
type      none
nolife    1
score      0 -1
antigravity    100
candamage    player
setlayer      100

anim idle
  loop  1
  delay  50
        followanim 1
        followcond 1
  offset  13 27
  attack  1 2 32 26 0 0 1 1
  noreflect  1
        hitfx  data/sounds/silent.wav
  frame  data/chars/misc/arrowr.png
  frame  data/chars/misc/empty.gif

anim follow1
@script
  if(frame==1){
    void target = getlocalvar("opponent");

    int PIndex = getentityproperty(target,"playerindex"); // Get player's index
    int PScore = getplayerproperty(PIndex, "score");
   
    changeplayerproperty(PIndex, "score", PScore+107);
  }
@end_script
  delay  50
  offset  13 27
  frame  data/chars/misc/arrowr.png
  frame  data/chars/misc/empty.gif
        @cmd    jumptobranch "Branch1" 1
  frame  data/chars/misc/arrowr.png

Text in green is the score gained from touching this portal, modify it to suit your need

HTH
 
Solution
Back
Top Bottom