New, need script help.

Cadwae

New Member
Reaction score
0
Hi, I'm doing a level for my game design class and can't figure out how to make the game end in victory when the player destroys a certain unit. Been trying many event and conditions but can't seem to make it work. Any help would be very much appreciated.
 

tooltiperror

Super Moderator
Reaction score
231
Hi, I'm doing a level for my game design class and can't figure out how to make the game end in victory when the player destroys a certain unit. Been trying many event and conditions but can't seem to make it work. Any help would be very much appreciated.​

Welcome to the forum, Cadwae!

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to (Your Unit)
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Game - Victory (Picked player) (Show dialogs, Show scores)


Like that?
 

Xajz

New Member
Reaction score
0
1440046141_11022009_1.png
 

Sarj14

New Member
Reaction score
9
Both will work, but using ToolTipError's trigger will basically mean that all players are on the same team. While using Xajz's trigger you will need to add the players to the actions.
 

Cadwae

New Member
Reaction score
0
Yeah, that worked, as long as it ends the game. Thanks so much for your help guys.
 

tooltiperror

Super Moderator
Reaction score
231
Both will work, but using ToolTipError's trigger will basically mean that all players are on the same team. While using Xajz's trigger you will need to add the players to the actions.

But, mine leaks. Here's a fix.

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to No unit
    • Actions
      • Set TempGroup = (All players)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Game - Victory (Picked player) (Show dialogs, Show scores)
      • Custom script: call DestroyForce( udg_TempGroup )


Fixed, leakless.

Replace:
Trigger:
  • Set TempGroup = (All Players)

with

Trigger:
  • Set TempGroup = (All allies of (Owner of (Killing unit)))


If you want.
 

jomik

New Member
Reaction score
17
If the unit is preplaced, you might aswell use a specific unit event, instead of a generic one. But not that important :O
 

tooltiperror

Super Moderator
Reaction score
231
Destroying it will mess everything up.​

Like what?

It's a temp group, so once it serves it's purpose it's not needed anymore.
 

Summoned

New Member
Reaction score
51
Destroying All Players, even in a temporary variable, tends to completely destroy the force for some reason or other. If you try to use All Players in another trigger after destroying it, it won't work.
 

tooltiperror

Super Moderator
Reaction score
231
Destroying All Players, even in a temporary variable, tends to completely destroy the force for some reason or other. If you try to use All Players in another trigger after destroying it, it won't work.​

Never heard of that, but I'll take your word for it.
 

jomik

New Member
Reaction score
17
Destroying All Players, even in a temporary variable, tends to completely destroy the force for some reason or other. If you try to use All Players in another trigger after destroying it, it won't work.


Yup this is true, I tried it, took me long to figure that was the problem :p - You can test it out :D Just destroy (All players) in the beginning of the map, wait a few seconds, and then show something to all players.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top