HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hrmmm I can't get my trigger to fire...

09-20-2005, 01:15 AM#1
DCDW
Basically the Trigger is designed to keep track of his hero stats everytime he levels up... basically he gets +3 to stats everytime he levels up, so it works and all, as long as it's a single level, but on a test unit I have setup to test how it handles when the hero gains 5+ levels after the kill, it won't fire... Anyhow here's what I have.

Events:
Unit - "Hero" Gains a level
Condition - Empty
Action -

If all (conditions) are true then do (Then Actions) Else do (Else Actions)+
-If Conditions: Owner of leveling hero equal player 1 red
-Then Actions: Set Herostats = Herostats + 3
Display to player 1 red "Hero has gained a level! +3 to stats"
-Else Actions: Do nothing
-Wait 1.75 seconds

I Added the wait trigger later figuring it need a bit more time between firing... but to no avail. Basically I have an ability that increases their stats and when it goes back to normal he has to reset back to "Herostats". Like I said, it keeps track of it all when it's just 1 level at a time, but should there be multiple levels gained then thats different.
09-20-2005, 09:27 AM#2
Anitarf
That's how the event works... it launches once whenever a hero gains level(s), doesn't matter how many he gains, though. You can always store the hero's level in the end of the trigger, and the next time he levels up, you compare his current level with the stored one, and you'll know how much he leveled.

Alternatively, you don't even need to keep track of his stat, if it goes up 3 per level, you can always calculate it by checking what the hero's level is, there's no need to keep track of it (or at least, no need to keep track of how it increases with level).
09-20-2005, 08:21 PM#3
Gandalf2349
Basically what he's saying is that if you go up 5 levels the trigger fires once, not quintuply(?) (5 times.)

So what he said is you just take your starting attribute, i.e. strength starts at 18, and just make a linear equation, so when you go up a level you set strength to (level - 1)*3 + 18.

That's all fine and dandy unless you get tomes involved.

Your best bet is to do this. I'm assuming this is an RPG with one hero, and not many, otherwise we're going to need adjustments.

Quote:
Variables
-HeroLevel[12] as Integer = 1
-LevelsGained as Integer

[quote]Trigger
-Events
--Unit - "Hero" Gains a Level
-Conditions
-Actions
--Set LevelsGained = (Current Level of (Triggering Unit) -(minus) HeroLevel[Player Number of (Owner of (Triggering Unit))])
--Set all Stats to Hero - Current Stat + ((LevelsGained) * 3)
--If/Then/Else
---Conditions
----LevelsGained is equal to 1
---Then
----Display to (Owner of (Triggering Unit)) "Hero has gained a level! +3 to all stats!"
---Else
----Display to (Owner of (Triggering Unit)) ((("Hero has gained " + Levels Gained) + (" levels! +" + (LevelsGained * 3))) + " to all stats!")