Starcraft: spring on mar-sara - Page 4

Starcraft: spring on mar-sara

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
maackey
Posts: 490
Joined: 02 Jul 2008, 07:11

Re: Starcraft: spring on mar-sara

Post by maackey »

They're scripts to perform animations, that are in lua instead of cob. That is why I call them lua animations. I really don't see whats wrong with calling them that. What incorrect inferred information are you referring to?
User avatar
smoke_th
Posts: 140
Joined: 25 May 2010, 13:15

Re: Starcraft: spring on mar-sara

Post by smoke_th »

maackey wrote:They're scripts to perform animations, that are in lua instead of cob. That is why I call them lua animations. I really don't see whats wrong with calling them that. What incorrect inferred information are you referring to?
In fact its only his opinion because yes right i need lua coder not only for animations but for widgets and gadgets too.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Starcraft: spring on mar-sara

Post by Pressure Line »

smoke, you dont *need* lua to write unit scripts, you can still use the the bos/cob method, although tbh, they are not that different (in terms of writing a unit script)

Lua:

Code: Select all

	--pieces
	local base = piece "base"
	local turret = piece "turret"
	local barrel = piece "barrel"
	local flare = piece "flare"

	--signals
	local SIG_AIM = 2
	
	function script.Create()
		Hide(flare)       
	end
	
	local function RestoreAfterDelay(unitID)
		Sleep(2500)
		Turn(turret, y_axis, 0, math.rad(90))
        	Turn(barrel, x_axis, 0, math.rad(50))
	end

	function script.QueryWeapon1() return flare end
	
	function script.AimFromWeapon1() return turret end
	
	function script.AimWeapon1( heading, pitch )
		Signal(SIG_AIM)
		SetSignalMask(SIG_AIM)
        	Turn(turret, y_axis, heading, math.rad(90))
        	Turn(barrel, x_axis, -pitch, math.rad(50))
        	WaitForTurn(turret, y_axis)
        	WaitForTurn(barrel, x_axis)
		StartThread(RestoreAfterDelay)
		return true
	end
	
	function script.FireWeapon1()
	       Sleep(30)
	end
	
	function script.Killed(recentDamage, maxHealth)
		Sleep(30)
	end
bos/cob

Code: Select all

#include "sfxtype.h"
#include "exptype.h"

piece  base, turret, barrel, flare;

static-var  restore_delay;

// Signal definitions
#define SIG_AIM	2

Create()
{
	hide flare;
}

RestoreAfterDelay()
{
	sleep 2500;
	turn turret to y-axis <0.000000> speed <90>;
	turn barrel to x-axis <0.000000> speed <50>;
}


QueryWeapon1(piecenum)
{
	piecenum = flare;
}

AimFromWeapon1(piecenum)
{
	piecenum = turret;
}

AimWepon1(heading, pitch)
{
	signal SIG_AIM;
	set-signal-mask SIG_AIM;
		turn turret to y-axis heading speed <90>;
		turn barrel to x-axis 0 - pitch speed <50>;
		wait-for-turn turret around y-axis;
		wait-for-turn barrel around x-axis;
	start-script RestoreAfterDelay();
	return (1);
}

FireWeapon1()
{
	sleep 30;
}

Killed(severity, corpsetype)
{
	sleep 30;
}
Except for the minor formatting differences, these scripts are identical.

The inference that Forb is referring to is that moving to lua scripts for unit animation allows for things that bos can't do. While there ARE some things to do with animation that you can do with Lua that you can't with bos, as well as easier integration with Lua gadgets but for 'My First Spring GameÔäó' it's probably not going to make a difference.
User avatar
smoke_th
Posts: 140
Joined: 25 May 2010, 13:15

Re: Starcraft: spring on mar-sara

Post by smoke_th »

Hmm....well that i calling good example. =) Thank you.
As i can see lua haves () syntax for data, but still cob using to write it right after call without (). Only question, I can put ready lua scripts in same folder like /<modname>/scripts/ where cob files are? So now i don't understand why authors of the game still using cob neither lua. It's need to be compiled..of course old TA animations on it. But still....how do you think, maybe easier make syntax converter, hm?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Starcraft: spring on mar-sara

Post by yuritch »

(the following is only my opinion on the subject)
COB is still supported because of (at least) those factors:
- many people know it;
- (probably more important) many games are using it and no one is going to convert all of those to lua scripts.

And it's good that way. lua scripting is more powerful and so is better for new projects.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Starcraft: spring on mar-sara

Post by AF »

If you already have a BOS script:

Keep it in BOS/COB until you need to convert

Otherwise if starting anew:

Use lua.

Always use the lua scripting for unit animations, but dont be religious about it and convert existing BOS animations that work fine. If its not broke, dont fix it
Post Reply

Return to “Game Development”