Peasant stealing gold

Dodighead147

New Member
Reaction score
0
Hello... A while ago I posted a thread asking how to make it so periodically a peasant steals gold from you. Thanks to the person who helped me, it works now. Here's the code.
Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Set Unit_Variable = (Random unit from (Units owned by Player 1 (Red) of type Jew))

Code:
Steal
    Events
        Time - Every 150.00 seconds of game time
    Conditions
    Actions
        Unit - Set the custom value of Unit_Variable to (((Custom value of Unit_Variable) + (Player 1 (Red) Current gold)) / 5)
        Player - Set Player 1 (Red) Current gold to (((Custom value of Unit_Variable) - (Player 1 (Red) Current gold)) / 5)

Code:
Killed
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) Equal to Unit_Variable
    Actions
        Player - Add (Custom value of Unit_Variable) to Player 1 (Red) Current gold
        Trigger - Turn off Steal <gen>


The thing is, I want to make it so when the unit dies, it drops the gold as an item, such as a gold coin. Can anyone help me? (this is a very racist game, just warning you.)
 

Caedin88

New Member
Reaction score
1
Instead of saying

Event - a Unit Dies

Actions - Give player Custom Value of DyingUnit as gold

have it do this

Trigger 1

Event - a Unit Dies

Actions - Create item (model =gold coin // btw item has no ability and does nothing ) @ position of dying unit
Store custom value in a global Integer Array[ index = number of died peasents ]
Add item to an Item Array[index = number of died peasents]

Trigger 2
Event - A unit aquires an item
Condition - Item-type = your item
Actions -
for loop Integer A 1 to NumberOfDeadPeasents
If then else -
If - item being acquired is = to ItemArray[IntegerA]
then - Add IntegerArray[IntegerA] to owner of acquiring Item gold.
else - nothing
 

FireBladesX

Eating my wings!
Reaction score
123
You can set the custom value of items, so basically do what Caedin88 says, but use custom values. If they work. I have had some problems with them in the past, but W/E.

You can throw in some floating text too, such as (|cffffcc00+ ) + (Integer(Custom value of Item Being Manipulated))|r, then set the fades and velocity and such. |cffffcc00xxxx|r makes the text gold.


Edit:
Argh, I'm slow... so I edited my message to not be so repetitive.
Apparently, I said something useful. I'll re-edit my post.
 

Caedin88

New Member
Reaction score
1
You can set the custom value of items. So when a unit aquires the Gold Coin tome, add the custom value of the item to the owner of manipulating unit's current gold.

You can throw in some floating text too, such as (|cffffcc00+ ) + (Integer(Custom value of Item Being Manipulated))|r, then set the fades and velocity and such. |cffffcc00xxxx|r makes the text gold.

Ah I didn't know you could put a custom value on items... This solution is tons better than mine.
 

Dodighead147

New Member
Reaction score
0
Im sorry... im sure these work right? but my brain hurts.. Im very new to this stuff.. Can you run me by this as if i dont know the biggest noob in the world? im sorry I dont get it.
 

FireBladesX

Eating my wings!
Reaction score
123
There's a function:
Item - set custom value of item
Using this, you can set an item to a number, and in this case, you set it to the amount of gold that you want your item to give.

Then, upon aquiring an item, you can do
Floating Text - Create Floating Text above Unit, with the unit being the Manipulating Unit.

For teh text, it's called concendrate strings, or something like that.

For one, you do "+ |cffffcc00". For the other, you do "Conversion - convert Integer to String, custom value of Item Being Manipulated". Then, for the last one, close it with |r. Not really necessary.

Then, you need to do:
Floating Text: Disable Permenance
Floating Text: Set Velocity
Floating Text: Set Lifespan
Floating Text: Change Fade Age
Floating Text: Hide for All Players
Floating Text: Show for Owner of Triggering Unit.

Tell me if I missed something.
By the way, the |cffffcc00 colors the text gold. If you google Hex Codes, you can get a list of colors. The formula is |cffXXXXXXInsert Text Here|r, with |r to end the colored text.
 

Dodighead147

New Member
Reaction score
0
So.. Uhh... This makes it so the peasant killed gives the amount it stole (1/5 of your total money) by amount in gold coin?
 

Caedin88

New Member
Reaction score
1
Im sorry but, wheres Actions?

When you make a trigger, theres 3 parts to it...

Event - Your trigger runs (does stuff) when these things happen

Conditions - Checks, makes sure you are doing the actions to right units and so forth.

Actions - These are the little bits of code that do all the work in a trigger, to create a new action right click on the action button and press Create a new Action. Then manuever to what action you want. The actions are organized neatly and orderly through groupings... such as

Units, Destructibles, Special Effects, Player and so on...

Each grouping contains actions that pertain to that part of the game.

Example say you want to Increase player 1's gold by 50 at the start of the game. You would do this.

Make a new trigger it will look like this.

Code:
Untitled Trigger 001
    Events
    Conditions
    Actions

Right click on Events and press 'New Event'

A box will come up allowing you to choose what event you want to use. Select Map Initialization, this Event basically means when the game starts run this trigger.

You will then have
Code:
Untitled Trigger 001
    Events
        Map initialization
    Conditions
    Actions

You can leave Conditions blank for now because it doesn't pertain to this trigger we are making.

So Right click on Actions and select 'New Action'.

Another box will come up, in the top left choose Player, because adding 50 gold is somthing that affects a player, so it is under Players.

It will have 'Set Property' initially selected, you don't want that because it will set that players gold to the value you enter, not add to it. So scroll down and find 'Add Property'. Change the initial value of 1000 to 50, and Player 1 and Current gold are already selected so press okay to finish this action.

You will then have
Code:
Untitled Trigger 001
    Events
        Map initialization
    Conditions
    Actions
        Player - Add 50 to Player 1 (Red) Current gold

And thats it!

Now for your specific case we will need 2 triggers to get done what we want.

The first one will be easy. It will cause dying units of type 'Jew' to drop an item, and transfer thier custom value ( How much gold they are holding ) to the item.

Code:
Trigger 1
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to 'Jew'
    Actions
        Item - Create (ITEM) at (Position of (Triggering unit))
        Item - Set the custom value of (Last created item) to (Custom value of (Triggering unit))

Where as ITEM is equal to the item you make yourself in the object editor.

The second one will be in response to the player picking up the item. The trigger will say, when some one gets an item that has gold on it ( Custom Value ) add that amount of gold to the owner of the unit who got the items current gold.

Basically who ever picks up your gold coins will get the gold that was on the item.

Code:
Trigger 2
    Events
        Unit - A unit Acquires an item
    Conditions
        (Custom value of (Item being manipulated)) Greater than 0
    Actions
        Player - Add (Custom value of (Item being manipulated)) to (Owner of (Hero manipulating item)) Current gold



        Floating Text - Create floating text that reads ((String((Custom value of (Item being manipulated)))) + !) at (Position of (Hero manipulating item)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds

Now everything about Floating Text is optional, the trigger will still give the right amount of gold to the right player without those Actions. But Floating Text lets our hero who gets the item know how much gold he got.

The first Floating Text Action creates a text that is equal to (Amount of Gold)+!, it then says this Text should be Yellow colored (RGB).

The next Floating Text Action says we want this text to go away over time, and not be there the entire game.

The Third Floating Text Action says we want the text to rise slowly and the fourth says it should fade, together they create a rising fading action for our text.

The final Floating Text Action says 5 seconds after this text is created we want to remove it from the map, if you dont do this you will have lots of unwanted text when you play.

And thats it!
 

Dodighead147

New Member
Reaction score
0
Wow!!! I could not have it explained any better than that!!! REP +!!!! By the way, you should really make a TuT on Triggers like that! That was really really throrough and such good step by step! You rock!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      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