Goto https://www.stucuk.netGoto https://www.atlanticaonlinewiki.comGoto https://www.game-requirements.com


Menu


It is currently Mon Oct 23, 2017 9:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Need help with sail
PostPosted: Sat May 21, 2016 4:39 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
Hi, i'm working on a mod and its working fine but i'm working at the last mission and i figure out how to do something.
I want a character to say someting that i put in text.txt but i want him to say that when a vehicle construction has begun and also i want to say something else when the vehicle is finished.
I searched in sail the functions and events section but i didn' t find something usefull for this or maybe it is but i'm to stupid to figure this out.
I found this on events:

"VehicleConstructionStarted"

"VehicleConstructed"
And I don't know how to use them i mean i tried but it didn't work because i must put an id of a factory .. problem is that on the map isn't a factory placed cuz when in gamemode i want to build the factory myself i mean building a base from 0.

So how can I use this commands without putting a factory on the map from the beggining?


If you can send me a code that works i'll be thankfull.




Thank you in advance :)


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sat May 21, 2016 9:42 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Mar 17, 2008 6:03 pm
Posts: 1129
Location: Denmark
You found the tool, you just need to use it right. Unlike functions do don't call an event. It is automatically triggered when something happens and info regarding the event is exposed in the parameters. Take for instance event "VehicleConstructionStarted".

Code:
On VehicleConstructionStarted(factory, chassis, engine, control, weapon) do
     begin
          //if GetSide(factory) = 1 and engine = engine_siberite then
     end;


In this case we get the id of the factory where the vehicle construction started as well as the design of the vehicle.

_________________
I have an if that has an else, but that if has another if with an else inside... My question is... If an if has an else, if there is more than one line in that if, should it have a begin and an end?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sat May 21, 2016 9:52 pm 
Offline
OW Support Owner
OW Support Owner
User avatar

Joined: Wed Dec 28, 2005 11:13 pm
Posts: 4988
Location: UK, Scotland
You would likely want to store the building ID from VehicleConstructionStarted if the vehicle being constructed had the parts you desire so that you can have the guy talk when VehicleConstructed is fired with the same building id. Likely also want a variable to store if the speech has already been triggered so it doesn't happen with every vehicle constructed.

_________________
Image
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sat May 21, 2016 10:31 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
You remember mission 13 in the american campaign when you had to build a siberium rocket ? When it started construction John Macmillan was reporting to powell and this is exactly what i want exactly the same code but on my mod.


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sat May 21, 2016 10:40 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
But i figure it out you helped me a lot thank you very much

:)


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 2:17 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
stucuk wrote:
You would likely want to store the building ID from VehicleConstructionStarted if the vehicle being constructed had the parts you desire so that you can have the guy talk when VehicleConstructed is fired with the same building id. Likely also want a variable to store if the speech has already been triggered so it doesn't happen with every vehicle constructed.




I didn't think at that . How can I store the id and the code so it doesn't do the speech at every vehicle constructed?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 4:20 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Mar 17, 2008 6:03 pm
Posts: 1129
Location: Denmark
Some global variables.

Code:
Export fact_id, dialogue_spoken;

Starting
begin
     fact_id = 0;
     dialogue_spoken = false;
end;

On VehicleConstructionStarted(factory, chassis, engine, control, weapon) do
     begin
          if fact_id = 0 and [some design criteria] then
               fact_id = factory;
     end;

On VehicleConstructed(vehicle, factory) do
     begin
          if fact_id = factory and not dialogue_spoken then
               //dialogue
     end;

_________________
I have an if that has an else, but that if has another if with an else inside... My question is... If an if has an else, if there is more than one line in that if, should it have a begin and an end?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 6:13 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
McBenn wrote:
Some global variables.

Code:


          if fact_id = 0 and [some design criteria] then
       



What kind of design should i put in?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 6:17 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Mar 17, 2008 6:03 pm
Posts: 1129
Location: Denmark
Dunno, it's your mission. It was just a demonstration. Btw this setup, where you check if the same factory that started constructing something has finished constructing something, is a bad idea since you can cancel a vehicle production. Better just to check things at VehicleConstructed - if that's what you're aiming at of course.

_________________
I have an if that has an else, but that if has another if with an else inside... My question is... If an if has an else, if there is more than one line in that if, should it have a begin and an end?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 6:29 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
McBenn wrote:
Dunno, it's your mission. It was just a demonstration. Btw this setup, where you check if the same factory that started constructing something has finished constructing something, is a bad idea since you can cancel a vehicle production. Better just to check things at VehicleConstructed - if that's what you're aiming at of course.


In this mission i want exactly like in the mission 13 from us campaign , exactly the same and i mean it can be the "us_siberium_rocket" at design ?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 7:43 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Mar 17, 2008 6:03 pm
Posts: 1129
Location: Denmark
Then I guess "if weapon = us_siberium_rocket then", or "if GetWeapon(vehicle) = us_siberium_rocket then".

_________________
I have an if that has an else, but that if has another if with an else inside... My question is... If an if has an else, if there is more than one line in that if, should it have a begin and an end?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 7:58 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
McBenn wrote:
Then I guess "if weapon = us_siberium_rocket then", or "if GetWeapon(vehicle) = us_siberium_rocket then".



Ok and can u tell me again how can i set this code to do it just once , i mean just for that vehicle and just once not every time i start the construction of the vehicle.


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 9:18 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Mar 17, 2008 6:03 pm
Posts: 1129
Location: Denmark
Something along the line of

Code:
Export dialogue_spoken;

Starting
begin
     dialogue_spoken = false;
end;

On VehicleConstructionStarted(factory, chassis, engine, control, weapon) do
     begin
          if weapon = us_siberium_rocket and not dialogue_spoken then
               begin
                    dialogue_spoken = true;
                    //Dialogue goes here
               end;
     end;

_________________
I have an if that has an else, but that if has another if with an else inside... My question is... If an if has an else, if there is more than one line in that if, should it have a begin and an end?


Top
 Profile  
 
 Post subject: Re: Need help with sail
PostPosted: Sun May 22, 2016 9:31 pm 
Offline
Soldier level 0
Soldier level 0

Joined: Sun May 01, 2016 1:36 pm
Posts: 9
Ok it worked , thank you very much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Original War is an RTS / RPG game by Altar Games
Original War Support is not part of Altar Games but is maintaining Original War for Altar Games

Privacy Policy