Lock trading for only one resource?

Ouguiya

New Member
Reaction score
11
Hi everyone!

Well, the title basically says it all.

Is it possible to restrict (or rather, disable) trading with one's allies for one resource (for example: lumber), but leave the other one in tact.

Thanks in advance!

Yours,

Ouguiya
 

Dest

New Member
Reaction score
26
I don't think it's possible but you can disable the allies trading and add a command to give the resources to a player.
 

Ouguiya

New Member
Reaction score
11
I already thought of this possibility, but this is not something I want to do. For the simple reason that it makes things more complicated, less UI-like and more shell-like, which most players neither want nor like.

It doesn't even have to be simple. I would even settle for JASS if need be to squish this.

Yours,

Ouguiya
 

Dest

New Member
Reaction score
26
I already thought of this possibility, but this is not something I want to do. For the simple reason that it makes things more complicated, less UI-like and more shell-like, which most players neither want nor like.

It doesn't even have to be simple. I would even settle for JASS if need be to squish this.

Yours,

Ouguiya

Then do a trigger that if the player gives a resource, you take it away and add a game message that you cannot give the resource. What about that?
 

Ouguiya

New Member
Reaction score
11
Sure, this would be the most reasonable way of doing it. If you can show me the event which fires a trigger when a player trades resources, I'll give you +REP (I haven't seen any such event...)

Thanks!

Yours,

Ouguiya
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
http://www.thehelper.net/forums/showthread.php?t=102077
You can try to use this library. NewGen WE is required, and if you don't know JASS it might be difficult to understand and use. The system that it uses, DataSystem, will also break with the new patch (But that can be fixed easily).

To use the first library I linked to, you could do this:
  1. Open NewGen
  2. Open your map
  3. Paste the code from DataSystem, which I linked to, into a trigger in your map called DataSystem
  4. Paste the code from the first link into a trigger called DRES
  5. Try the code below this list by pasting it into a trigger, then trying to trade wood with someone. If it works, great. If not, let me know and I'll try again. It's untested, since there's only one of me and two people are needed to test a trading trigger
JASS:
scope NoTradingLumber initializer Init

function Actions takes nothing returns nothing
     local integer wood = GetLumberDeal() //The amount of wood traded
     call SetPlayerState(GetLumberDonor(), PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(GetLumberDonor(),PLAYER_STATE_RESOURCE_LUMBER) + wood)
     //Above: Add wood back to the person that gave it away
     call SetPlayerState(GetLumberReceiver(), PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(GetLumberReceiver(),PLAYER_STATE_RESOURCE_LUMBER) - wood)
     //Above:Take the wood away from the receiver
     call DisplayTextToPlayer(GetLumberDonor(),0,0,"You cannot trade lumber")
     //Let them know they can't give people wood
endfunction

function Init takes nothing returns nothing
     local trigger t = CreateTrigger()
     call TriggerRegisterTrade(t,bj_FORCE_ALL_PLAYERS,DRES_LUMBER) //Register the trade
     call TriggerAddAction(t, function Actions)
endfunction
endscope

No guarantees this will work. It's untested, and the first time I've ever tried to use DRES. I've never even seen a map that used DRES, or anything. Oh well, it's worth a shot I guess.
 

Ouguiya

New Member
Reaction score
11
Hi there!

Thanks for your work and your time to write all this down and look it up.

I gave you +rep, and would have loved to tell you "it worked", but unfortunatly, I started the map with WEU.

Sadly, I cannot switch from WEU to Jassnewgen, (I have tried at least 4 times, and twice I asked here in the forum, but nobody was able to give me any advice on how to beat the multitude of bugs which arises from a switch, and doing the map again from scratch is out of the question).

This only leaves basic jass or GUI triggers as the solution.

Still, thanks again.

Yours,

Ouguiya
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
offtopic:
i guess the reason you cannot switch from WEU to newgen is cause you use WEU actions/events/conditions. just look up all of your triggers which use WEU adds, convert the part made with WEU to custom script and add it to your triggers using "call ...." (if you made them with GUI)
i dont know any other problem with switching between WEU and Newgen (im doing it sometimes to translate the editor into english)
 

Ouguiya

New Member
Reaction score
11
Well, my "problem" is simple: I saw that "integrate WEU" option, i'm not THAT dumb.

Problem was however, that even when switched on, loading the map first told me "Trigger action unknown: Initadvancedtriggers", and then, after pressing OK, it simply crashed the editor.

So yeah, THIS is my problem.

Removing all the trigger actions is something I tried, but then the JassNewgen syntax checker finds a lot of syntax errors which shouldn't be there (something about multiple referencing).

Still, thanks for the help, I will try one last time to switch (like I said, I tried it often, and it's starting to become really bothering...), with Accname instructions, since I didn't try converting them to custom text before.

Thanks again.

Yours,

Ouguiya
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Maybe you had already it, but in order to integrate weu, you have to open newgen we.exe with an empty map or at least without any weu feature, integrate weu, close newgen, and reopen it.
 

Ouguiya

New Member
Reaction score
11
Heya!

Thanks for the reply.

I tried to do what you said (I admit I haden't tried it that way before), but it doesn't work.

It still tells me that the functions are unknown, and then crashes.

It would be really cool if this feature worked. I hope you can provide a bit further guidance.

Thanks again.

Yours,

Ouguiya
 

HydraRancher

Truth begins in lies
Reaction score
197
This probably wont work, but with Newgen, before opening WEU map, thingy, do UMSWE > enable UMSWE and Grimoire > Enable no limits, close Newgen, and re-open, then try load ur WEU map.
 

Ouguiya

New Member
Reaction score
11
Tried it, didn't work, sadly.

The only thing which seems to work so far, is to convert the triggers which are problematic to custom text, which will then not crash the editor since it's JASS and not GUI functions.

Thanks in either case, I will try to move forward from there.

Yours,

Ouguiya
 

Ouguiya

New Member
Reaction score
11
Correction:

By some sheer miracle, I managed to open the map, converting all WEU functions to custom scripts.

Troll-brain: i had a look at your system. It looks great, but unfortunatly, I am a complete noob at JASS, so I wouldn't even know how to use it.

Could you maybe give any sort of guidance on it?

Thanks again.

Yours,

Ouguiya
 

Dest

New Member
Reaction score
26
You can just do what I said... It's easy, quick and you just don't even need the allies menu.
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Ouguiya said:
Troll-brain: i had a look at your system. It looks great, but unfortunatly, I am a complete noob at JASS, so I wouldn't even know how to use it.

Troll-brain's system is the one I used in my post. The functions that I used haven't changed names, so you should be able to follow these instructions:
  1. Copy the system Table and paste it into your map. You'll probably want Version 2.0, 3.0 is only used for patch 1.23b and 1.24.
  2. Copy Troll-brain's system into your map
  3. Copy the trigger from my previous post into your map
  4. Test

>You can just do what I said... It's easy, quick and you just don't even need the allies menu.

It's also annoying to have to type commands to trade, rather then simply using the allies menu.
If you refer to your other solution of "Then do a trigger that if the player gives a resource, you take it away and add a game message that you cannot give the resource", well... That's exactly what the trigger talked about in my post should do. There is no default "Player - Player trades Resource" event, so we need to use Troll-brain's system which creates one.
 

Ouguiya

New Member
Reaction score
11
Hi there, trb92!

Thanks for the reply!

Well, I tried to do just that (oh yeah, btw: Shouldn't I use the newest version then? after all I want to play my map on Bnet :D)

Unfortunatly, like I said, I am a complete, total, utter noob when it comes to JASS, so I don't even know if I can simply copy past the thing and overwrite anything which was in the trigger, or if I have to leave the stuff which was written in the trigger intact, etc.

However, I once tried it, but the syntax checker bombarded me with Syntax-errors...

Could you maybe give a "step-by-step guide for complete dummies" on this one?

(Note: What I have done up till now, is to leave the trigger custom text intact, and simply paste the function in-between the "function - end function" line (the first and second lines of the trigger).

But, I'm guessing I'm doing things really wrong...

Thanks again.

Yours,

Ouguiya
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
  1. Create a trigger
  2. Change the triggers name to the name of the system you are importing (Optional, but helps with readability later.)
  3. Use "Convert to Custom Text"
  4. Delete everything you get
  5. Paste in the system

>Shouldn't I use the newest version then? after all I want to play my map on Bnet
The newest patch is only available on Westfall, the gateway made for testing beta patches. Table 3.0 is made with new native functions that exist in that patch but not the current stable patch, but the four normal BNet gateways don't have the newest patch. They still have patch 1.23. Table 3.0 will only work on Westfall. You'll need to update to Table 3.0 once the new patch comes out on all four gateways, but right now only Table 2.0 will work on them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top