• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Reseting score in multiboard

Status
Not open for further replies.
Level 4
Joined
Dec 5, 2011
Messages
75
Hi guys im having troubles making a trigger to reset a score
i got a multiboard that set exp for every killed unit but i need the XP reset to 0 after it is greater or equal to 100 like this :
(exp is integer variable not exp from the game)

XP ->killed unit gives +20 exp -> XP
80 ----------------------------> 0

or

XP ->killed unit gives +40 exp -> XP
88 ------------------------------>0

i tried:
if XP(variable) greater or equal to 100
multiboard set the text ...XP...to 0

but it only reset after the next XP i get after 100 and it stays static to 0,doenst go up anymore:

XP --> killed unit gives +20exp ->XP -> killed unit gives +20 exp-> XP
80 ---------------------------->120 ---------------------------->0(static)

help please!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
I advise decoupling the multiboard system from the exp system for better cohesion.

Anyway the behaviour you explain is because your script makes no sense.

Here is pesudo code for what the system should do.

ENTRY when unit should gain EXP
1. Raise EXP by earned amount
2. If EXP greater than 100
2.true.1. LEVEL UP!!! (or whatever you want to happen at 100 exp)
2.true.2. set EXP to 0
3. Update display value for experience to EXP

key features of this script structure
* Centeral place where EXP is added
* Range restriction on EXP is enforced after every change
* Only 1 place of coupling with the experience display procedure

Maker, your method is less efficient than my described pesudocode as you perform addition twice in most cases where it only is needed once.
 
Level 4
Joined
Dec 5, 2011
Messages
75
hi dr super good the way you explained worked!! the problem was setting the XP variable to 0
can admin put this thread solved? thanks!!
 
Status
Not open for further replies.
Top