• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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,201
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