Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

AngelScript Requests & Help

Reply
 
Thread Tools
minmay

JCF Member

Joined: Aug 2002

Posts: 1,181

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Oct 30, 2013, 06:28 PM
minmay is offline
Reply With Quote
I want to make a TNT-like explosion with a custom radius. So basically I want to recreate what appears to be a part of BEHAVIOR::TNT, but I have no way to see inside that behavior, and mine needs to as close as possible. Any help? I have no idea what the shape should be, how the force parameter passed to onObjectHit should be calculated, etc.

EDIT: Aaand another question so soon. Anyone have the code (or just a mathematical description) for pickups bobbing up and down?
Seems that calling behave() with draw = false gets rid of it, which makes sense. But I want a pickup with its own sprite, and without the bobbing it looks jarringly out of place among the original pickups.
I'm having trouble replicating it from observation, e.g. it isn't in sync with other pickups and stops when shot by bullets but not when moved by belts...

Last edited by minmay; Oct 30, 2013 at 10:38 PM.
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,803

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Oct 31, 2013, 01:53 AM
cooba is offline
Reply With Quote
Quote:
Originally Posted by minmay View Post
Anyone have the code (or just a mathematical description) for pickups bobbing up and down?
Code:
int frame = obj.objectID * 8 + jjGameTicks;

if (obj.yPos > jjWaterLevel) frame = frame*2 + (int(obj.xPos) + int(obj.yPos) * 256)*16;
else frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;

if (obj.ySpeed == 0) jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction);
else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction);
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Oct 31, 2013, 05:11 AM
DoubleGJ is offline
Reply With Quote
Quote:
Originally Posted by Jerrythabest View Post
AngryEgg? I see some Angry Birds game coming!

I modeled this little script idea after the Adventure Island game for NES, where you need to eat food to stay alive, but eggplants are not edible and instead hover over you with creepy music playing and make you starve faster. In reality I'm trying this out for something completely different, but making an Adventure Island-esque level by the way isn't a bad idea. :P
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Oct 31, 2013, 09:55 AM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by minmay View Post
I want to make a TNT-like explosion with a custom radius. So basically I want to recreate what appears to be a part of BEHAVIOR::TNT, but I have no way to see inside that behavior, and mine needs to as close as possible. Any help? I have no idea what the shape should be, how the force parameter passed to onObjectHit should be calculated, etc.
Umm... good luck. There's a lot of code required for doing this right that just isn't publicly exposed in the API yet. Calling onObjectHit is okay, but without more direct access to the underlying collision code, I'd honestly be tempted to spawn a bunch of invisible PLAYERBULLET objects in a circle around the explosion and give them .animSpeed values based on their distance from the center. For extra credit, you could also search through the object list, decide which ones are near enough, and if they have .isBlastable set to true, change their .xSpeed and .ySpeed values.
Quote:
But I want a pickup with its own sprite
For most cases, just calling determineCurAnim should be fine?
Quote:
Originally Posted by cooba View Post
Code:
int frame = obj.objectID * 8 + jjGameTicks;

if (obj.yPos > jjWaterLevel) frame = frame*2 + (int(obj.xPos) + int(obj.yPos) * 256)*16;
else frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;

if (obj.ySpeed == 0) jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction);
else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction);
urge to simplify rising
Code:
if (obj.ySpeed == 0) {

  int frame = obj.objectID * 8 + jjGameTicks;

  if (obj.yPos > jjWaterLevel) frame = frame*2 + (int(obj.xPos) + int(obj.yPos) * 256)*16;
  else frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;

  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction);
}
else obj.draw();
__________________
minmay

JCF Member

Joined: Aug 2002

Posts: 1,181

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Oct 31, 2013, 11:54 AM
minmay is offline
Reply With Quote
Quote:
Originally Posted by cooba View Post
Code:
int frame = obj.objectID * 8 + jjGameTicks;

if (obj.yPos > jjWaterLevel) frame = frame*2 + (int(obj.xPos) + int(obj.yPos) * 256)*16;
else frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;

if (obj.ySpeed == 0) jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction);
else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction);
Wow, that's really going above and beyond. Thanks very much.



Quote:
Originally Posted by Violet CLM View Post
For most cases, just calling determineCurAnim should be fine?
Correction, I want a palette-shifted pickup :P
Quote:
Originally Posted by Violet CLM View Post
urge to simplify rising
Bah, you didn't even convert those integer multiplications to bitshifts!

Last edited by minmay; Oct 31, 2013 at 11:58 AM. Reason: yes i know the compiler does it
minmay

JCF Member

Joined: Aug 2002

Posts: 1,181

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Oct 31, 2013, 04:45 PM
minmay is offline
Reply With Quote
Quote:
Originally Posted by minmay View Post
Is there any reliable way to check if a non-local player is spectating via AngelScript?
Quote:
Originally Posted by Violet CLM View Post
Testing their position for being inside the level (instead of at 0,0) seems to be the preferred method at present.
A note to anyone wanting to use this, from my observation it only works for servers. Clients don't always get the spectating player's position updated and end up holding onto their old position (unless they pass near 0,0?). Even if the server has alwaysupdatepos on.

EDIT: After some testing it looks like spectating players hold onto their blink value and it gets sent to other players, but doesn't decrement. I can set it to -210 (any lower, or above 0, and it gets reset before it can get sent to other players). Currently I'm using that to test for spectating; if it's possible for it to get sent to other players while lower than -209, then I don't seem to be catching it in onPlayer, and even if it is I can just make sure the value stays at -210 for two consecutive frames.

Last edited by minmay; Oct 31, 2013 at 05:31 PM.
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Nov 1, 2013, 04:23 AM
DoubleGJ is offline
Reply With Quote
Okay, more trouble.

I now have spawning objects in relevance to player position covered, but now I'm having trouble with object behavior. Specifically, I'm trying to spawn falling bricks that would behave exactly as if spawned by the Queen boss, minus the damage effect. Spawning works like it should, but the behavior is a problem. I looked through the documentation and I understand that enemy projectiles are unaccessible as objects as of now, so I had to experiment. Closest I got so far is modifying RF projectiles, which leave a rockety trail and explode on contact. It looks kind of cool, but because of the object type I don't know how to make them ignore walls they would fall from and I'd rather have them bump on a surface and then fall a little ways down like they originally do instead of exploding with a recoil effect (I'm doing this thing for a dramatic effect, not as harmful obstacles). Any suggestions?
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,803

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Nov 1, 2013, 05:02 AM
cooba is offline
Reply With Quote
You're looking for OBJECT::BOUNCEONCE.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 1, 2013, 08:49 AM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by DoubleGJ View Post
I looked through the documentation and I understand that enemy projectiles are unaccessible as objects as of now
Can you point me to what section is giving you that impression?
Quote:
because of the object type I don't know how to make them ignore walls they would fall from
That's actually because of the behavior, not the object type. Behavior is the only part of an object that concerns itself with the clipping mask.
__________________
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Nov 1, 2013, 09:51 AM
DoubleGJ is offline
Reply With Quote
Wow, I didn't expect it to be that simple. Then again, BOUNCEONCE seems extremely logical, but because of how it's named I never noticed it on my own. My suggestion would be to put this right under QUEEN in the documentation... Unless nobody else finds this unobvious?

At any rate, I got my desired script scene. I even finally figured out the distinction between objects and behaviors... I guess. It's almost perfect. The only thing I could use is the screen shaking exactly like when falling rocks are triggered, except continuously. To make things harder, this has to work in tandem with a limit x scroll moving a good ways through the level. I have absolutely no idea how to even approach this problem. :B

Quote:
Originally Posted by Violet CLM View Post
Can you point me to what section is giving you that impression?
Expected them to be indented right under corresponding enemies, then looked around and was too blind to find them, I suppose.
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 1, 2013, 10:12 AM
Violet CLM is offline
Reply With Quote
It would make a lot of sense to have it be BEHAVIOR::QUEENBULLET along with so many other boss sub-behaviors, I agree, but it has the relatively unique status of being its very own jjObjectPresets slot to contend with. I dunno. More extensive documentation of the various behaviors is a fine idea and also kind of a time-intensive one.

There's no AngelScript access to the camera-shaking code yet, basically because blur seemed to indicate in a comment somewhere that it was more complicated than he'd expected, so I've never taken the time to try it out. You could try shimming something together using jjPLAYER::cameraFreeze, but I don't know offhand how that would interact with the limit x scroll stuff.
__________________
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Nov 3, 2013, 02:49 AM
Jerrythabest is offline
Reply With Quote
In the weeks before joining the Plus team I actually annotated part of the camera control function for my Splitscreen Stereoscopy project. I've primarily focussed on the clearly controlled camera modes. Mostly the slides at the end of the level and during the Robot Boss cutscenes, and the code that keeps the camera pointed at one place. The part that I haven't fully annotated yet ('normal camera movement') almost certainly contains the nudging code (because 200 ops is somewhat more than I'd expect for just 'normal camera movement').

I figure we could hook the entire thing and expose several AngelScript functions to access its functionality.
__________________
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 11, 2013, 07:33 AM
P4rr0t is offline
Reply With Quote
Exclamation

Hi

Can you make Enter/Exit the door with AREA::PATH code? but i can't find "Doors" in angelscript code snippets.

See picture
s9.postimg.org/46baxl0vj/jc2.png

Enter Door - Pos: 215, 85
Exit Door - Pos: 8, 8
Text Message "Press UP to enter through the door!" & "Press UP to exit through the door!"

Thanks
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 14, 2013, 04:18 AM
P4rr0t is offline
Reply With Quote
Question

Soory double post!


angelscript doesn't work for me this entrance/exit door and more doors, can you help me?

Code:
void onPlayer() {
	if (jjEventGet(p.xPos/32, p.yPos/32) == AREA::PATH) {
		canvas.drawString(
			(215*32) - 4,
			(85*32) - 4,
			"Press UP to entrance door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
		canvas.drawString(
			(8*32) - 4,
			(8*32) - 4,
			"Press UP to exit door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
	}
		switch () {
			case 10:
				x = 215;    //Entrance door
				y = 85;
				break;
			case 11:
				x = 8;     //exit door
				y = 8;
				break;
			
		}
	}
}
Thanks

Last edited by P4rr0t; Nov 14, 2013 at 04:39 AM.
Old Nov 14, 2013, 04:38 AM
P4rr0t
This message has been deleted by P4rr0t.
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,803

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Nov 14, 2013, 05:16 AM
cooba is offline
Reply With Quote
Code:
void onMicky() {
	if (bird) {
		"why you no fly?",
		kick = bird;
	}
}
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 14, 2013, 06:22 AM
P4rr0t is offline
Reply With Quote
Cooba, it is micky doesn't exist (already banned from jj.net)

Ask Violet CLM or Foly, read my code, pls

Quote:
Originally Posted by P4rr0t View Post
Soory double post!


angelscript doesn't work for me this entrance/exit door and more doors, can you help me?

Code:
void onPlayer() {
	if (jjEventGet(p.xPos/32, p.yPos/32) == AREA::PATH) {
		canvas.drawString(
			(215*32) - 4,
			(85*32) - 4,
			"Press UP to entrance door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
		canvas.drawString(
			(8*32) - 4,
			(8*32) - 4,
			"Press UP to exit door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
	}
		switch () {
			case 10:
				x = 215;    //Entrance door
				y = 85;
				break;
			case 11:
				x = 8;     //exit door
				y = 8;
				break;
			
		}
	}
}
Thanks
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,803

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Nov 14, 2013, 07:05 AM
cooba is offline
Reply With Quote
I did use "EragonParrot" as a name when testing Hereafter for about a week straight
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 14, 2013, 07:32 AM
P4rr0t is offline
Reply With Quote
Quote:
Originally Posted by cooba View Post
I did use "EragonParrot" as a name when testing Hereafter for about a week straight
Eragon and Parrot is fine!

ask my code #54 please?
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 14, 2013, 11:27 AM
Violet CLM is offline
Reply With Quote
Some things that come to mind...
  • You're drawing the strings at fixed locations, which may or may not be appropriate for your own personal level layout. Certainly if you change your mind about where either of the doors are, you'll need to change the script as well, and it doesn't support multiple door pairs either. You'd be better off deriving the x and y position of the drawString calls from the x and y position of the player who triggers them.
  • switch () is meaningless and presumably syntactically invalid. Find an article about how switch statements work, just in general, not even specifically in AngelScript. Alternatively just use if, since a three-possibility switch statement feels a little silly, but that's more personal preference speaking.
  • Your values x and y are not defined anywhere in the function and are not used anywhere in the function after being set.
  • Likewise, canvas is never defined. From context it's clear you want it to be of type jjCANVAS@, but you're not using a function that includes one in its parameters. Replace each canvas.drawString with jjDrawString.
__________________
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 15, 2013, 04:53 AM
P4rr0t is offline
Reply With Quote
@Violet CLM

Okay, it's not working my code... can you fix my code? Thanks
And No triggers
See picture: s11.postimg.org/akpdji9lf/image.png

Code:
void onPlayer() {
	if (jjEventGet(p.xPos/32, p.yPos/32) == AREA::PATH && jj[UP]) {
		jjCANVAS@ jjDrawString(
			(215*32) - 4,
			(85*32) - 4,
			"Press UP to entrance door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
		jjCANVAS@ jjDrawString(
			(8*32) - 4,
			(8*32) - 4,
			"Press UP to exit door!",
			STRING::SMALL,
			STRING::BOUNCE,
			1
		);
	}
		if switch () {
			case 10:
				x = 7;    //Entrance door
				y = 7;
				break;
			case 11:
				x = 214;     //exit door
				y = 84;
				break;
			
		}
	}
}
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 15, 2013, 09:47 AM
Violet CLM is offline
Reply With Quote
That's all but unchanged from the last time you posted your code, and I already listed several improvements you could make in it. If you're coming at this with no familiarity with coding, I'd suggest you start with something simpler. See if you can make a 'trigger zone' that turns on two different triggers at once, for example.
__________________

Last edited by Violet CLM; Nov 15, 2013 at 10:11 AM.
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 16, 2013, 03:11 AM
P4rr0t is offline
Reply With Quote
Unhappy

Quote:
Originally Posted by Violet CLM View Post
That's all but unchanged from the last time you posted your code, and I already listed several improvements you could make in it. If you're coming at this with no familiarity with coding, I'd suggest you start with something simpler. See if you can make a 'trigger zone' that turns on two different triggers at once, for example.

Sorry, the code is hard for me. What about Warp with press UP key to entrance/exit door witout PATH/Trigger? can you create code "Doors" in Angelscript code snippets. I'm waiting for you

http://www.jazz2online.com/snippets/
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 17, 2013, 04:36 AM
P4rr0t is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
That's all but unchanged from the last time you posted your code, and I already listed several improvements you could make in it. If you're coming at this with no familiarity with coding, I'd suggest you start with something simpler. See if you can make a 'trigger zone' that turns on two different triggers at once, for example.


Sorry, the code is hard for me. Can you create code "doors" in Angelscript code snippet database.



What about TEXT/WARP with message "Press UP to entrance/exit door" (p.KeyUp) and no triggers.

Pos: 8,8 = Entrance door
Pos: 215,85 = Exit door

Thanks
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 17, 2013, 12:29 PM
Violet CLM is offline
Reply With Quote
If you don't understand the most fundamental basics of how coding works, giving you something like that as a single unit really will not help you at all. Please do some research, read some manuals, try stuff out on your own.
__________________

Last edited by Violet CLM; Nov 17, 2013 at 12:41 PM.
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 19, 2013, 02:56 AM
P4rr0t is offline
Reply With Quote
Question

Quote:
Originally Posted by Violet CLM View Post
If you don't understand the most fundamental basics of how coding works, giving you something like that as a single unit really will not help you at all. Please do some research, read some manuals, try stuff out on your own.
I know, i already read angelscript readme...i ask you help me for all days




Code:
void onFunction4(jjPLAYER@ p, jjCANVAS@ canvas) {
	if (p.KeyUp) {
		p.DrawString(212*32, 84*32-16, "|Press UP to entrance door!",STRING::SMALL,STRING::BOUNCE);
		p.WarpToTile(8,8 true);        //Entrance door
	}
}
i press up is nothing happened
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 20, 2013, 02:00 AM
P4rr0t is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
If you don't understand the most fundamental basics of how coding works, giving you something like that as a single unit really will not help you at all. Please do some research, read some manuals, try stuff out on your own.
Because i am not good code, i want entrance/exit doors with press UP only, please....?

Code:
void onFunction4(jjPLAYER@ p) {
	if (p.KeyUp);       
	   p.warpToTile(7,7, true);    //Entrance door
	}	
	jjAlert("&");
	jjAlert("&");
	jjAlert("&");
	jjAlert("&");
	jjAlert("&");
	jjAlert("&");
	jjAlert("|**Press UP to entrance door!**");
	jjAlert("&");
}
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,071

Love & Thunder has disabled reputation

Nov 20, 2013, 02:48 AM
Love & Thunder is offline
Reply With Quote
Yes, but what Violet is saying is that to get good at coding you have to start fairly small.
__________________
P4rr0t

JCF Member

Joined: Nov 2013

Posts: 12

P4rr0t is doing well so far

Nov 20, 2013, 06:59 AM
P4rr0t is offline
Reply With Quote
See picture
s23.postimg.org/ob8fx3t0r/jj2.png

Thanks a lot, zepect!

zepect is better than Violet/cooba has no help me all the time

* Problem Solved *
Stijn Stijn's Avatar

Administrator

Joined: Mar 2001

Posts: 6,952

Stijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to behold

Nov 20, 2013, 07:01 AM
Stijn is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
If you don't understand the most fundamental basics of how coding works, giving you something like that as a single unit really will not help you at all.
It would've helped him with his immediate problem...
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,071

Love & Thunder has disabled reputation

Nov 20, 2013, 07:20 AM
Love & Thunder is offline
Reply With Quote
True, but...
Quote:
Give a man a fish and he will be fed for a day. Teach a man to fish and he will be fed for life.
__________________
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,803

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Nov 20, 2013, 07:26 AM
cooba is offline
Reply With Quote
His immediate problem lies much deeper than not understanding AngelScript.
minmay

JCF Member

Joined: Aug 2002

Posts: 1,181

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Nov 26, 2013, 05:17 PM
minmay is offline
Reply With Quote
Is there any way to "just" change the amount of damage that TNT explosions cause? It doesn't seem to use animSpeed like other bullets.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,780

Violet CLM has disabled reputation

Nov 26, 2013, 05:30 PM
Violet CLM is offline
Reply With Quote
Not currently.
__________________
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,282

Slaz is a forum legendSlaz is a forum legendSlaz is a forum legend

Dec 22, 2013, 02:38 AM
Slaz is offline
Reply With Quote
Talking about being bad at coding, could someone point me in the right direction to create a very simple script that changes some palette colors?

I'd like to get a fixed number of jjPalette entries for a level's tileset changed at onLevelLoad during the entirety of the game.

I could probably look this up on the PlusPalette example, but I'm too lazy to dig into it.
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2.
Jazz Jackrabbit 2 Forever!!
Civilian Defence Force - Jazz2 Virtual Factory

Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 841

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Dec 22, 2013, 06:56 AM
Seren is offline
Reply With Quote
Readme section completely dedicated to operations on palettes
Example of a script that changes the palette onLevelLoad
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,282

Slaz is a forum legendSlaz is a forum legendSlaz is a forum legend

Dec 23, 2013, 12:35 PM
Slaz is offline
Reply With Quote
Hehe, a simple yet effective reply. My lazy butt just got the desired script to work!
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2.
Jazz Jackrabbit 2 Forever!!
Civilian Defence Force - Jazz2 Virtual Factory

DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 407

DennisKainz is notorious for his worthless posts

Jan 6, 2014, 03:01 PM
DennisKainz is offline
Reply With Quote
There's a problem.

AngelScript usually allows me to make Jazz run at higher speeds than 4 or 8, but in some levels, or maybe when I'm standing on the ground, the x speed is limited to 4 on walk and 8 on run.

I also can't find the variables corresponding to the spike boll's Sync, Speed etcetera, assuming they are part of var[11].

And I can't change any object's animation speed. The animSpeed command seems to do nothing with eg. the Labrat.

And this:
canvas.drawSprite([xPos], [yPos], [ANIM::set], [sub-anim], [frame], SPRITE::PALSHIFT, [param]);
Doesn't work. The param part isn't considered a valid part of the expression, as I keep on getting "No matching signatures for [expression]". So I can't change the deco's color.

And ... is there a way to check whether Jazz is standing on the ground? (like "platform", but checking for masked tiles instead)

And the virtual keycodes wiki doesn't tell me which are the virtual keycodes for each letter.

And I can't use the texture tools. It ALWAYS gives me "Identifier [style || texture] is not a data type".

Last edited by DennisKainz; Jan 8, 2014 at 06:27 AM.
minmay

JCF Member

Joined: Aug 2002

Posts: 1,181

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Jan 8, 2014, 08:49 AM
minmay is offline
Reply With Quote
animSpeed is almost never (maybe entirely never?) actually used to determine animation speed.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 841

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jan 8, 2014, 09:18 AM
Seren is offline
Reply With Quote
Quote:
Originally Posted by Gus View Post
AngelScript usually allows me to make Jazz run at higher speeds than 4 or 8, but in some levels, or maybe when I'm standing on the ground, the x speed is limited to 4 on walk and 8 on run.
There is so far no reliable way to set player speed to values above 8. I would be able to write a workaround in AngelScript but I guarantee it's a better idea to wait for proper implementation.
Quote:
Originally Posted by Gus
I also can't find the variables corresponding to the spike boll's Sync, Speed etcetera, assuming they are part of var[11].
I won't look into this, but I see no reason why the objects would ever need to contain sync. Sync is only necessary on object initialization when it needs to learn about its current angle, so there's no reason to store it, it just loads it from event parameters. And the angle is kept somewhere between var[] values. Speed, I don't know, sounds to me like a var[] thing but if it's not, it might be stored in xSpeed or ySpeed, or constantly get reloaded from the event if they didn't decide to optimize its code, you'll have to check on your own.
Quote:
Originally Posted by Gus
And I can't change any object's animation speed. The animSpeed command seems to do nothing with eg. the Labrat.
Quote:
Originally Posted by minmay View Post
animSpeed is almost never (maybe entirely never?) actually used to determine animation speed.
The animSpeed property, as far as I can tell, affects gem rings and some types of destructible scenery.
Quote:
Originally Posted by Gus
And this:
canvas.drawSprite([xPos], [yPos], [ANIM::set], [sub-anim], [frame], SPRITE::PALSHIFT, [param]);
Doesn't work. The param part isn't considered a valid part of the expression, as I keep on getting "No matching signatures for [expression]". So I can't change the deco's color.
Good thing it doesn't work because that's not what the function prototype looks like. Use the documentation. Or use the help debug messages you get.
Quote:
Originally Posted by Gus
And ... is there a way to check whether Jazz is standing on the ground? (like "platform", but checking for masked tiles instead)
Not through a direct variable, but something like jjMaskedHLine(player.xPos-12,24,player.yPos+20) should work. You can also perform a check for ySpeed==0 just to be sure.
Quote:
Originally Posted by Gus
And the virtual keycodes wiki doesn't tell me which are the virtual keycodes for each letter.
Use an ASCII table instead.
Quote:
Originally Posted by Gus
And I can't use the texture tools. It ALWAYS gives me "Identifier [style || texture] is not a data type".
Because you didn't provide a sample of code you used, God knows what you did wrong but you did something wrong.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Old Jan 8, 2014, 10:31 AM
DennisKainz
This message has been deleted by DennisKainz.
Old Jan 10, 2014, 08:46 AM
DennisKainz
This message has been deleted by DennisKainz. Reason: Nevermind! Mistake of mine!
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 407

DennisKainz is notorious for his worthless posts

Jan 10, 2014, 10:22 AM
DennisKainz is offline
Reply With Quote
Thank you for the advices, Sir Ementaler. You are REALLY too good to be real.

I have a new problem: I try to draw ANIM:EVILDEVAN with jjDrawSprite, but JJ2 implicitly changes it into ANIM::JAZZ. Same with a few other animation sets, like ANIM::MENU and ANIM::BILSBOSS.

If you can help me out, I will CERTAINLY mention you in my episode's credits.
Reply

Tags
angelscript, code, jcs, request

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 10:55 AM.