A Few (Probably Easy to Answer) Questions

正在查看此主题的用户

Stonewall382

Knight at Arms
Hello, I'm working on my Empires/Economy mod, but I'm having some problems.
One of the features will be that when the player builds something, it shows up in the castle, but not before that.  So I need to use scene props and then disable them when the industry hasn't been built.  For scene props, you just add "spr" to the beginning of the prop's name, but for plants, I can't find where they're defined.  I don't know what to put in front of their name (whch I can view in edit mode).

I'm having the same problem with sounds.  I want to have sounds play when a dialogue is started (I'd like to try to get some voice acting in), but when I put "play_sound" in the conditions block (or consequence, doesn't matter), it says the identifier I'm using for the sound is illegal.  Any idea what I can do about that?

Also, to make the scene props thing (and basically everything else, as well) work, I'm using variables, like $radoghir_stone_stores, $radoghir_woodcutters_tent, and $radoghir_population_happiness, but I can't call these up in dialogues.  For one conversation, I want to have the head of construction say, "That will require two hundred pounds of wood.  In our stores, we have _____ (<-- and here's the problem).  Shall we build it?"  I tried {radoghir_wood_stores}, as well as things like "str_store_agent_name" in the conditions block, but those don't work.  Then I tried "agent_get_slot," and I think I got closer.  It now reads 0 every time (as opposed to the old "Unrecognized Token <radoghir_wood_stores>"), but then it says "Illegal agent identifier: 400."  While this would theoretically work for the mod (the player still can see the amount), it looks pretty shoddy, and I'd rather do it another way.  So, how do I make it so that I can call up variable values in dialogue?

Lastly, how do agents work?  What are they?  Are they troops, and is that what people keep talking about using the slots of?  Are they actually variables?  Is "agent_get_slot" the correct thing to use, and I'm just not using it correctly?


Thank you to anyone who replies.:smile:
 
I don't think plants are scene props. So scene_prop_disable probably won't work on them. You'd make a new scene prop using the plant mesh and then enable/disable that.

The identifier has the format "snd_blahblah". Have a look at the arenamod source to see how to use it.

Only registers (and other strings) can be displayed in text strings. So "I have {reg10} wood" will work, but not "I have {$num_wood} wood".

Agents are the actual, instantiated active AI things running around on the battlefield during battle mode. That's why you can get their locations, and make them move to certain points on the battlefield, etc. They are not the same as Troop(type)s.

Slots are just variables associated with a game object. Parties, Trooptypes, and Agents have slots.
 
Thanks much, fisheye.

The plants thing is simple and something I should've thought of from the getgo.  Thank you.

Will do for the sound stuff.

Is there any way to write a variable's value to a register?  Seems like there should be, but I can't think of what it is.

So an agent uses a troop type to determine what it looks like and under what parameters it acts, right?  A troop is never really on the battlefield, it's just what the agent uses to act on the battlefield.  Is that kind of right?

So what's the point of using slots instead of variables?
 
Stonewall382 说:
Thanks much, fisheye.

The plants thing is simple and something I should've thought of from the getgo.  Thank you.

Will do for the sound stuff.

Is there any way to write a variable's value to a register?  Seems like there should be, but I can't think of what it is.

So an agent uses a troop type to determine what it looks like and under what parameters it acts, right?  A troop is never really on the battlefield, it's just what the agent uses to act on the battlefield.  Is that kind of right?

So what's the point of using slots instead of variables?

(assign,reg(1),"$my_variable"),

That will make reg(1) the same as your variable.

A "troop" is like a template for generating an agent. Troops are the data, agents are the physical being on the battlefield.

Take a look at the Q&A thread, leprechaun recently posted a perfect example of how slots can be used.
 
*Pumps fist in air*
Beautiful!  For a while there I thought I'd have to use troop slots or, worse yet, registers (which I'd have to document seperately :eek:), to do it.  Thank you very much Yoshiboy.

Ah, it makes sense about the agents now too.  Thank you guys.


By the way, Yoshiboy...any chance, in the distant future, that I could perhaps learn to put naval warfare/travel in the mod from you?  I'd like to make a continent resembling the Orient a ways away from the Eurocentric rest of the map.  No worries if you don't want me to use it, though.
 
Sure, PM me when you are solid with python coding and i'll go through it with you. There are lots of things you need to be aware about when considering to do it.
 
Alright, my head's about to explode.  WHAT am I doing wrong in this bit of code?:

#Caravans
  [trp_bourghal|plyr,"Bourghal_talk1",[],"I would like to send a caravan.","Bourghal_caravan1",[(assign,"$trade_route_castle1","p_castle_2")]],
  [trp_bourghal,"Bourghal_caravan1",[],"We have three caravans currently, and each can carry six hundred pounds of material.","Bourghal_caravan2",[]],
  [trp_bourghal,"Bourghal_caravan2",[],"Where would you like to send a caravan?","Bourghal_caravan3",[(assign,"$radoghir_caravan","pt_radoghir_caravan_small")]],
  [trp_bourghal|plyr,"Bourghal_caravan3",[],"Tulga.","Bourghal_caravan4",[(assign,"$trade_route_castle2","p_town_10"),
                                                                          (spawn_around_party,"$trade_route_castle1","pt_radoghir_caravan_small"),
                                                                          (party_set_ai_behavior,"$radoghir_caravan",ai_bhvr_travel_to_party),
                                                                          (party_set_ai_object,"$radoghir_caravan","$trade_route_castle2)]],
  [trp_bourghal,"Bourghal_caravan4",[],"Yes, lord.","close_window",[]],

I can spawn the party where it should be, it's the correct party, all that ****, but it will NOT go to Tulga.  Any idea why?  As before, thank you to anyone who helps.


Edit:  It's inefficient coding, and ugly as all get-out, I know--I'm going to change it, but I first wanted to see if I could get it to work.
 
a party template is not the same as the part spawned. The party spawned is stored in reg(0) when spawned, so instead of using the variable just use reg(0) to refer to the new party that is spawned.
 
Ah, I thought it might have to do with that discrepancy, but I had no idea how to access the particular party that was just spawned.  Of course, you answered it just how I needed.  Thank you again, Yoshiboy.:smile:

D'oh!  It says right in header_operations.py that it's stored to reg(0).  My n00b.
It's working, though I now have the caravan following me!:eek:
Time to rewrite...
 
后退
顶部 底部