Go to Cafe Tropico Cafe Tropico
Go to the Blue Parrot Inn
Search:     Advanced search
05/23/13 at 02:34 PM
Welcome, Guest. Please login or register.

Login with username, password and session length
207388 Posts in 10531 Topics by 2074 Members
Latest Member: cpmoneymakertutorials
   Home   Help Search Calendar Login Register  
Cafe Tropico  |  Tropico 2: Pirate Cove  |  Pirate Cove Editor/Scripting Help (Moderator: CafeDave)  |  Topic: Question 2 - working_captive_happiness
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Question 2 - working_captive_happiness  (Read 1095 times)
0 Members and 1 Guest are viewing this topic.
FieryDove
Peasant
**
Offline Offline

Gender: Female
Posts: 59


Frequent Flyer


WWW
« on: 04/20/03 at 10:57 AM »

I have no idea how to do this one. What I wanted was a check if worker captive happiness is less than < 50% set worker captive happiness back to max. The script returns an error so maybe I should not use the integer value?

Also what does 255 mean, is it 100% in terms of traits/satisfactions?


rule working_captive_happiness

   {

conditions
{
If working_captive_happiness < than 150 == true;

}

actions
{
action assert_int { name: "working_captive_happiness"; value: 255; }

}

Thanks for any help!
Cheers,
FD
Report to moderator   Logged
Aphex
Tourist
*
Offline Offline

Posts: 10


I'm a pirate!


« Reply #1 on: 04/20/03 at 03:17 PM »

Is this more correct ?:
}
rule working_captive_happiness
{

conditions
{
working_captive_happiness < 150;
}

Shouldn't you be using change_captive_worker_satisfaction instead? as an action?

To be honest i really don't know. I'm struggling to write a script that will cheer up the pirates. I'm currently trying this rule:
}
rule pirate_satisfaction
{
   conditions { pirate_happiness < 191; }

   }
   
   actions
   {
   action change_pirate_satisfaction { amount: 64; }
   }

But it doesn't work....It does nothing or crashes the game to desktop when i try various modifications. I'm calling action enable_game_data_override { } at initialization but I'm not sure if its needed. I don't now if I should use action assert_int in some way either...anyone else care to comment?
« Last Edit: 04/20/03 at 03:20 PM by Aphex » Report to moderator   Logged
TJ
Rebel
***
Offline Offline

Gender: Male
Posts: 240

Yes, I am addicted to Tropico 2. Ok, I was...


« Reply #2 on: 04/20/03 at 03:58 PM »

I think I may have idea why both those might not work. Pirate Happiness should be calculated values based on the individual values for Drinking, Stashing, etc and may be protected from modification. Maybe you need to adjust each one of of Drinking, etc. individually.

The problem may come that really each of those are calculated from each pirate and thus could be protected as well. Maybe it is possible to raise  the satisfaction levels of the buildings? Might need some input from the programmers.

Whatever the case, the same should be true for captives.
Report to moderator   Logged
Aphex
Tourist
*
Offline Offline

Posts: 10


I'm a pirate!


« Reply #3 on: 04/20/03 at 04:29 PM »

Cut from DOCUMENTATION.txt:
---------------------------------
ACTION NAME change_pirate_satisfaction
DESCRIPTION Adjusts the satisfaction of pirates on the island. A nation and/or
            faction and/or species can be specified.
ARGUMENTS
            nation       - nationality id, if specified will limit the
                           characters considered to only those of a given
                           nationality [ID string]
            faction      - faction id, if specified will limit the characters
                           considered to only those in the given faction
                           [ID string]
            satisfaction - can be optionally specified to specify a specific
                           satisfaction to check for unhappiness (default is
                           overall) [ID string]
            amount       - amount to change [integer]
RESULT VALUE
            t2_pirate_satisfaction_changed - number of pirates who's satisfaction was
                                             changed (integer)      
EXAMPLE
            // Decrease the anarchy satisfaction of the English gentry by 50
            action change_pirate_satisfaction
            {
                nation: NATION_ENGLAND;
                faction: FACTION_GENTRY;
                need: SATISFACTION_ANARCHY;
                amount: -50;
            }
---------------------------------
It does say that "A nation and/or
            faction and/or species CAN be specified." so I assumed that default was "all" if no one was specified. But i guess it's worth I try to specify....I'll try it right now. however I'm not sure about the ID string for all the needs...at least I got SATISFACTION_ANARCHY from the example.
Report to moderator   Logged
Aphex
Tourist
*
Offline Offline

Posts: 10


I'm a pirate!


« Reply #4 on: 04/20/03 at 04:47 PM »

I GOT IT!!!!!
After a LOT of time spent trying my script works!!!!!!
}
rule change_pirate_satisfaction
{
   conditions
   {
      pirate_happiness < 191;
            
   }
   
   actions
   {
      action change_pirate_satisfaction { amount: 50;}
   }
I have no idea why it works now with 50, but I cranked up the scenario savegame and watched the happiness bar fly sky-high!
Report to moderator   Logged
Charlemagne
General
****
Offline Offline

Posts: 354



« Reply #5 on: 04/20/03 at 04:57 PM »

Aphex, it looks like to me your script should be okay. I'll try it out myself on Monday and post again.

But you should not have to override game data to do this. You are just increasing the happiness at that moment, not making a permanent change to game data.
Report to moderator   Logged

Bill Spieth
Frog City
Charlemagne
General
****
Offline Offline

Posts: 354



« Reply #6 on: 04/20/03 at 04:58 PM »

Just noticed you posted again, glad you got it to work.
Report to moderator   Logged

Bill Spieth
Frog City
Aphex
Tourist
*
Offline Offline

Posts: 10


I'm a pirate!


« Reply #7 on: 04/20/03 at 05:28 PM »

Thanks Charlemagne, I'll remove the
"action enable_game_data_override { }"
then
The script produces some wierd things, the individual needs are not met, causing the happiness bar to jump up and down. The number of delighted pirates will soar
but the bar will be stuck in some kind of loop as individual needs drag the total down followed by the rule raising it again.
After fixing some more I came up with this rule, witch is much better Smiley:

rule change_pirate_need
{
   conditions
   {
      always_true;
   
   }
   
   actions
   {
      action change_pirate_need { need: NEED_GROG; amount: 50;}
      action change_pirate_need { need: NEED_SLEEP; amount: 50;}
      action change_pirate_need { need: NEED_GRUB; amount: 50;}
      action change_pirate_need { need: NEED_ENTERTAINMENT; amount: 50;}
      action change_pirate_need { need: NEED_WENCHING; amount: 50;}
      action change_pirate_need { need: NEED_HOARD; amount: 50;}
   }

Sorry for hijacking this thread, but I believe the principles can be applied to FieryDove's problem
Report to moderator   Logged
jonedwards
Tourist
*
Offline Offline

Posts: 49


I'm a llama!


« Reply #8 on: 04/21/03 at 09:43 PM »

That looks right. You need to change the individual needs or satisfactions if you want them to have a lasting effect on overall happiness. The "overall" is just an average of the individuals satisfactions, double-weighting the lowest satisfaction.

You should also be able to say

  actions
   {
      action change_pirate_satisfaction { satisfaction : SATISFACTION_FEASTING; amount: 50;}
      action change_pirate_satisfaction { satisfaction : SATISFACTION_SHELTER; amount: 50;}
      action change_pirate_satisfaction { satisfaction : SATISFACTION_ALCHOHOL ; amount: 50;}
     
     // etc...
   }

I'll check to see if there's something wrong with change_pirate_satisfaction if you say

action change_pirate_satisfaction { amount: 64; }
Report to moderator   Logged
Aphex
Tourist
*
Offline Offline

Posts: 10


I'm a pirate!


« Reply #9 on: 04/22/03 at 07:58 PM »

After some time testing I found that the action change_pirate_need consequently affect the pirate happiness as all the pirates have their needs fullfilled. It also causes the pirates to stay on their ships after cruising as they dont feel the need to go anywhere becase their needs are fulfilled. The satisfaction buildings where now only used by wealthy captives so that order and fear can be raised in that area because no pirates go there. I dont remember exactly but overall satisfaction stays around 90%. I guess the script make things too easy so a reduction in the inividual amounts should probably be applied.
« Last Edit: 04/22/03 at 08:01 PM by Aphex » Report to moderator   Logged
FieryDove
Peasant
**
Offline Offline

Gender: Female
Posts: 59


Frequent Flyer


WWW
« Reply #10 on: 04/23/03 at 05:14 PM »

Well glad you got the pirates mostly ironed out!

I'm taking a break for the moment on scripting, spending far too much time trying to get the captives needs/satisafactions/resignations set without much success. Sigh...

Cheers,
FD

Report to moderator   Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
Cafe Tropico  |  Tropico 2: Pirate Cove  |  Pirate Cove Editor/Scripting Help (Moderator: CafeDave)  |  Topic: Question 2 - working_captive_happiness
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!