Scripting updates

Scripting updates

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Fnordia
Former Engine Dev
Posts: 425
Joined: 13 Aug 2004, 16:11

Scripting updates

Post by Fnordia »

The plan is to eventually implement a new scripting language for units, and probably improve the scripting model as well. But in the meantime we were thinking of improving the current one a bit. We are currently thinking of adding death animations (allowing Killed to run more than one frame probably), adding support for more weapons, and perhaps some more get/set stuff such as health. So are there any other script updates people would like to see?
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

http://taspring.clan-sy.com/phpbb/viewtopic.php?t=2030 :D

Something like this :)

how about a way to make ejecting brass? currently they are being exploded out of units I.E. the Vulcan, i'd like a vector for ejecting objects like brass and Sabots. that'd help us WD guys out :)
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

A mod to change unit health has already been made:

http://www.fileuniverse.com/?p=showitem&ID=1049
User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz »

are Trident-style (i.e. shooting from under water out of water) missiles implemented yet? or other weapons? I thought it'd be cool if there were anti-submarine tunneling-lasers or junk like that for TA as well

[edit]I'll make that question a bit broader: is it possible to make weapons that completely disregard the air/water barrier altogether yet?[/edit]
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Can we also have missiles that go under the ground to explode beneath units?

(Balance wise they'd just be like normal missiles that your oppponent doesn't see coming)
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

We ( the mod community ) should come up with a spec for unit scripting and making we'd like to see... i would suggest makign a smaple unit with all approriate files and stuff with everything in proper syntax and all. This is for the eventual N U F of course...


Fnordia: One thing i would suggest is giving us the flexibility to define in the scipritng language itself the special properties of units (define exactly what happens on create, or Transport) for example, while hardcoding as little of it as possible. Since the engine isn't terribly optimized, it is also extremely flexible and that flexibility could really be levarged for the NUF.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Make it so that we can edit the tags in the units fbi using the script
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

I'm not a unit maker, but haing a good way to restrict how the weapons can aim would be cool. (You certainly have to modify how the unit move and aim too)
Papasky
Posts: 22
Joined: 27 Aug 2005, 14:21

Post by Papasky »

Another cool thing would be to have the possibility to make propulsion of spaceships look more .... "spaceshipish", you know, with lights effects and maybe with different colors available (typically purple blue green or red), as in most things featuring spaceships. That's just a detail but that doesn't look like it would be hard to implement.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

Animating/changing textures, so the metal makers can flash when they are wokring again.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Come to think of it allowing the changing of fbi tags in the scripts would allow a lot of things to work.

For these examples I am going to use the syntax:

set-fbi [fbi tag] to [value];

ie: set-fbi CanMove to 1;

Mobile Metal Extractor:

StopMoving()
{
set-fbi CanMove to 0;
set-fbi ExtractsMetal to 0.003;
startspin Extractor around y-axis speed 100;
set-fbi EnergyUse to 3;
set-fbi TEDClass to; //set to a building TED class
set-fbi MovementClass to 0; //set this to a movementclass for buildings
}

StartMoving ()
{
set-fbi CanMove to 1;
set-fbi ExtractsMetal to 0;
stopspin Extractor;
set-fbi EnergyUse to 0;
set-fbi TEDClass to; //set to a kbot or whatever TED class
set-fbi MovementClass to 0; //set this to a movementclass for a kbot or whatever
}

(Actually, you'd probably have to put that coding in the on/off script, but I can't remember how on/off works off the top of my head)

Buildings building Buildings:

Create()
{
set-fbi CanMove to 0;
set-fbi MovementClass to 0; //set this to a movementclass for buildings
set-fbi TEDClass to; //set to a building TED class
}

Addons (ie upgrades - Buildings, which stay put, only):

Create()
{
set-fbi CanMove to 0;
set-fbi MovementClass to 0; //set this to a movementclass for buildings
set-fbi TEDClass to; //set to a building TED class
}

(If you plan to have multiple addons on a building at once you'd have to add a script to the building that changes where things are built)

Kbot that turns into a plane (rather complicated)

TransformtoAir()
{
//insert tranformation anim here
set-fbi CanFly to 1;
set-fbi CruiseAlt to 90;
set-fbi FlareDelay to 0.3;
set-fbi FlareDropVector to 0.3;
set-fbi FlareEfficieny to 0.3;
set-fbi FlareReload to 0.3;
set-fbi HoverAttack to 1;
set-fbi LeavesTracks to 0;
set-fbi MaxVelocity to 9; //makes sense to increase the speed
set-fbi MovementClass to 0; //set this to a movementclass for aircraft
set-fbi SightDistance to 150; //makes sense to have a larger sight range higher up
set-fbi SoundCategory to; //set to an aircraft category. Again, just makes sense
TransformedtoAir = 1; // this is a static-var
TransformedtoGround = 0; // this is a static-var
set-fbi TEDClass to; //set to aircraft TED class
set-fbi TurnRate to 100; //aircraft can (usually) turn faster than stuff on the ground
}

More than 3 weapons (well, sort of. You can only have 3 weapons at any one time but you can change them around a bit)

WeaponSwitch()
{
// Weapon switching animations here
Weaponset=Weaponset + 1; //static-var mcfiddlery
set-fbi Weapon1 to; //insert weapon name here
set-fbi Weapon2 to; //insert weapon name here
set-fbi Weapon3 to; //insert weapon name here
set-fbi wpri_badTargetCategory to; //insert class here
set-fbi wsec_badTargetCategory to; //insert class here
set-fbi wspe_badTargetCategory to; //insert class here
}
User avatar
Min3mat
Posts: 3455
Joined: 17 Nov 2004, 20:19

Post by Min3mat »

if thats possible that would be incredible
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

Moving extractor?

That would make a damn cool floating metal extractor, i.e. a drilling ship/ minig platform....
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

That would be pretty need to toggle FBI tags...would be cool to have an aircraft be a ground unit for as long as it takes for it to get enough velocity to take off :)
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

I would like to point out my post in this topic: http://taspring.clan-sy.com/phpbb/viewt ... 3&start=20

C-Style OOP for scripting -> SEX
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

The ability to play sounds from the script at will.

The ability to kill units via the script.

The ability to increase/decrease speed via the script.

The ability for units to have cone of vision LOS as opposed to circular (if that is even scripting related)

The ability to have different modes of speed, and different modes of combat, so that you can have infantry that can commando crawl, walk, and run, depending on the situation; and fire in all three.

Most of all; if you aren't going to implement skeletal animation (please, please, please, please!), make the animation scripting easier...
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

skeletal= moving torso with child arms also move arms automatically if specified?
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Re: Scripting updates

Post by PauloMorfeo »

Fnordia wrote:... So are there any other script updates people would like to see?
Are you asking what other possibilities we would like to have in the script of a unit?

If so, many ideas must already be in the thread where you asked about a new unit format (like the possibility of having mana and stuff).
As for something more, i'm blank of ideas right now. Maybe if i knew better how the units scripts work...
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

First, I'd like to have all TA:K scripting possibilities, such as
#define WEAPON_AIM_ABORTED 21
#define WEAPON_READY 22
#define WEAPON_LAUNCH_NOW 23
#define FINISHED_DYING 26
#define ORIENTATION 27
#define IN_WATER 28
#define CURRENT_SPEED 29
#define MAGIC_DEATH 31
#define VETERAN_LEVEL 32
#define ON_ROAD 34
These are values we can "get", as listed in Scriptor's exptype.h Ok, I don't know what the first 4 do, I just found out how to use get XZ_ATAN to replace get ORIENTATION, get IN_WATER is useless with setSFXocccupy(...), MAGIC_DEATH probably doesn't apply to Spring units, an ON_ROAD doesn't make much sense now that we have such a variety of terrain type.

So remains;
get VETERAN_LEVEL and get CURRENT_SPEED.

Gnome already added get VETERAN_LEVEL to the code and it worked, so just read how he did it and include that in the next build.

TA:K had stuff like:
set WEAPON_LAUNCH_NOW to weapon;
play-sound( "FIREDEM", PLAYSOUND_PRIORITY_BATTLE );

I don't fully understand how weapons work in TA:K, but the play-sound function would be nice

I have to read more TA:K script, but I'm sure there's other nice ideas in them.



Reading and changing every FBI values of the unit on the fly sure is something I would like.





Currently I need a way for scripts to read the unitlimit. Because for now I assume it's 500*10, but it isn't clean to make such assumptions. Also, I'd need a way to read if a ID is a unused ID, the ID of a unit belonging to the player, the ID of a unit belonging to an ally, or the ID of a enemy unit. Just making sure each player have a reserved range of ID, like in TA, would already help. For in TA, I can just check if all values are 0 to see if it's an unused ID (without risking to crash, while spring crash wen getting some properties of unused ID), and in TA I can know if a unit being to same player or not by seeing if IDs are in the same [(500k)+1 ,500(k+1)] range, while in Spring I can't because all player use the same pool of unit ID. Oh and something to know the ID of itslef, too, cause currently I'm just looking for any unit with the same xz and y as the base piece, but that can fails if two units are at the exact same position.

I'd like AimPrimary to be no only AimPrimary(heading,pitch) but AimPrimary(heading,pitch,id,xz,y)
id would be the id of the targetted unit, or 0 if firing on ground (btw, make the id range 1-5000 not 0-4999), and xz and y would be the coordinates of the target.

I also wish AimPrimary wouldn't be called so constantly.

Also, instead of AimFromPrimary, AimPrimary, QueryPrimary FirePrimary, I'd like them to be named AimFromWeapon1, AimWeapon1, QueryWeapon1, FireWeapon1, and have it so each unit can sport an infinite number of weapons instead of only three.

I'd like a command "find_me_another_target_I_dont_like_that_one" so the script could force the engine to look for another target. It would help scripting weapons with limited fire arc for instance.

And another command "fire_that_weapon_with_that_heading_and_that_pitch_even_if_there_is_no_enemy_and_the_player_hasn't_asked_you_to_fire" so we can script-force-fire weapon.

And two command to kill a unit, one with a normal kill where the killed unit explode and all, and another where the killed unit is just quielty deleted, with no sound no explosion no veterancy increment,... And not just killing the unit whose script we're scripting, but killing any unit from any other unit script (by giving the ID of the unit to kill).
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

A script that detects when the unit is hit and where, call it OnHit(piecename, weaponname,x,y,z) or something. That would be nice. Then you could make units go immobile if hit in the tracks or legs (if fbi tag changing is allowed):

Code: Select all

OnHit(piecename, weaponname, x, y, z)
	{
	if Hit(leg1lower, anyweapon, ANY, ANY, ANY) // ANY command says if this piece is hit at ANY value. anyweapon, hit by any weapon
		{
		explode leg1lower type	SHATTER | BITMAP4;
		hide leg1lower;
		move body to y-axis -20 NOW; //this makes the body collapse onto the floor. Exact move required would need a bit of testing of course
		set-fbi CanMove to 0;
		set-fbi MovementClass to 0; //set this to a movementclass for buildings
		set-fbi TEDClass to; //set to a building TED class
		}
	if Hit(leg1upper, anyweapon, ANY, ANY, ANY)
		{
		explode leg1upper type	SHATTER | BITMAP4;
		hide leg1lower;
		move body to y-axis -20 NOW;
		set-fbi CanMove to 0;
		set-fbi MovementClass to 0; //set this to a movementclass for buildings
		set-fbi TEDClass to; //set to a building TED class
		}
	if Hit(leg2lower, anyweapon, ANY, ANY, ANY)
		{
		explode leg2lower type	SHATTER | BITMAP4;
		hide leg2lower;
		move body to y-axis -20 NOW;
		set-fbi CanMove to 0;
		set-fbi MovementClass to 0; //set this to a movementclass for buildings
		set-fbi TEDClass to; //set to a building TED class
		}
	if Hit(leg2upper, anyweapon, ANY, ANY, ANY)
		{
		explode leg2upper type	SHATTER | BITMAP4;
		hide leg2lower;
		move body to y-axis -20 NOW;
		set-fbi CanMove to 0;
		set-fbi MovementClass to 0; //set this to a movementclass for buildings
		set-fbi TEDClass to; //set to a building TED class
		}
}
Post Reply

Return to “Engine”