Split Gold Trigger help.

Wark

Animal
Reaction score
27
Im looking for a trigger that splits all a leaving player's gold amugst his force, how would i do this? I tried to use the "spoilsofwar" trigger in the freetrigger code, but it doesnot work for some reason.
 
this might not be exactly....................

this might not be exactly right becaus ei don't have WEU in front of me
your gona have to make a variable at start
Trig 1
E: map inlis
C:
A: player group- pick every player in all players (picked players slot status = to a player is true) and do set goodplayers = picked player

Trig 2
E: a player leaves game
C:
A: if/then/else
C: leaveing player is equal to player1 red
A:player group- remove leaveing player from goodplayers
unit group- pick every unit in playabe map area owned by player one red and do change ownership to goodplayers

this is not correct but the best i can do without WEU

~:D


Edit: will add in the gold thing as soon as i get a comp with WEU
 
GoldSplit - Var of type Real
PlayingSlots - Var of type Group of Players

Code:
Event
    Map initialization
Condition
    None
Actions
    set (PlayingSlots) = (Player Group matching ((Matching Player) slot equals to (is playing))
Code:
Event
    A Player leaves
Condition
    (Leaving player) in (PlayingSlots)
Actions
    Remove (Leaving player) from (PlayingSlots)
    set (GoldSplit) = ((Leaving player)'s gold) / (Number of players in (PlayingSlots))
    Pick every player in (PlayingSlots) and do (Add (GoldSplit) gold to (Picked player))
 
AceHart said:
Oh, it will. I guess.
The condition isn't really needed.


You could alter it to only split among that player's allies for example.

ye thats what I want it to do.. hmm how would i do that?
 
AceHart is right, the condition in the code I wrote is always true
I didn't know it exactly, so I put it in the trigger
Anyhow, it does the work, doesn't it? :P
 
xPheRe said:
AceHart is right, the condition in the code I wrote is always true
I didn't know it exactly, so I put it in the trigger
Anyhow, it does the work, doesn't it? :P

ye thx so much for it, final brick to my game, I can finish it now.

Oh wait, so i woudlent even need the second variable or the first trigger? if i change PlayerSlots to Allies of Leaving player?

EDIT: im havign a problem with this line set (GoldSplit) = ((Leaving player)'s gold) / (Number of players in (PlayingSlots) i cant find where to set the variable to that, when the variable is Real type.
 
Well, you could say:

Set goldsplit = (gold of (leaving player)) / (number of players in (allies of (leaving player)))
Pick every player in (allies of (leaving player)) and ...


Now, hm, isn't "gold" an integer actually?
Can you have 0.14 Gold for example?
Where's an editor when you need one...

Anyway, whenever you may need to "mix" variable types, there's also, usually, a "function" called:
"Conversion - convert from <something> to <something else>".
 
Code:
Event 
Player 1 leaves the game
Player 2 leaves the game
Player 3 leaves the game..all the way down to player 8
Condition
none
Action

Game - Display to (All players) the text: ((Name of (Triggering player)) + has left the game. All of his/her gold will be split-up among his/her team.)

Set GoldSplit = ((Real(((Triggering player) Current gold))) / (Real((Number of players in (All allies of (Triggering player))))))

Now im having a problem in add (ugh) GoldSplit wont show up as a possible variable when I try to replace it with 1000:

Pick every player in (allies of triggering player) and do (add 1000 to (picked player)'s current gold
 
it onyl shows integer to real, not the other way around

EDIT: this is the trigger i used before, i dunno why it doesent work:

Code:
Event
Player 1 through 12 leaves
Condition
Action
Wait 3.00 seconds
Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) +  has left the game.)

Player Group - Pick every player in (All allies of (Triggering player)) and do (If (((Picked player) slot status) Equal to Is playing) then do (Player - Add (((Triggering player) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User
 
Event: Player 1 leaves the game
Player 2 leaves the game
.
.
.
Condition: Who needs em :)

Action: Remove (triggering player) from player group
Wait 0.01 second
Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + has left the game.)
Player Group - Pick every player in player group and do (Player - Add (((Triggering player) Current gold) / (Number of players in player group)


This should work, technically all it is removing the leaver from the player group (Active players) and giving all the active players in the game a equal amount of the amount of gold that the leaving player had.


NOTE: You need a trigger that adds all active players in the start of the game to a player group (I named it player group ) then this should work fine.
 
can player group be just "all allies of player1"? and another willbe "allies ofp layer 5" ??

But if they are removed, will they be unallied?
 
Trust me having a group with all the active plyaers in it can be very usefull in many areas and if you do 8it allies of a player that one player the others are allies of wont be included and that will also include non active players
 
Ok well heres what i got:

Code:
AddtoplayergroupForce1

Event
 Map Initilization
Condition
Action: 
Player Group - Add Player 1 (Red) to (All allies of Player 1 (Red))
Player Group - Add Player 3 (Blue) to (All allies of Player 1 (Red))
Player Group - Add Player 2 (Teal) to (All allies of Player 1 (Red))
Player Group - Add Player 4 (Purple) to (All allies of Player 1 (Red))

Add to player group force 2

Event
 Map Initilization
Condition
Action: 
Player Group - Add Player 5 (Yellow) to (All allies of Player 5 (Yellow))
Player Group - Add Player 6 (Orange) to (All allies of Player 5 (Yellow))
Player Group - Add Player 7 (Green) to (All allies of Player 5 (Yellow))
Player Group - Add Player 8 (Pink) to (All allies of Player 5 (Yellow))
Code:
trigger1

Event
Player - Player 1 (Red) leaves the game
Player - Player 2 (Blue) leaves the game
Player - Player 3 (Teal) leaves the game
Player - Player 4 (Purple) leaves the game
Condition
Action
Player Group - Remove (Triggering player) from (All allies of Player 1 (Red))
Wait 0.10 seconds

Game - Display to (All players) the text: ((Name of (Triggering player)) + has left the game. All of his/her gold will be split-up among his/her team.)

Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Player - Add (((Triggering player) Current gold) / (Number of players in (All allies of Player 1 (Red)))) to (Picked player) Current gold)
Code:
Trigger2

Event 
Player - Player 5 (Yellow) leaves the game
Player - Player 6 (Orange) leaves the game
Player - Player 7 (Green) leaves the game
Player - Player 8 (Pink) leaves the game
Condition
Action
Player Group - Remove (Triggering player) from (All allies of Player 5 (Yellow))
Wait 0.10 seconds

Game - Display to (All players) the text: ((Name of (Triggering player)) + has left the game. All of his/her gold will be split-up among his/her team.)

Player Group - Pick every player in (All allies of Player 5 (Yellow)) and do (Player - Add (((Triggering player) Current gold) / (Number of players in (All allies of Player 5 (Yellow)))) to (Picked player) Current gold)

And those are my 4 triggers. I think i know why my last trigger didnt work, i didnt add the players to a player group beforehand.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic weekend!
  • Ghan Ghan:
    We are now on Ubuntu 24.04. Had some issues with the style after the OS/PHP upgrade but now resolved.
    +1
  • Ghan Ghan:
    PHP 8.3 now live
    +1
  • The Helper The Helper:
    Weekend went by too fast. Next weekend I am going to try to do a nature thing - buddy of mine lives by the Colorado river and has some kayaks and invited me to do some kayaking from a place he knows to get on the river.
  • Ghan Ghan:
    That sounds like an adventure.
  • The Helper The Helper:
    400 users all online all looking at latest content
  • The Helper The Helper:
    I wonder how all these bots that sit on the lastest content page get passed anubis or maybe they did not but they are just registering on whos online
  • The Helper The Helper:
    showing up on whos online not registration
  • Ghan Ghan:
    The first gate is stopping all the bots that don't execute javascript.
  • Ghan Ghan:
    That's the main thing with Anubis - no Javascript, no site. Typically you can still get the site to load without Javascript.
  • The Helper The Helper:
    I remember the whole javascript thing, question - how many real people disable that?
  • The Helper The Helper:
    Hell I guess I could go back on the stats to know that - we probably capture that and we know the before and after
  • Ghan Ghan:
    Real users can't really disable Javascript anymore these days.
  • Ghan Ghan:
    The internet is broken without it.
  • Ghan Ghan:
    Bot readable, not human usable.
  • The Helper The Helper:
    got it
  • The Helper The Helper:
    Happy Thursday!

The Helper Discord

Staff online

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top