muzbang
Prince
- Joined
- Feb 22, 2007
- Messages
- 319
Hi all,
I'am pretty new to civ4 modifications, and despite i've got some programming basics, i have a problem to implement an event with python (i've done a lot, and now trying some tricky ones
)
Here is what i want to do :
-- to select 4 random ressources. That is ok, i got a function, written in CF, that return a 4 ressources list
-- to lauch a quest with the goal to link a city with those 4 ressources. No problem to launch the quest based on my triggers.
But i got a Problem :
I can't check if the quest is done cause i can't access to the 4 random ressources
I don't want my function to random 4 ressources more than once. I just want to have 1 draw.
So... i put 2 lines in the CvEventManager, in the onGameStart function.
(I know... global is something to avoid 

)
When i do tests (in the CvEventManager's onBeginGameTurn function), i can access to my global variable ManaL (and print the random selection to ensure that it's "static")
But when i want to access to it in the CvRandomEventInterface, it's not recognized.
I hope the problem is sufficiently clearly explained that some of you can help
.
i'm pretty sure it's simple but i miss something.
Thanks !
I'am pretty new to civ4 modifications, and despite i've got some programming basics, i have a problem to implement an event with python (i've done a lot, and now trying some tricky ones

Here is what i want to do :
-- to select 4 random ressources. That is ok, i got a function, written in CF, that return a 4 ressources list
-- to lauch a quest with the goal to link a city with those 4 ressources. No problem to launch the quest based on my triggers.
But i got a Problem :
I can't check if the quest is done cause i can't access to the 4 random ressources
I don't want my function to random 4 ressources more than once. I just want to have 1 draw.
So... i put 2 lines in the CvEventManager, in the onGameStart function.
Code:
global ManaL
ManaL = cf.Random_4_mana()



When i do tests (in the CvEventManager's onBeginGameTurn function), i can access to my global variable ManaL (and print the random selection to ensure that it's "static")
But when i want to access to it in the CvRandomEventInterface, it's not recognized.
I hope the problem is sufficiently clearly explained that some of you can help

i'm pretty sure it's simple but i miss something.
Thanks !