• 🏆 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!

I want to ask a trigger

Status
Not open for further replies.
Level 7
Joined
Oct 3, 2014
Messages
657
Hi, all :)
I want to know how to create a trigger when:

A player have a quest, it said that player 1 must kill 150 bandits (including Rogue, Enforcer, Spear Thrower, etc...) And then when a unit owned by player 1 kills a bandit/Rogue/Enforcer/etc there will be a Game text showing "Bandits Killed = 1/150" then a unit owned by player 1 kills another bandit/Rogue/Enforcer/etc there will be a Game text showing "Bandits Killed = 2/150"

This trigger will stop when Bandits that player 1 killed are already 150
 
[trigger=]
Untitled Trigger 002
Events
Unit - A unit Dies
Conditions
(Owner of (Killing unit)) Equal to Player 1 (Red)
questobjectiveinteger Greater than 0
Actions
-------- initial value was set to 150 in the variable editor/manager --------
Set questobjectiveinteger = (questobjectiveinteger - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
questobjectiveinteger Less than or equal to 0
Then - Actions
Game - Display to (All players) the text: Congratulations Pla...
Else - Actions
[/trigger]
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Dat-C3 method should work, however :

The bandits should be stored in the group or checked if it's a bandit, else the kills count all units that the player kills.

That is pretty obvious but he didn't add that because that depends on what you have to kill.
All other stuff can be used again, and again, and again.

However it is not MPI nor MUI. (Didn't expect the latter anyway.)
You should make an array instead and use GetPlayerId() or "Number of player" as index.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
So it would work for multiple players.

MUI = Multi Unit Instanceable
This means that this spell/system will work for every unit created.

MPI = Multi Player Instanceable
This means that this spell/system can be used by all players at the same time but only once per player at the same time.
 
Level 7
Joined
Oct 3, 2014
Messages
657
This :eek:gre_hurr_hurr:
A player have a quest, it said that player 1 must kill 150 bandits (including Rogue, Enforcer, Spear Thrower, etc...) And then when a unit owned by player 1 kills a bandit/Rogue/Enforcer/etc there will be a Game text showing "Bandits Killed = 1/150" then a unit owned by player 1 kills another bandit/Rogue/Enforcer/etc there will be a Game text showing "Bandits Killed = 2/150"

This trigger will stop when Bandits that player 1 killed are already 150


flag.gif
Missions of the Past
challenge.gif
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
That trigger simulates a simple quest objective.
Because it is a quest objective, the trigger is only on when the quest is active.
The quest objective is "Kill 150 orcs." (Orcs being Peons, Grunts, Shamans and Raiders. (for example))

So you need a trigger.
Event -> A unit dies.
Condition -> Triggering unit is a Peon or Grunt or Shaman or Raider. (Triggering unit is an Orc.)
Action ->
If QuestAccepted is equal to true Then
- Set AlreadyKilled = AlreadyKilled + 1
If AlreadyKilled is greater than or equal to RequiredKills Then
- Set AlreadyKilled = RequiredKills
- Complete Quest/Questobjective

This is a little bit different than what Dat-C3 said because this one also keeps track of how much units you have killed and how many you needed in total. This can be used for a progress bar that displays how far you have completed the quest... or just display it in text :D
The condition and QuestAccepted should be different for each quest.
Put in the conditions the people you have to kill.
The QuestAccepted is more like "Quest___Kill_These_Orcs___Active"

If you want more players to be able to play at the same time, you need to put varying variables in a array.
Event -> A unit dies.
Condition -> Triggering unit is a Peon or Grunt or Shaman or Raider. (Triggering unit is an Orc.)
Action ->
Set Player = Owner of Killing Unit
Set Id = Number of Player
If QuestAccepted[Id] is equal to true Then
- Set AlreadyKilled[Id] = AlreadyKilled[Id] + 1
If AlreadyKilled[Id] is greater than or equal to RequiredKills Then
- Set AlreadyKilled[Id] = RequiredKills
- Complete Quest/Questobjective for Player

If you want multiple units to be able to do the quest at the same time (counting the kills separately for each unit.)
You have to save the data separately for each unit. So you need an indexer or hashtable.
This is not really what you need and is quite complex.. so I won't explain that :D

btw the big text size hurts my eyes... you will pay for that!
 
Status
Not open for further replies.
Top