Basic stuff

Smellis

New member
Joined
May 22, 2011
Messages
22
Hello
I am having a few problems with making my map work or at least the most basic of scripts like creating a creature. i can make it work if i put it into my startup script but if i did that with all the scripts wouldnt it get a little cluttered? can someone tell me how to make a new script with create a creature? or can anyone link/send me an example of their scripts?
thank you.

ps the compiler says it compiles the new scripts successfully but they have no effect ingame.
 
 
   I think the 'generic' script file would be something good to look at. This includes several major actions like creature selection and creation.
[ http://www.bwfiles.com/files/file.php?id=1108 ]

  CreatureSelect.txt performs selection and creation. Keep in mind, if you don't create the creature in your 'startup script,' you must of course call the function that creates the creature at some point.

An Example (I think this works.. if I'm wrong, oops). The position {X,Y,Z} would need to be adjusted for the map:

Mainscript.txt
Code:
define script CreatureCreate

run script MainScript

begin script MainScript
start

   disable load screen
   set fade in time 5

   run script CreatureCreate

end script MainScript

 

Creature.txt
Code:
begin script CreatureCreate
start

   playercreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {1000,1000,1000} using only alignment good neutral evil
   set player 0 creature to playercreature

end script CreatureCreate

   Finally, when compiled, both .txt files must be specified on the command line.

-ego533
 
 
thanks for the reply, going by your example i have attempted a simple pair of scripts

Code:
Define script creatureselect

run script WikiTutorialScript

begin script WikiTutorialScript

start
	disable load screen
	set fade in time 1
	run script creatureselect

	wait until 1 != 1
end script WikiTutorialScript

Code:
begin script CreateCreature
	oTown = get town with id 0
	oPen = get building ABODE_NUMBER_CREATURE_PEN in oTown min built 1.0
           oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {oPen} using only alignment good neutral evil
start
	set oCreature home position {oPen}
	set creature oCreature happiness to maximum
	set creature oCreature energy to 1.0
	set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 1.0
	set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	set player 0 creature to oCreature

end script CreateCreature

The compiler doesnt like this can anyone see why?

Edit: nevermind i noticed my silly mistake with the completely wrong script names lol sorry all.... ps does the order it goes into the challenge txt matter?
 
 
   I'm not entirely sure what you mean by challenge txt. If you're referring to the challenges.txt file which the sample "BW2 Scripts Test Batch.bat" uses, yes the order apparently matters.

   This is actually a mistake I made.. I misunderstood what 'define script' does. I thought it was for doing something like include files in a programming language. Apparently, it only declares scripts within the file for which they are actually defined. For instance, if I have a file which defines "mainscript", which uses "creaturecreate", but creaturecreate is defined in the same file below the definition of mainscript, the compiler will show a warning (and possibly not work as intended). 'define script' is used to declare the correct use of a script (and its parameters) if the script is to be called before it is actually defined (within the same file).

   So, again, yes the order matters. To correct my example above: remove the [ define script CreatureCreate ]  line and make sure to have Creature.txt before MainScript.txt in the list of files to compile. (Also move the [ playercreature = ] line to the var declaration section, before "start" ... )

-ego533
 
 
thank you. im very new to it and im slowly picking some of it up... i guess.
 
Back
Top