Creature Scripting

Daxter_06

New member
Joined
May 9, 2006
Messages
458
One quick question, the age of the creature, is by default the maximum when you first create it through script, however I am wondering if there is a way to set it to young, you know like the tutorial island at the start of the Black & White 2 campaign.
 
Lol, I never noticed that. ???

You can change the size of the creature in script and it will look young. But I don't know about the age.
 
Lol, I didn't know how to put it, besides age is better to say then size, cause why would you want to be small and look like a baby. Just like a creature.

Anyways, I meant to say size. And it's not easy as writing "SCRIPT_OBJECT_PROPERTY_TYPE_MAXSIZE or MINSIZE or oCreature = 0".

Ideas?  ???
 
Code:
set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.35


0.35 is minimum size, 1.0 is full grown
 
Kays said:
Code:
set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.35


0.35 is minimum size, 1.0 is full grown

Would this work because, I tried this and an error in compiler appears, saying "error...error near '0' expecting 'DEVELOPMENT'. "

But I'll try it anyway using the min and max you have pointed out.
 
That's what I used on the Lion Pride map to get the two lion cubs.

It is listed in the documentation.
 
Kays said:
That's what I used on the Lion Pride map to get the two lion cubs.

It is listed in the documentation.

Sorry, I made one small mistake with it, but it's fine now. Thanks.

Topic can now be locked.
 
Next question. Saving a creature in a map and loading in a new map.

I've noticed that:

Code:
load my_creature at {positon}

Doesn't work. Any ideas on how to get this to work. Save my_creature works but
when I try to put the creature in a new map nothing happens.

I've tried:

Code:
MyCreature = get player 0 creature
load creature get MyCreature...........

An error appears after "get" but it's part of this. Any help?

Code:
error: parse error expecting 'V_STRING' or 'CONSTANT' or 'STATE' or 'GET' or 'IDENTIFIER'.
 
Never mind. I've got it to work with this code:

Code:
MyCreature = get player 0 creature
oTown = get town with id 0

load creature get MyCreature type "my_creature" player 0 at {oTown}+{0,0,30}

I had to fiddle around with different commands and finally got that one to work. It's not in the documentation so don't try to look for it.
 
You're just amazing with some of the stuff you're coming up with. :yes

Would this also work to move a creature to a new location on the same map? Like an island.
 
I do hope so, its only an early look at this and I haven't tried all its possibilities and outcomes.
But before trying anything I need to clarify that it will work each time you use it. Shouldn't take long.

But here's something more interesting. The visual effects editor in the Landscape Editor can be used to create new visual effects, yes. Here's the thing about that, if you can create an awesome visual effect and save it,

e.g. If I create a megablast that's an all-in-one effect and save as "Megablast.ves" then I can display it in the game using the code:

Code:
BlastPos = marker at {ENTER POS HERE}
MegablastFX = create visual effect "Megablast.ves" strength 0.5 scale 1 at {BlastPos} time 1

And voila a new custom miracle with a custom visual effect.
 
Thanks, I took a quick look at the visual effect editor and it has me baffled. How do you use it to create a visual effect?
 
It is kind of difficult to use but there should be some documentation on it in the Landscape Editor folder.

But if I learn to use it properly and am competent that I can get this to work. I'll write a tutorial for people to try it and perhaps learn to use it.

With this, I think that worrying about new visual effects in the future will not be a problem.
 
Okay, tests on saving and loading creatures are complete.

i've found that in order to properly load a player's creature into the game e.g. from one land to the next, they must only use this code at the end of the main script otherwise it will conflict with scripts that are loading.

Second, to get a creature into a map, you must give exact co-ordinates to where you want it to appear.

Thridly, once the creature is loaded successfully, you must release it from its confined position. You do this by saying 'stop MyCreature moving', then ' release MyCreature'. This will ensure that the creature can move around freely.

Fourthly, to correctly load a creature into the game, you must save it before loading the next map. As in Kays TakeOverStatus before, stopping the lands main script, ensure to save my_creature first, then load the next map after it.

Here's an example.

Code:
	wait 4 seconds
	save my_creature
	stop script "Land2872Script"
	load map "./Data/Landscape/BW2/Land2873.bwe"

Lastly, only by loading a creature into the game, will it have proper behaviour and act more natural.

If you follow these procedures properly, then you can save, delete and load a creature wherever you wish, without any crashing. but make sure you add some waiting periods between, saving, deleting and loading your creature.

Enjoy!
 
You have been busy. :shocked

So the best way to do it from land to land is to run a script when the gold scroll is clicked to do this. Is it best to stop all other scripts first?

To move a creature betweeen two islands on the same land, is it possible to save and delete the creature and then load him in the new location?

 
Kays said:
You have been busy  :shocked

So the best way to do it from land to land is to run a script when the gold scroll is clicked to do this. Is it best to stop all other scripts first?

To move a creature betweeen two islands on the same land, is it possible to save and delete the creature and then load him in the new location?

Actually the little part in the code is in your script Kays, TakeOverStatus. here is the full version of it.

Code:
begin script TakeOverStatus
        oTown = get town with id 0
        1Town = get town with id 1
        3Town = get town with id 3
        4Town = get town with id 4
	isConverted = 0
	techLevel = 0
	Cnt = 0
        Video = 0
        Video2 = 0
        EndMap = 0
        TownTaken = 0
        EnemyWin = 0
	//numTowns = 5
                Vortex = 0
                Vortex2 = 0
                VolcanoPos = 0
                oVolcano = 0
                VolcanoPos2 = 0
                oVolcano2 = 0
                VortexPos = marker at {1927,70,2347}
                GoldScroll = 0

start
	Cnt = 1
	force while Cnt <= NUMBER_OF_TOWNS
		Town[Cnt] = get town with id Cnt
		TownStatus[Cnt] = 0
		Cnt++
	end while
	
	begin loop
		wait 1 seconds
		Cnt = 1
		Win = 1
		force while Cnt <= NUMBER_OF_TOWNS		
			if TownStatus[Cnt] == 0
				isConverted = variable get town Town[Cnt] method of last conversion
				techLevel = get tech level of town Town[Cnt]
				if isConverted != 0
                                     TownTaken = 1
					if techLevel == 0 and TownTaken  == 1
						increment tribute by 25000
						run background script TakeTownDialogue
                                                wait 6 seconds
                                                TownTaken = 0
					elsif techLevel == 1 and TownTaken  == 1
						increment tribute by 50000
						run background script TakeTownDialogue
                                                wait 6 seconds
                                                TownTaken = 0
					elsif techLevel == 2 and TownTaken == 1
						increment tribute by 100000
						run background script TakeTownDialogue
                                                wait 6 seconds
                                                TownTaken = 0
					end if
					TownStatus[Cnt] = 1
				else
					Win = 0
					TownTaken = 0
				end if
			end if
			Cnt++
		end while
	end loop
		until Win == 1
	
	wait 2 seconds
	increment tribute by 500000
	enable global influence

	wait 1 second
	set fade red 0 green 0 blue 0 time 2
	wait 2.5 seconds
		Vortex = create visual effect VISUAL_EFFECT_TELEPORTER_HOOP at {VortexPos} time -1
			begin cinema
				start music "creaturefightmain_03" loop forever
				set camera position to {-210,430,520}
				set camera focus to {3Town}
				set fade in time 1.5
				wait 2 seconds
				say single line "The land is yours, but Kronos knows of your presence. You must continue."
				wait 6 seconds
				clear dialogue
				move camera position to {1611,80,1899} time 13
				wait 1 second
				say single line "So, now it's time to return to a land you once knew. A land of great change and one you must save. The land that you were summoned to."
				wait 7 seconds
				move camera position to {VortexPos}+{-20,80,80} time 10
				move camera focus to {VortexPos} time 7
				clear dialogue
				wait 1 second
				say single line "When you are ready to leave, click on the gold scroll over the vortex."
				wait 6 seconds
				set fade red 0 green 0 blue 0 time 3
				wait 3 seconds
				set camera position to {oTown}+{30,70,60}
				set camera focus to {oTown}
				wait 1 second
				set fade in time 3
				wait 3 seconds
			end cinema
			GoldScroll = create highlight SCRIPT_HIGHLIGHT_INFO_SCRIPT_GOLD name "BW2_TEXT_CREATURE_ACTION_TEXT_2500" remind "BW2_TEXT_CREATURE_ACTION_TEXT_2500" at {VortexPos}+{5,10,0}
			wait 2 seconds

			wait until GoldScroll right clicked
				begin cinema
					say single line "Onto Land 3. Good luck and be prepared."
					move camera focus to {VortexPos} time 9
					move camera position to {VortexPos}+{0,80,0} time 7
					wait 6 seconds
					move camera position to {VortexPos} time 6
					set camera roll 360 time 10
					wait 3 seconds
					set fade red 0 green 0 blue 0 time 3
					wait 3 seconds
					stop music with fadetime 3
					wait 4 seconds
					save my_creature
					stop script "Land2872Script"
					load map "./Data/Landscape/BW2/Land2873.bwe"
				end cinema
end script TakeOverStatus

As for in the same land, you can do this but to ensure the game doesn't crash do it something like this.

Code:
MyCreature = get player 0 creature
Pos = marker at {EXACT COORDINATES}

save my_creature
  wait 3 seconds
delete MyCreature
  wait 4 seconds
load my_creature at {Pos}
 
Thanks. :)

That looks like an older version of the take over script. Works fine if it's one on one, but not if there's more than two gods . In a later version I checked to see if the town belonged to you instead.

Not to be picky,

Code:
wait until GoldScroll right clicked

The mouse buttons can be used either way. What I perfer to use is:

Code:
	begin loop
		wait until bindable action BINDABLE_ACTION_TYPE_ACTION performed
if GoldScroll right clicked or GoldScroll left clicked
 
I was going to ask you what's would be happening with towns taken, having tribute rewarded for the enemy taking them.

Well it wouldn't matter as long as the Gold scroll is clicked. However I would rather use right clicked because it is associated as the action button and it would seem strange to click the move button on it accidentally, but thanks I'll most likely change that.

Could I get a hold on that new script. It would really help me with ToTC.
 
Daxter said:
I was going to ask you what's would be happening with towns taken, having tribute rewarded for the enemy taking them.

In  the later version, I had fireworks written in. So if an opposing player took a town the fireworks would go off in that town as well as yours. And as well you got the tribute. And then after that nothing would happen when you finally took that town. :rolleyes

Well it wouldn't matter as long as the Gold scroll is clicked. However I would rather use right clicked because it is associated as the action button and it would seem strange to click the move button on it accidentally, but thanks I'll most likely change that.

The mouse buttons for BW2 are reversed from BW1. People new to the game will keep them as is but most who have played BW1 will reverse them. I found out the hard way the first time I tested the Epic scripts when Harmy was working on them. I clicked on one of the Epics to move and it set it of in my hand.  :shocked

Could I get a hold on that new script. It would really help me with ToTC.

Here's what I used in my last map. It includes the fireworks script which is fairly simple but neat. There's also a bit in there to trigger 00din's AI script which can be deleted.

Code:
begin script TakeOverStatus

	techLevel = 0
	Cnt = 0
	Win = 0
	Vis = 0
	RunAI = 0
	oTown = get town with id 0

start
	wait until oTown exists

	Cnt = 0
	force while Cnt < NUMBER_OF_TOWNS
		Town[Cnt] = get town with id Cnt
		TownStatus[Cnt] = 0
		set town Town[Cnt] desire for TOWN_DESIRE_TO_BREED to 1.0
		Cnt++
	end while

	Cnt = 1
	begin loop
		wait 1 seconds
		Cnt = 1
		Win = 1
		force while Cnt < NUMBER_OF_TOWNS
			
			if TownStatus[Cnt] == 1 and get Town[Cnt] player != 0
				TownStatus[Cnt] = 0
			end if
			
			if TownStatus[Cnt] == 0
				if get Town[Cnt] player == 0
					techLevel = get tech level of town Town[Cnt]
					if techLevel == 0
						increment tribute by 25000
					elsif techLevel == 1
						increment tribute by 50000
					elsif techLevel == 2
						increment tribute by 100000
					end if
										
					run background script Fireworks(Town[Cnt],30)
					run background script Fireworks(Town[0],30)
					TownStatus[Cnt] = 1
				else
					Win = 0
				end if
				
				if RunAI == 0 and town Town[Cnt] is under takeover from player 0
					run background script AIStuff
					RunAI++
				end if
			end if
			Cnt++
		end while
		
		
		until Win == 1
	end loop

Code:
begin script Fireworks(nTown,nTime)
	Cnt = 0
	Vis = 0
	Num = 0
start
	Cnt = 1
	begin loop
		Num = number from 1 to 3
		if Num == 1
			Vis = create visual effect VISUAL_EFFECT_GOLD_SCROLL at {nTown} time 1
		elsif Num == 2
			Vis = create visual effect VISUAL_EFFECT_SILVER_SCROLL at {nTown} time 1
		else
			Vis = create visual effect VISUAL_EFFECT_BRONZE_SCROLL at {nTown} time 1
		end if
		
		Vis = create visual effect VISUAL_EFFECT_FIREWORK_1 at {nTown} time 10
		wait 0.3 seconds
		Vis = create visual effect VISUAL_EFFECT_FIREWORK_2 at {nTown} time 10
		wait 0.3 seconds
		Vis = create visual effect VISUAL_EFFECT_FIREWORK_3 at {nTown} time 10
		wait 0.3 seconds
		Cnt++
		until Cnt == nTime
	end loop

end script Fireworks

 
Yes I see that. If you've played BnW1 for such a long time, then playing BnW2 with the controls switched its kind of hard, so I'll do about changing that.

I read somewhere about the new script, I guess I forgot about it, but I have it now, thanks. Sweet
 
Back
Top