Random Sell Trigger Help

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Random Sell Trigger Help

Post by Black-Hole »

How can i make a sell trigger that when people sell the tower it picks a Random % between 0 and 120 of the point value to return to the player? I would also like the trigger to tell the player the % that was returned to them. Please help me make this trigger...

Also what spell should i use to make the Sell Tower spell... I tryed avatar but it makes your towers bigger before there sold...
Rich Kane
Member
Posts: 77
Joined: May 27th, 2008, 9:08 pm

Re: Random Sell Trigger Help

Post by Rich Kane »

hmm i had a quick shot at this and im wondering why warcraft cant multiply by a real value...

o and why it rounds down everything..
Arabidnun
Forum Staff
Posts: 506
Joined: August 5th, 2007, 1:38 pm
Title: Gui Expert
Location: *Unknown*

Re: Random Sell Trigger Help

Post by Arabidnun »

Instead of an ability, Make it a researchable

Sell Ability Trigger
Spoiler:
Sell FARM
Events
Unit - A unit Finishes research
Conditions
(Researched tech-type) Equal to Sell
(Unit-type of (Triggering unit)) Equal to Farm
Actions
Unit - Kill (Triggering unit)
-------- Sets Integer To Random Value --------
Set Temp_Integer = (Random integer number between 120 and 120)
-------- Temp Integer X (Gold Cost of Unit) = added to players gold --------
Player - Add ((Temp_Integer x 80) / 100) to (Owner of (Researching unit)) Current gold
Game - Display to (All players matching ((Owner of (Researching unit)) Equal to (Triggering player))) the text: (You Have Recieved + ((String(((Temp_Integer x 80) / 100))) + Gold.))

Heres a map to see what I am talking about:
Sell Ability.w3x
You do not have the required permissions to view the files attached to this post.
Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Re: Random Sell Trigger Help

Post by Black-Hole »

There are only 2 problems with the trigger you made.
1) It always gives the same amount. I want the trigger to give a random amount back from what you payed. Forexample, there are 5 towers costing from 10, 20, 30,40, and 50g. When you sell the one for 10g you should have the chance of getting anywhere from 0 to 12g back.

2) The other problem with it being a research is when you sell the tower you cant sell the next tower, you can only sell one tower.
Arabidnun
Forum Staff
Posts: 506
Joined: August 5th, 2007, 1:38 pm
Title: Gui Expert
Location: *Unknown*

Re: Random Sell Trigger Help

Post by Arabidnun »

Ok you can do it a different way when using an ability when you just swap out a couple things in my tigger and use point value.

Btw, the reason it only picks 1 number is beacuse the random integer is set to 120-120, so it always choses 120%...Its not the triggers fault I was testing something.


Fixed Trigger
Spoiler:
Sell Ability
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Dummy Spell
Actions
Set Temp_Integer = (Random integer number between 0 and 120)
Set Temp_Point = (Position of (Casting unit))
Special Effect - Create a special effect at (Center of (Playable map area)) using UI\Feedback\GoldCredit\GoldCredit.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point)
Player - Add ((Temp_Integer x (Point-value of (Casting unit))) / 100) to (Owner of (Casting unit)) Current gold
Game - Display to (All players) the text: (You Recieve + ((String(((Temp_Integer x (Point-value of (Casting unit))) / 100))) + ( Gold From Selling + (Name of (Casting unit)))))
Unit - Remove (Casting unit) from the game

Credit Appreciated...However, this cannot sell units all at once, you still have to individually click and sell..
Rich Kane
Member
Posts: 77
Joined: May 27th, 2008, 9:08 pm

Re: Random Sell Trigger Help

Post by Rich Kane »

to answer your other question i chose to use thunderclap and i made this map yesterday
You do not have the required permissions to view the files attached to this post.
Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Re: Random Sell Trigger Help

Post by Black-Hole »

Thanks, that was a hard trigger. Thanks Arabidnun your second trigger worked great, i did alittle editing, there was a problem with your rich if it was under 100% you didnt get gold.

Now im having a different problem this one will be a piece of cake for you guys, but no mater what i try it dosnt work for somereason, its sapost to remove all the units of the nonplaying people, (Computer and so forth)

My first one was really simple and i though it would work.
Spoiler:
Actions (It would pick all players first)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Picked player) controller) Equal to None
(Picked player) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by (Picked player) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
This is what i got after reworking the trigger 10 times!
Spoiler:
Player Not Playing
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) controller) Not equal to User
(Player 1 (Red) controller) Equal to None
(Player 1 (Red) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 2 (Blue) controller) Not equal to User
(Player 2 (Blue) controller) Equal to None
(Player 2 (Blue) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 3 (Teal) controller) Not equal to User
(Player 3 (Teal) controller) Equal to None
(Player 3 (Teal) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 3 (Teal)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 4 (Purple) controller) Not equal to User
(Player 4 (Purple) controller) Equal to None
(Player 4 (Purple) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 4 (Purple)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 5 (Yellow) controller) Not equal to User
(Player 5 (Yellow) controller) Equal to None
(Player 5 (Yellow) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 5 (Yellow)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 6 (Orange) controller) Not equal to User
(Player 6 (Orange) controller) Equal to None
(Player 6 (Orange) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 6 (Orange)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 7 (Green) controller) Not equal to User
(Player 7 (Green) controller) Equal to None
(Player 7 (Green) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 7 (Green)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 8 (Pink) controller) Not equal to User
(Player 8 (Pink) controller) Equal to None
(Player 8 (Pink) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 8 (Pink)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 9 (Gray) controller) Not equal to User
(Player 9 (Gray) controller) Equal to None
(Player 9 (Gray) controller) Equal to Computer
Then - Actions
Unit Group - Pick every unit in (Units owned by Player 9 (Gray)) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Else - Actions
AND IT STILL DOSNT WORK PLEASE HELP ME.... This is the last bug in my game... and its a big one.
User avatar
Bartimaeus
Tyrannical Drama Queen
Posts: 4430
Joined: November 19th, 2007, 5:05 am
Been thanked: 2 times

Re: Random Sell Trigger Help

Post by Bartimaeus »

Changed units owned by (player) to Units In Region, (Playable Map Area) Owned by (Player). The way you're doing it right now makes it not select anything at all.
Arabidnun
Forum Staff
Posts: 506
Joined: August 5th, 2007, 1:38 pm
Title: Gui Expert
Location: *Unknown*

Re: Random Sell Trigger Help

Post by Arabidnun »

This trigger is very easily fixed. Basically It should look like this:

VariableCondition

Remove Unused
Events
Map initialization
Conditions
Actions
Wait 2.00 seconds
Set Temp_Player_Group = (All players)
Player Group - Pick every player in Temp_Player_Group and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
((Picked player) slot status) Equal to Is unused
((Picked player) controller) Equal to Computer
((Picked player) controller) Equal to None

Then - Actions
Unit Group - Pick every unit in (Units in (Playable map area) owned by (Picked player)) and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Else - Actions
Do nothing
Custom script: call DestroyForce (udg_Temp_Player_Group)

[blinking]
Trigger For When Player Leaves/Defeated
[/blinking]
Spoiler:
Player Leaves
Events
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
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
Player - Player 9 (Gray) leaves the game
Player - Player 10 (Light Blue) leaves the game
Player - Player 11 (Dark Green) leaves the game
Player - Player 12 (Brown) leaves the game
Player - Player 1 (Red) leaves the game with a defeat
Player - Player 2 (Blue) leaves the game with a defeat
Player - Player 3 (Teal) leaves the game with a defeat
Player - Player 4 (Purple) leaves the game with a defeat
Player - Player 5 (Yellow) leaves the game with a defeat
Player - Player 6 (Orange) leaves the game with a defeat
Player - Player 7 (Green) leaves the game with a defeat
Player - Player 8 (Pink) leaves the game with a defeat
Player - Player 9 (Gray) leaves the game with a defeat
Player - Player 10 (Light Blue) leaves the game with a defeat
Player - Player 11 (Dark Green) leaves the game with a defeat
Player - Player 12 (Brown) leaves the game with a defeat
Conditions
Actions
Set Temp_Unit_Group = (Units in (Playable map area) owned by (Triggering player))
Unit Group - Pick every unit in Temp_Unit_Group and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Game - Display to (All players) the text: (Player_Colors[(Player number of (Triggering player))] + ((Name of (Triggering player)) + (|r + <Space>Has Left The Game.)))
Custom script: call DestroyGroup (udg_Temp_Unit_Group)