HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Creep Experience

04-10-2007, 04:16 AM#1
Hsinker
When the neutrals on my map die, they dont give exp =/

I tried writing a trigger but i cant do the action part. What i have is.
Trigger:
Untitled Trigger 001
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Owner of (Triggering unit)) Equal to Neutral Hostile
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
I have 3 types of neutrals each obviously giving different amounts of exp.


Secondly, the creeps dont give up after awhile in a chase and chase you to across the map.
Is there like a trigger to stop this cause i tried adjusting their stats and that such as range and acquisition, maybe something like when they move a certain distance from their starting positions, theyre ordered back to their starting position.
04-10-2007, 06:05 AM#2
Av3n
... firstly creeps (hostile) are A.I hardcoded to retreat there are two options when you select a unit normally(on map) there are 2 options i believe and also there are an value in gameplay constants that you can change as well tht affect the retreating thing. they come under creeps section there are a buch a values tht you can change.

-Av3n
04-11-2007, 06:08 AM#3
Ignitedstar
Huh? I don't get it. What do you want us to help you with in your trigger? Do you want to manually give experience to heroes through triggers?

If that's the case, then you need two variables. To be more precise, an integer array with a size of 2(zero counts) since you want three neutral players giving different amounts of experience and a group. A group, because you'll need group of heroes to give the experience to. Name the integer variable something like "HeroExpGive" and the group "ExpGroup" or something so they're easy to recognize. So set the variables like this:

Trigger:
set ExpGroup = ...
set HeroExpGive[0] = ...
set HeroExpGive[1] = ...
set HeroExpGive[2] = ...

Then you just have to set them as needed. For the group, we'll only want heroes to divide the experience by AND we only want heroes that are enemies of the dying unit. Then we need to set a certain range of how far the heroes will need to be to get the amount of experience. I'll use 1500; You can use whatever you want(If you want the ranges to be different for each neutral player, make the group variable an array, too).

Trigger:
Set EXPGroup = (Units within 1500.00 of (Position of (Dying unit)) matching ((((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True) and (((Matching unit) is A Hero) Equal to True)))

For pure example, if you want HeroExpGive[0] to give exp. equal to the creep's level and HeroExpGive[1] to give exp. equal to two times the creep's level, and then you want HeroExpGive[2] to give exp. equal to five times the creep's level, then...
Trigger:
set HeroExpGive[0] = Level of (Dying Unit)
set HeroExpGive[1] = (2 x (Level of (Dying Unit)))
set HeroExpGive[2] = (5 x (Level of (Dying Unit)))

Now, all we have to do is set up the conditions. I think it's better to use If/Then/Else Multiple Functions.

Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Dying unit)) is equal to (Neutral Player #1)
Collapse Then - Actions
Collapse Unit Group - Pick every unit in EXPGroup and do (Actions)
Collapse Loop - Actions
Hero - Add (HeroExpGive / (Number of units in EXPGroup)) experience to (Picked unit), Show level-up graphics
Collapse Else - Actions
Do nothing

We'll repeat that trigger above for the two other neutral players. Now, let's put everything all together into one, complete trigger.

Trigger:
Giving Experience to Heroes
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Set EXPGroup = (Units within 1500.00 of (Position of (Dying unit)) matching ((((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True) and (((Matching unit) is A Hero) Equal to True)))
Set HeroExpGive[0] = Level of (Dying Unit)
Set HeroExpGive[1] = (2 x (Level of (Dying Unit)))
Set HeroExpGive[2] = (5 x (Level of (Dying Unit)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Dying unit)) is equal to (Neutral Player #1)
Collapse Then - Actions
Collapse Unit Group - Pick every unit in EXPGroup and do (Actions)
Collapse Loop - Actions
Hero - Add (HeroExpGive[0] / (Number of units in EXPGroup)) experience to (Picked unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Dying unit)) is equal to (Neutral Player #2)
Collapse Then - Actions
Collapse Unit Group - Pick every unit in EXPGroup and do (Actions)
Collapse Loop - Actions
Hero - Add (HeroExpGive[1] / (Number of units in EXPGroup)) experience to (Picked unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Dying unit)) is equal to (Neutral Player #3)
Collapse Then - Actions
Collapse Unit Group - Pick every unit in EXPGroup and do (Actions)
Collapse Loop - Actions
Hero - Add (HeroExpGive[2] / (Number of units in EXPGroup)) experience to (Picked unit), Show level-up graphics
Collapse Else - Actions
Do nothing

You don't need to clean up global variables and it's as close to MUI as GUI triggers can get, because all variables are declared at the beginning of the trigger and there are no wait functions, so the trigger should work fine(can't test it; it's too late for me and it's a school night).

If I did that no reason, oh well. And I'm absolutely sure that there's a way to clean up that trigger I just made. Oh well for that, too. I know that you guys say that we shouldn't do everything for the beginners, but we all started that way. Everytime I see these kinds of questions, I get a nostalgic feeling of the past.