- Joined
- Jul 27, 2015
- Messages
- 29
Hi there
Context: This trigger is meant to create a temporary dummy unit with hero abilities that the player can use to 'Spend talent points' similiar to an RPG. The number of points the player has in each talent is stored as levels of upgrades (A, B, C, D, E) in this case.
The dummy for talent spending will level these upgrades when it levels it's abilities, and the upgrades will be reset when the 'Tome of Retraining' ability is used - this is all handled in different triggers
I have two questions/problems:
1 - The trigger creates a lag spike when it is first run, future runs of the trigger do NOT, is there stuff here that I should/could be running at Map Initialization, I'm not sure what!
2 - Is there a more optimal way I could do this? I want to be able to call a function to autolevel the abilities up to the current upgrade amounts, but you can't reference a variable in the 'Hero - Learn Skill' action, otherwise I'd pass the specific talent abilities this way
Thanks in advance, trigger code below:
Thanks
Context: This trigger is meant to create a temporary dummy unit with hero abilities that the player can use to 'Spend talent points' similiar to an RPG. The number of points the player has in each talent is stored as levels of upgrades (A, B, C, D, E) in this case.
The dummy for talent spending will level these upgrades when it levels it's abilities, and the upgrades will be reset when the 'Tome of Retraining' ability is used - this is all handled in different triggers
I have two questions/problems:
1 - The trigger creates a lag spike when it is first run, future runs of the trigger do NOT, is there stuff here that I should/could be running at Map Initialization, I'm not sure what!
2 - Is there a more optimal way I could do this? I want to be able to call a function to autolevel the abilities up to the current upgrade amounts, but you can't reference a variable in the 'Hero - Learn Skill' action, otherwise I'd pass the specific talent abilities this way
Thanks in advance, trigger code below:
-
SlayerEntersOrderHall
-
Events
-
Unit - A unit enters slayerOrderHallFull <gen>
-
-
Conditions
-
((Triggering unit) is A Hero) Equal to True
-
-
Actions
-
Trigger - Turn off (This trigger)
-
Set tempLoc = (Position of [Configure Talents] SLAYER 0042 <gen>)
-
Unit - Create 1 Talents (Slayer) for (Owner of (Triggering unit)) at tempLoc facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_tempLoc)
-
Trigger - Turn on (This trigger)
-
Set tempUnit = (Last created unit)
-
Set tempInt = (Hero level of (Triggering unit))
-
Hero - Set tempUnit Hero-level to 20, Hide level-up graphics
-
Hero - Modify unspent skill points of tempUnit: Set to (Integer(((Real((Hero level of (Triggering unit)))) / 2.00))) points
-
For each (Integer tempInt) from 1 to (Current research level of TALENT A for (Owner of tempUnit)), do (Actions)
-
Loop - Actions
-
Hero - Learn skill for tempUnit: Slayer - Valour (Talent A)
-
Hero - Modify unspent skill points of tempUnit: Subtract 1 points
-
-
-
For each (Integer tempInt) from 1 to (Current research level of TALENT B for (Owner of tempUnit)), do (Actions)
-
Loop - Actions
-
Hero - Learn skill for tempUnit: Slayer - Leadership (Talent B)
-
Hero - Modify unspent skill points of tempUnit: Subtract 1 points
-
-
-
For each (Integer tempInt) from 1 to (Current research level of TALENT C for (Owner of tempUnit)), do (Actions)
-
Loop - Actions
-
Hero - Learn skill for tempUnit: Slayer - Discipline (Talent C)
-
Hero - Modify unspent skill points of tempUnit: Subtract 1 points
-
-
-
For each (Integer tempInt) from 1 to (Current research level of TALENT D for (Owner of tempUnit)), do (Actions)
-
Loop - Actions
-
Hero - Learn skill for tempUnit: Slayer - Survival (Talent D)
-
Hero - Modify unspent skill points of tempUnit: Subtract 1 points
-
-
-
For each (Integer tempInt) from 1 to (Current research level of TALENT E for (Owner of tempUnit)), do (Actions)
-
Loop - Actions
-
Hero - Learn skill for tempUnit: Slayer - Acrobatics (Talent E)
-
Hero - Modify unspent skill points of tempUnit: Subtract 1 points
-
-
-
Trigger - Turn on SlayerLeavesOrderHall <gen>
-
Trigger - Turn on SlayerTalentHandler <gen>
-
-
Thanks