HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

string value type thingy

08-13-2002, 06:53 AM#1
Duh
Need to know what Event/Conditions needed to make a trigger count kills then give units for a certain amount.

Its like I kill 5 Creeps, Create 1 Footman at bleh. Its a continuous trigger that happens for every 5 kills. Then later on it changes to every 10 kills, afterwards every 15 kills and so on.

Need more info?
08-13-2002, 07:45 AM#2
Guest
Make a new variable called KilledCreeps (an integer) with default 0, a variable (integer) called CreatedFootmen with default 0 and a region called SpawnRegion.

Now make a trigger:
Event
-Unit owned by Neutral Hostile dies <- This is a "Unit - Player Owned Unit Event"
Condition
-(Owner of Killing Unit) Equal To Player Y (=your player) <- This is a "Player Comparison"
Action
-If <- Use an If, then, else action here
(KilledCreeps mod <- Math - Modulo
(5 * <- Arithmetic
(CreatedFootmen + 1))) <- Arithmetic
Equal to 0 <- Integer comparison
Then
Create 1 Footman for Player Y (=your player) at (Center of SpawnRegion) facing Default building facing <- Unit - Create Unit Facing Angle
Else
Do nothing <- Do Nothing action
-Set KilledCreeps to (KilledCreeps + 1) <- Set Variable and Arithmetic
->Copy the whole If, then, else thing and set THEN to:
Set CreatedFootmen to (CreatedFootmen + 1)

Sounds complicated, but should work.

HOW it works:
>Unit - Player Owned Unit Event
This simply says that a unit owned by the neutral player (=a creep) has to die for this trigger to be activated
>Player Comparison
This is to be sure the righ guy gets the Footman. It checks WHO killed the unit.
>If, then, else
This is an important part because only this way you can be sure the player only gets the footman if he has killed 5*x creeps
>Integer comparison
Compares a certain value with another one. Basically it checks if the amount of killed creeps divided by 5*createdfootmen is a straight number.
>Math - Modulo
Said mathematic function
>Arithmetics
These should make the divisor increase - this way it goes per 5, then per 10, then per 15, etc. kills
>Unit - Create Unit Facing Angle
Creates the unit
>Do Nothing
If he doesn't have the required kills, don't do nothing.
>Set Variable
Updates the amount of killed creeps.
08-13-2002, 08:07 AM#3
Guest
Here what the whole trigger should look like afterwards:
+Events
->Unit - A unit owned by Neutral Hostile dies
+Conditions
->(Owner of Killing Unit) Equal To Player Y
+Actions
->If (killedcreeps mod (5 * (CreatedFootmen + 1))) Equal To 0 Then Create 1 Footman for Player Y at (Center of SpawnRegion <gen>) facing Default building facing, Else Do nothing
->Set KilledCreeps to (KilledCreeps + 1)
->If (killedcreeps mod (5 * (CreatedFootmen + 1))) Equal To 0 Then Set CreatedFootmen to (CreatedFootmen + 1), Else Do nothing

At least I think so...
08-13-2002, 08:49 AM#4
Duh
Interesting, but I should rephrase how I want the count to be. Its like for a set:

5 kills = 1 unit
5 kills = 1 unit
5 kills = 1 unit
5 kills = 1 unit
5 kills = 1 unit
Then switches to:
10 kills = 1 unit
10 kills = 1 unit
10 kills = 1 unit
10 kills = 1 unit
10 kills = 1 unit
etc

Each Set goes on about 10 times a piece, give or take with balancing. Basically as the game gets into the harder levels, the number of kills needed to produce a unit goes up. If I'm reading your post correctly its saying:

5 kills = 1 unit
10 kills = 1 unit
15 kills = 1 unit
etc

It adds the new set right after the last one, making it rise the bar too quickly.

I could probably make it dertermined on what monster(type/level) is killed for each set? So for level 1 Creeps will require 5 kills for 1 unit while level 2 Creeps will require 10 kills for 1 unit?
08-13-2002, 09:46 AM#5
Guest
Quote:
Originally posted by FickDich
->If (killedcreeps mod (5 * (CreatedFootmen + 1))) Equal To 0 Then Create 1 Footman for Player Y at (Center of SpawnRegion <gen>) facing Default building facing, Else Do nothing
->Set KilledCreeps to (KilledCreeps + 1)
->If (killedcreeps mod (5 * (CreatedFootmen + 1))) Equal To 0 Then Set CreatedFootmen to (CreatedFootmen + 1), Else Do nothing

Change the (killedcreeps mod (5 * (Created Footmen + 1))) to (killedcreeps mod (5 * ((Created Footmen + 1) / 10)))
I think that should do it. As integers are only straight numbers it should round that automatically. However I'm not sure in that case.