Go to Cafe Tropico Cafe Tropico
Go to the Blue Parrot Inn
Search:     Advanced search
05/23/13 at 05:29 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: Scripting Question
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Scripting Question  (Read 661 times)
0 Members and 1 Guest are viewing this topic.
abstechno
Guest
« on: 07/30/03 at 08:12 PM »

I created a script and scenario map and it ran fine except I never got any Shipwrecked captives. So, I found the Shipwrecked Mariners.txt and copied those script lines into mine and tried to run it. The errors in the game were referencing these lines. What am I doing wrong and how do you get shipwrecked captives? I am new to the scripting thing and am trying to learn.  Any help would be appreciated. Thanks in advance.
Report to moderator   Logged
pirate jenny
Tourist
*
Offline Offline

Posts: 19



« Reply #1 on: 10/12/07 at 08:14 PM »

I realize that this question was asked four years ago, and that the person asking has almost certainly either figured it out by now or else doesn't care anymore.  But, since nobody else had answered, and I happen to know how to do this, I figured that I'd offer my two pieces o' eight in case anyone else was wondering.  I got the code from TJ's random adventures script and now include it in all my custom games.  I like it a lot better than having a patron give me captives.

In your initial setup, where action enable_game_data_override {} is located, add this:

Code:
action assert_float { name: "shipwreck_chance"; value: 0.0; }
action assert_int { name: "shipwreck_check_tick"; value: (game_tick + 150); }

Then, after your other rules, add this:

Code:
//
// Rule: shipwrecked_mariners_check
// Description: Checks every <N> ticks whether a shipwreck should occur. The chance of
// a shipwreck starts at 0% and increases <DELTA> amount every check.
//
rule shipwrecked_mariners_check
{
frequency tick;

conditions
{
game_tick >= shipwreck_check_tick;
}
actions
{
action assert_int { name: "shipwreck_check_tick"; value: (shipwreck_check_tick + 300); }
action evaluate_rule { name: "shipwrecked_mariners_check_sub1"; }
}
}

rule shipwrecked_mariners_check_sub1
{
frequency invokation;

conditions
{
always_true;
}
actions
{
action assert_float { name: "shipwreck_chance"; value: (shipwreck_chance + 0.01); }
action evaluate_rule { name: "shipwrecked_mariners_check_sub2"; }
}
}

rule shipwrecked_mariners_check_sub2
{
frequency invokation;

conditions
{
random_0_to_1 < shipwreck_chance;
}
actions
{
action assert_int { name: "num_survivors"; value: random_number(1, 5); }
action create_message_dialog
{
title: "/text/dial/scen/ship/titl";
body: pattern_string("/text/dial/scen/ship/mess", num_survivors);
artType: "illu";
pictureID: "wrec";
}

action add_unskilled { amount: num_survivors; species: "ugen"; nationality: random_nationality; }
action assert_float { name: "shipwreck_chance"; value: 0.0; }
action retract { name: "num_survivors"; }
}
}

Good luck!
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: Scripting Question
 
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!