Ghetto Recruiting Ability HELP!!!!
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Ghetto Recruiting Ability HELP!!!!
What's the error message? -Would it be possible to show your stderr.txt?zengetsu88 wrote:I know this code is possible but it is still not working... Whenever I add the unit with this code on it to the wesnoth folders, the game won't load all the way. It will start to load but then just quit by itself without telling me an error....
It is starting to piss me off...
I also found some errors:
If I see it right, you forgot to close one [then] tag. Another thing, which shouldn't cause the error, but will later: You asked, if gold>=5. This won't be every true since you didn't set the variable 'gold'. So instead, use 'my_side.gold'. Also, you have to solve the thing with the select event better: The way it is now, the right click menu will be spamed if you click a unit more than one time. Maybe you should use a recruit, recall and post advance event containing this menu item (of course, you'll have to write a macro). Then, use a variable, where the variable 'unit' is stored in. Then, ask in [filter] of [set_menu_item] if the last selected unit's id is the same of this unit (so use id=$saved_unit.id). You forgot 'first_time_only=no'. You won't need the whole [show_if] stuff. If you just left it out and the user right clicks on a carrier, the unit will be spamed adjacent to the already-there unit. If you don't want to have that feature, you may use [filter_adjacent] instead of radius=1.
Very easy:this is what I have so far... and it is on the actual Carrier unit...So maybe should I turn this code into a macro or an actual ability instead of just putting it on a unit?Spoiler:
I have never done that before... so i'm not sure how to do that if that were the case....
I just really need some help on this code... Everyone has been so helpful so far... so I thank you...
Code: Select all
#define ABILITY_RECRUIT
#here the dummy ability itself
[/abilities]
#here every single event you want to have
[+abilties]
#enddef
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Ghetto Recruiting Ability HELP!!!!
-deleted-
Last edited by fog_of_gold on April 28th, 2010, 8:22 pm, edited 2 times in total.
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Ghetto Recruiting Ability HELP!!!!
-deleted-
Last edited by fog_of_gold on April 28th, 2010, 8:22 pm, edited 1 time in total.
Re: Ghetto Recruiting Ability HELP!!!!
1) what about testing my piece of code first ?zengetsu88 wrote:Wow... I really like the help you have given me and I have been playing with this code... BUT everything I do is done for MULTIPLAYER.... NOT CAMPAIGN
So I like this code but I need to know what event name should be used... cause I'm pretty sure prestart will not work if I put this code on the unit "carrier"
This code is to be used as an ability for the particular unit.
beacsue its made for multiplayer, and belive me prestart works pretty well, since the only important thing is that the MENU GETS DEFINED ONCE, it can be called anywhere later in game.
the code i posted works well in several (multiplayer) add ons
all the code get added into the ERA. (or scenario or whatever)
dont add the code to the units.
2) if only "carriers" have this ability then we (or better said YOU) dont have a problem, just add a dummy ability to the unit carrier which hold a small description, if several units have this ability, then you can always ask for "ability", instead of the Unit-id ..
like this:
Code: Select all
[event]
name=prestart
[set_menu_item]
id=recruit
description="carrier recruit"
[show_if]
[not]
[have_unit]
x,y=$x1,$y1
[/have_unit]
[/not]
[/show_if]
[filter_location]
[filter]
ability=WHATEVERNAME
side=$side_number
[/filter]
radius=1
[/filter_location]
[command]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
[store_unit]
[filter]
ability=WHATEVERNAME
side=$side_number
[filter_location]
x,y=$x1,$y1
radius=1
[/filter_location]
[/filter]
variable=carrier
[/store_unit]
[message]
.................
The best bet is your own, good Taste.
Re: Ghetto Recruiting Ability HELP!!!!
sure he didfog_of_gold wrote:Another thing, which shouldn't cause the error, but will later: You asked, if gold>=5. This won't be every true since you didn't set the variable 'gold'.
if you look at his code there is written
Code: Select all
[store_gold]
side=$side_number
variable=gold
[/store_gold]
The best bet is your own, good Taste.
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: Ghetto Recruiting Ability HELP!!!!
Wow... thank you guys for all the help...
It sounds to me though that you guys are wanting me to put this code into a macro... How the H-E double hockey sticks do I do that?!
I have never done that and I don't want to mess anything up...
BTW... what I was saying earlier is that there is no error message given to me... it just quits out before loading all the way... by itself... but I'm thinking that If I get the code off of the carrier unit itself that problem should be fixed...
lastly... with the event name being "prestart" does the additional code allow only the user to see that menu item... my fear is that with prestart the other user will be able to see the menu item as well... that's bad... maybe I'm just being paranoid...
But I will try to play with it some more and give you guys an update... (i'm having to deal with finals right now)... But thank you for your help!
It sounds to me though that you guys are wanting me to put this code into a macro... How the H-E double hockey sticks do I do that?!
I have never done that and I don't want to mess anything up...
BTW... what I was saying earlier is that there is no error message given to me... it just quits out before loading all the way... by itself... but I'm thinking that If I get the code off of the carrier unit itself that problem should be fixed...
lastly... with the event name being "prestart" does the additional code allow only the user to see that menu item... my fear is that with prestart the other user will be able to see the menu item as well... that's bad... maybe I'm just being paranoid...
But I will try to play with it some more and give you guys an update... (i'm having to deal with finals right now)... But thank you for your help!
my logic is sound
Re: Ghetto Recruiting Ability HELP!!!!
again .. TRY IT OUTzengetsu88 wrote: lastly... with the event name being "prestart" does the additional code allow only the user to see that menu item... my fear is that with prestart the other user will be able to see the menu item as well... that's bad... maybe I'm just being paranoid...
(but of course i could now also tell you that the "menu item code" filters for an adjacent unit (carrier) of the SAME SIDE NUMBER (side=$side_number), so if player B clicks to a hex adjacent to a players A carrier he wont see a menu item, since the carrier doesnt belong to his side.)
no i just want that you put this code somewhere into your era/scn code, NOT into a units codeIt sounds to me though that you guys are wanting me to put this code into a macro...
so thats all from me at this point, i have said all you need tbh, looking through other add ons and see how they managed to do stuff could be helpful.
i recommend to take a look at galactic empires for example.
there you need to right click next to planets (used as units) to recruit stuff .. for example
The best bet is your own, good Taste.
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Ghetto Recruiting Ability HELP!!!!
Oh sorry, I didn't noticed it.Mabuse wrote:sure he didfog_of_gold wrote:Another thing, which shouldn't cause the error, but will later: You asked, if gold>=5. This won't be every true since you didn't set the variable 'gold'.
if you look at his code there is written
and thats what i also told him, so there np with using gold >= 5Code: Select all
[store_gold] side=$side_number variable=gold [/store_gold]
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: Ghetto Recruiting Ability HELP!!!!
Alright... I tried it out... The first thing I tried out was making it a macro... the game finally loaded up and I was able to try it... didn't work... no menu item popped up...
Next I tried was to put the entire event (name=prestart) into the Era.cfg under multiplayer like Mabuse told me to... that didn't work...
but here is what I got in the era.cfg (I added the carrier and the zealot to the rebels default faction btw)
now the ability code in the abilities macro
I know this should work... so What am I doing wrong?
I feel like it is the filter location and show if tags that are messing it up...
Thanks for all the helps so far!
Next I tried was to put the entire event (name=prestart) into the Era.cfg under multiplayer like Mabuse told me to... that didn't work...
but here is what I got in the era.cfg (I added the carrier and the zealot to the rebels default faction btw)
Code: Select all
[era]
id=warped
name= _ "Warped"
{RANDOM_SIDE}
{multiplayer/factions/rebels-default.cfg}
{multiplayer/factions/northerners-default.cfg}
{QUICK_4MP_LEADERS}
{TURNS_OVER_ADVANTAGE}
[event]
name=prestart
[set_menu_item]
id=build_z
description="Build Zealot"
[show_if]
[not]
[have_unit]
x,y=$x1,$y1
[/have_unit]
[/not]
[/show_if]
[filter_location]
[filter]
ability=build_zealot
side=$side_number
[/filter]
radius=1
[/filter_location]
[command]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
[store_side]
side=$side_number
variable=my_side
[/store_side]
[store_unit]
[filter]
ability=build_zealot
side=$my_side
[filter_location]
x,y=$x1,$y1
radius=1
[/filter_location]
[/filter]
variable=carrier
[/store_unit]
[if]
[variable]
name="carrier.moves"
greater_than_equal_to=1
[/variable]
[then]
[message]
speaker=narrator
message= _ "Would you like to build a Zealot?"
[option]
message= _ "Cancel Build"
[/option]
[option]
message=_ "Build a Zealot"
[command]
[if]
[variable]
name=gold
greater_than_equal_to=5
[/variable]
[then]
{GENERIC_UNIT $my_side Zealot $x1 $y1}
[gold]
side=$my_side
amount=-5
[/gold]
[/then]
[else]
[message]
speaker=narrator
message= _ "Not Enough Gold!"
[option]
message= _ "Back"
[/option]
[/message]
[/else]
[/if]
[/command]
[/option]
[/message]
[/then]
[else]
[message]
speaker=narrator
message= _ "Carrier does not have enough moves."
[/message]
[/else]
[/if]
{CLEAR_VARIABLE gold}
{CLEAR_VARIABLE my_side}
{CLEAR_VARIABLE carrier}
[/command]
[/set_menu_item]
[/event]
[/era]
Code: Select all
#define ABILITY_BUILD_ZEALOT
[dummy]
id=build_zealot
name= _ "Build Zealot"
description= _ "Build Zealot: Right Click next to the unit with this ability to build a zealot."
[/dummy]
#enddef
I feel like it is the filter location and show if tags that are messing it up...
Thanks for all the helps so far!
my logic is sound
Re: Ghetto Recruiting Ability HELP!!!!
If you would try it with "type=carrier" (or whatever the ID of that unit is) instead of "ability=build_zealot" then you would know that there is probably something wrong with the ability .
if it doesnt work with checking for the unitID (make sure you spelled it right) then the problem must be elsewhere, but i suggest you simply test it.
if it doesnt work with checking for the unitID (make sure you spelled it right) then the problem must be elsewhere, but i suggest you simply test it.
The best bet is your own, good Taste.
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Ghetto Recruiting Ability HELP!!!!
I suggest to do the following things:
-add [message][/message] in the event
-remove the whole [show_if] tag
-remove the whole [filter_location] tag
If the [message] tag won't work (very unlikly), then, there'll be an error with the [event] tag.
If the [show_if] tag won't work, this will cause the error. Like I said, it isn't needed since your unit won't be override so it would be better to remove it.
If the [filter_location] tag won't work, then remove step by step every command (ability, side and [filter]) and test it.
And finally, please post the results.
-add [message][/message] in the event
-remove the whole [show_if] tag
-remove the whole [filter_location] tag
If the [message] tag won't work (very unlikly), then, there'll be an error with the [event] tag.
If the [show_if] tag won't work, this will cause the error. Like I said, it isn't needed since your unit won't be override so it would be better to remove it.
If the [filter_location] tag won't work, then remove step by step every command (ability, side and [filter]) and test it.
And finally, please post the results.
Re: Ghetto Recruiting Ability HELP!!!!
the code i posted works. period.
i dont know what zengutsu is doing all the time.
obviously something is wrong with the ability/the way he imlemente the ability, and i (the hell) ask myself why he dont simply check for the unit_ID as it was done just one example earlier, instead of posting blind guesses what could be wrong with the code.
i dont know what zengutsu is doing all the time.
obviously something is wrong with the ability/the way he imlemente the ability, and i (the hell) ask myself why he dont simply check for the unit_ID as it was done just one example earlier, instead of posting blind guesses what could be wrong with the code.
The best bet is your own, good Taste.
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: Ghetto Recruiting Ability HELP!!!!
WTF! Dude I have been trying... I'm not guessing, I'm asking why it's not working. I have been working with this code and doing research for it for a really long time. I'm looking through the code for errors all the time! I will post my results.... and enough with the blows to the head.
my logic is sound
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: Ghetto Recruiting Ability HELP!!!!
Alright everybody, im back and ready to go at it again.
I have been out of practice for almost a year and so im reading up on what I did and trying to start fresh.
I've read through all of the forum topics I created almost a year ago, including this one, and I am ready to start it up again.
Firstly after reading through it, Mabuse I owe you a lot of thanks and credit. Once I get this started up again, I know I'm gonna need your help... again.
I'm gonna start over with a new version of wesnoth, and I'm gonna try and use my snippets of code on existing units and factions that are already in the game to test the code and then I will try and create the units later.
So first order of business. What file under what directory do I put this code?
once i know this, I also need to know where in the file to put the code.
Mabuse you told me to put it into the Era file. can you give me some examples or a little more detailed description of where I should be putting this.
Lastly, I'm sorry if something like this was created while I have been absent to the forums. I did not feel like going through over a years worth of forum topics.
Thanks again.
I have been out of practice for almost a year and so im reading up on what I did and trying to start fresh.
I've read through all of the forum topics I created almost a year ago, including this one, and I am ready to start it up again.
Firstly after reading through it, Mabuse I owe you a lot of thanks and credit. Once I get this started up again, I know I'm gonna need your help... again.
I'm gonna start over with a new version of wesnoth, and I'm gonna try and use my snippets of code on existing units and factions that are already in the game to test the code and then I will try and create the units later.
So first order of business. What file under what directory do I put this code?
once i know this, I also need to know where in the file to put the code.
Mabuse you told me to put it into the Era file. can you give me some examples or a little more detailed description of where I should be putting this.
Lastly, I'm sorry if something like this was created while I have been absent to the forums. I did not feel like going through over a years worth of forum topics.
Thanks again.
my logic is sound
Re: Ghetto Recruiting Ability HELP!!!!
I am not Mabuse, and I don't know exactly what your project is, but I can say this: events work only in three places.
1) In a [scenario] tag, which will mean the event will be active for said scenario (this is alos valid for [multiplayer] and other equivalents). It can be troublesome for a scenario-less add-on (such as an era) or a campaign, though.
2) In a [unit_type] tag, which will mean the event will be active for any scenario said unit is in. This, however, does depend on having a certain unit, and depending on your event, it might be problematic if it is duplicated (if there are three of those units, there will be three times the event).
3) In an [era] tag, which will mean the event will be active for any scenario using said era. It's used a lot and much more flexible, as long as you have an [era]: you don't have to copy the event across scenarios and worry about duplicates.
So if you choose number 3, this could be in the [era] tag of any file pointed to by your main.cfg (usually *******_era.cfg, directly in your add-on's main directory)
1) In a [scenario] tag, which will mean the event will be active for said scenario (this is alos valid for [multiplayer] and other equivalents). It can be troublesome for a scenario-less add-on (such as an era) or a campaign, though.
2) In a [unit_type] tag, which will mean the event will be active for any scenario said unit is in. This, however, does depend on having a certain unit, and depending on your event, it might be problematic if it is duplicated (if there are three of those units, there will be three times the event).
3) In an [era] tag, which will mean the event will be active for any scenario using said era. It's used a lot and much more flexible, as long as you have an [era]: you don't have to copy the event across scenarios and worry about duplicates.
So if you choose number 3, this could be in the [era] tag of any file pointed to by your main.cfg (usually *******_era.cfg, directly in your add-on's main directory)
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth