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

AngelScript Requests & Help

Reply
 
Thread Tools
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Apr 28, 2015, 12:28 PM
Violet CLM is offline
Reply With Quote
Not built-in. You'll have to do the math yourself.
__________________
Crazy Rabbit Crazy Rabbit's Avatar

JCF Member

Joined: Aug 2009

Posts: 243

Crazy Rabbit is doing well so far

May 7, 2015, 08:58 AM
Crazy Rabbit is offline
Reply With Quote
Greetings.
I've come up with idea to make a custom gamemode - Prop'n Hunt. The rules are simple: there's two teams in this game; red team for hunters, those who will hunt down blue and the blue team - props (morphed into pickups or level's furniture players).
Red team starts with black screen, that lasts for 15 (or more) seconds, then they get warped into the level. For that time the blue team must morph into something, that might be well disguised, then hide (the level is planned to be very big). Blue team can't shot or hurt anyhow, but a red team member also can't shot a fake furniture/pickup, because he'll get hurt then. Each player has one live per round...

Okay, now to the business - the problem is that I'm not well acknowledged with AngelScript, so I won't be able to make it alone.
I also didn't come up with HOW a blue team member is going to choose his disguise (maybe there's chat command, or a keybutton click on nearby pickup, or something?), so I'm asking you for help, if you're interested in that...
__________________
ELC leveldesigner, [CDFLogistics] leader, [CDF] consult member, a music composer.
Unite people under one idea.
Treylina Treylina's Avatar

JCF Member

Joined: Sep 2009

Posts: 1,046

Treylina is a forum legendTreylina is a forum legendTreylina is a forum legend

May 7, 2015, 09:49 AM
Treylina is offline
Reply With Quote
So basically...a glorified hide and seek.

People who know the level well won't be fooled, unless the real pickups/furniture locations are randomized each round/cycle.

Okay I'm not really helping technical wise, though that's my two cents on the concept.

EDIT: Oh, so it's based off something else.
__________________


Jazz Jackrabbit group: https://discord.gg/vZm95tQ

Last edited by Treylina; May 7, 2015 at 10:28 AM.
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

May 7, 2015, 12:19 PM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Crazy Rabbit View Post
Greetings.
I've come up with idea to make a custom gamemode - Prop'n Hunt. The rules are simple: there's two teams in this game; red team for hunters, those who will hunt down blue and the blue team - props (morphed into pickups or level's furniture players).
Red team starts with black screen, that lasts for 15 (or more) seconds, then they get warped into the level. For that time the blue team must morph into something, that might be well disguised, then hide (the level is planned to be very big). Blue team can't shot or hurt anyhow, but a red team member also can't shot a fake furniture/pickup, because he'll get hurt then. Each player has one live per round...

Okay, now to the business - the problem is that I'm not well acknowledged with AngelScript, so I won't be able to make it alone.
I also didn't come up with HOW a blue team member is going to choose his disguise (maybe there's chat command, or a keybutton click on nearby pickup, or something?), so I'm asking you for help, if you're interested in that...
I think I can help you.
__________________
~XxMoNsTeR
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,314

Slaz is OFF DA CHARTSlaz is OFF DA CHARTSlaz is OFF DA CHART

May 23, 2015, 01:06 AM
Slaz is offline
Reply With Quote
Okay, I'm looking for a way to create an eyecandy effect for my level. I'd like tiny particles to fall gently from the top of the players screen. Imagine little stars falling down, or diamond dust falling while being illuminated by moonlight.

I still know little about AS, so I started experimenting. I've looked at jjParticle's ICETRAIL since those particles felt like they could do the trick. However, how do I make a few of them fall from the top of the screen? Do I need to make a jjCanvas relative to the players position and attach the jjParticle(s) to that?

If the jjParticle idea is all wrong for some reason, could a custom object using the icetrail anim work? Either way, I'd like some help!

Thanks in advance!
__________________
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 Visual Fantasers
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 23, 2015, 04:06 PM
Violet CLM is offline
Reply With Quote
Code:
void onPlayer(jjPLAYER@ play) {
	jjPARTICLE@ part = jjAddParticle(PARTICLE::ICETRAIL);
	if (part !is null) {
		part.xPos = play.cameraX + (jjRandom() % jjSubscreenWidth);
		part.yPos = play.cameraY;
	}
}
You may want to use some more sophisticated approach than jjRandom, or a frequency different than one particle per tick (regardless of screen width), but the important thing is that jjPLAYER::cameraX and jjPLAYER::cameraY are used for translating between level coordinates and screen coordinates.

If you end up deciding against PARTICLE::ICETRAIL, though, you could also create your own tiny particle class containing position, (maybe) color and (maybe) lifetime values, make an array of that class, and draw blue pixels (or small rectangles or something) directly to a non-layer jjCANVAS based on the array's contents' positions. But ICETRAIL is simpler if you don't want to figure out classes.
__________________
SAMI SAMI's Avatar

JCF Member

Joined: Jan 2015

Posts: 364

SAMI is doing well so far

May 24, 2015, 05:11 AM
SAMI is offline
Reply With Quote
I don't know anything about Angle scripting. But I wanna know if its possible to increase screen area without changing resolution? For example this:

If yes, what should write?
__________________
Just Monika
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,314

Slaz is OFF DA CHARTSlaz is OFF DA CHARTSlaz is OFF DA CHART

May 24, 2015, 05:13 AM
Slaz is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
You may want to use some more sophisticated approach than jjRandom, or a frequency different than one particle per tick (regardless of screen width), but the important thing is that jjPLAYER::cameraX and jjPLAYER::cameraY are used for translating between level coordinates and screen coordinates.

If you end up deciding against PARTICLE::ICETRAIL, though, you could also create your own tiny particle class containing position, (maybe) color and (maybe) lifetime values, make an array of that class, and draw blue pixels (or small rectangles or something) directly to a non-layer jjCANVAS based on the array's contents' positions. But ICETRAIL is simpler if you don't want to figure out classes.
Your piece of code combined with ICETRAIL's color & delta values gave the exact result I was looking for. Many thanks! jjRandom makes it look fine, naturally there are more particles on the screen while standing still and less while the screen is scrolling. There's no need looking into classes or changing the frequency at all.

I will comment your name atop the script file.
__________________
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 Visual Fantasers
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

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

May 24, 2015, 05:18 AM
Seren is offline
Reply With Quote
Quote:
Originally Posted by SAMI View Post
If yes, what should write?
Probably at least several hundred lines of code.
__________________

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

JCF Member

Joined: Jan 2015

Posts: 364

SAMI is doing well so far

May 24, 2015, 09:50 AM
SAMI is offline
Reply With Quote
Quote:
Originally Posted by Sir Ementaler View Post
Probably at least several hundred lines of code.
Can u help me with those codes?
__________________
Just Monika
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

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

May 24, 2015, 04:07 PM
Seren is offline
Reply With Quote
I don't have the will to. The solution for tiles would involve hiding all layers and using the jjPIXELMAP constructor from tile ID to create sprites to be drawn with jjCANVAS::drawResizedSprite in onDrawLayer# hooks. It wouldn't work correctly for animated tiles so you'd have to handle those separately. Objects would preferably be modified within behavior functions to use jjDrawResizedSpriteFromCurFrame instead of jjDrawSpriteFromCurFrame. It wouldn't work for rotated sprites though - in fact, no as simple solutions would, so hopefully you don't need those. Players should have their jjPLAYER::invisibility property set to true and their sprites, and optionally names and other things, such as Spaz's bird, drawn manually with jjDrawResizedSpriteFromCurFrame. There's not much that can be done about particles either but luckily they're small so it's possible to get away with it. It also wouldn't have effect on textured backgrounds, water, etc. I wouldn't bet my money on stable fps after all of that is done.
__________________

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

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Jun 30, 2015, 05:57 AM
XxMoNsTeRXM is offline
Reply With Quote
Ok, so it seems like commands on "onChat & onLocalChat()" with Server don't work for me, what I mean is I put a if (stringReceived == "/test") and jjAlert("s") when I do that. And when I do it as a server it doesn't work, when I do it as a client it works! Did I do something wrong, or it just doesn't work with the Server?
__________________
~XxMoNsTeR
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jun 30, 2015, 10:19 PM
Violet CLM is offline
Reply With Quote
Commands (even invalid ones) are not supposed to be intercepted by the chat hooks at all. Any time they are is an error.
__________________
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jul 1, 2015, 02:25 PM
Love & Thunder is offline
Reply With Quote
So, can you not make custom server commands in AS?
__________________
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

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

Jul 1, 2015, 02:45 PM
Seren is offline
Reply With Quote
All messages starting in '/' are reserved by JJ2+ for clarity and forward compatibility. Similarly, due to collisions with whispering and admin chat I cannot recommend the use of '@' or '>' to signify custom commands. Nothing prevents script writers from using one of the other 23 non-alphanumeric ASCII characters present on every keyboard, however. Or, using my by far favorite solution, words.
__________________

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

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

Jul 17, 2015, 01:12 PM
szmol96 is offline
Reply With Quote
I guess the exclamation mark (!) is the most known symbol used by custom commands.
__________________
All your base are belong to us.
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Jul 31, 2015, 01:40 PM
XxMoNsTeRXM is offline
Reply With Quote
Ok, jjMaxLives doesn't work. Why, doesn't it? I just used it and it says it isn't declared, when I declare it and set a value to it, it's fine. I typed it correctly, and also tested it with a simple thing on my tests.mut, with jjAlert(jjMaxLives + ""). I also have the latest plus version. :?
__________________
~XxMoNsTeR
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

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

Jul 31, 2015, 01:54 PM
Seren is offline
Reply With Quote
True, that's a documentation error, the property doesn't exist.
__________________

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

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Jul 31, 2015, 01:55 PM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Sir Ementaler View Post
True, that's a documentation error, the property doesn't exist.
And why is it there in the angelscript readme? That confused me. I thought nobody noticed that.
__________________
~XxMoNsTeR
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jul 31, 2015, 05:06 PM
Violet CLM is offline
Reply With Quote
As SE said, it's an error. IIRC it had a temporary implementation, but that didn't end up working for clients, and it was a minor enough property that we opted for taking it out rather than fixing it. But then that particular change got missed while updating the documentation later.
__________________
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Aug 18, 2015, 11:59 AM
Violet CLM is offline
Reply With Quote
re: the Angelscript Requests part of this topic:

I'd like to see a mutator that automated some of the CTF codes, but I'm not enough of an expert on them to want to do it myself. At the very least, it would be nice if flag carriers could just announce their health (via teamchat) automatically--when picking up a flag, when their health changes, or when anyone asks "h" or "h?" via teamchat. Trying to type and send a number while running for my life tends not to be very pleasant.
__________________
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Aug 19, 2015, 12:59 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
re: the Angelscript Requests part of this topic:

I'd like to see a mutator that automated some of the CTF codes, but I'm not enough of an expert on them to want to do it myself. At the very least, it would be nice if flag carriers could just announce their health (via teamchat) automatically--when picking up a flag, when their health changes, or when anyone asks "h" or "h?" via teamchat. Trying to type and send a number while running for my life tends not to be very pleasant.
That is a great idea, it shouldn't be hard to do.
__________________
~XxMoNsTeR
ScarXL ScarXL's Avatar

JCF Member

Joined: Aug 2015

Posts: 5

ScarXL is doing well so far

Aug 29, 2015, 02:01 PM
ScarXL is offline
Reply With Quote
Since I cannot post new threads, I may aswell ask this here.
How can I make it so when I use a coin warp, all of the map's coins DON'T turn into gems?
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,812

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

Aug 29, 2015, 02:04 PM
cooba is offline
Reply With Quote
By setting the global property jjWarpsTransmuteCoins to false on level load.
Old Aug 29, 2015, 09:18 PM
ScarXL
This message has been deleted by ScarXL.
ScarXL ScarXL's Avatar

JCF Member

Joined: Aug 2015

Posts: 5

ScarXL is doing well so far

Aug 29, 2015, 09:26 PM
ScarXL is offline
Reply With Quote
This is the code i've put:

void onLevelLoad() {
jjWarpsTransmuteCoins = false;
}

Did I do something wrong? Cuz it's not working.

EDIT: NEVERMIND it does. I was a stupe and ran it through JCS lol. Thank you cooba this helped a lot
__________________
JJ2 nickname: AlexM


Last edited by ScarXL; Aug 29, 2015 at 09:49 PM.
SaVn

Banned

Joined: Jul 2015

Posts: 17

SaVn is doing well so far

Sep 3, 2015, 04:30 PM
SaVn is offline
Reply With Quote
-

my problem is that I do not know all the codes AngelScript
I explain them?
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Sep 3, 2015, 05:04 PM
Love & Thunder is offline
Reply With Quote
Read the AngelScript manual. If you still have problems, come back.
Also, that's a pretty vague problem.
__________________
Old Sep 3, 2015, 07:03 PM
SaVn
This message has been deleted by SaVn.
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Sep 4, 2015, 04:35 AM
Love & Thunder is offline
Reply With Quote
Read the code in question for Ozymandius, look up stuff you don't understand in the AS readme, and when in doubt, screw around with how a piece of code works until you understand it.

One thing to avoid doing in this case is copypasting code you don't understand. It will technically work most of the time, but you won't learn from it.
__________________
SaVn

Banned

Joined: Jul 2015

Posts: 17

SaVn is doing well so far

Sep 4, 2015, 07:59 AM
SaVn is offline
Reply With Quote
What is "for (int i = 0; i < jjObjectCount; i++) {"
i don't known! anyone knows this code?
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 8, 2015, 01:19 AM
DennisKainz is offline
Reply With Quote
Question

I have tried literally everything to align my texts to the center, but nothing worked.
It's hard without examples.
Can I please have an example of ANY possible way to create ANY kind of centered text?

Last edited by DennisKainz; Dec 8, 2015 at 01:26 AM. Reason: I wrote "mode" instead of "way"
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

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 8, 2015, 02:26 AM
Seren is offline
Reply With Quote
plusCharJump.j2as lines 90-93. Noticeably line 91 is currently obsolete and no longer required.
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 8, 2015, 03:45 AM
DennisKainz is offline
Reply With Quote
Wink

Thanks for the help, and sorry for the disturb.
I now can make my custom text!

Last edited by DennisKainz; Dec 11, 2015 at 09:22 AM.
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 11, 2015, 09:24 AM
DennisKainz is offline
Reply With Quote
One more thing ... How do I get an object to activate even if Jazz has never been close enough to it? Example: Jazz never walked further to the left than X tile 32, but the enemy is at X tile 224. How do I get the enemy to activate already, without Jazz actually being any nearby?
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Dec 11, 2015, 10:19 AM
Violet CLM is offline
Reply With Quote
Seems to me the simplest way would be to place the object somewhere around X tile 32, but have it reposition itself immediately upon creation. Alternatively, I haven't tested this but it looks plausible:
Code:
jjOBJ@ ActivateEventAt(int xTile, int yTile) {
  if (jjParameterGet(xTile, yTile, -1, 1) == 1) //event already activated
    return null;
  jjParameterSet(xTile, yTile, -1, 1, 1); //bit meaning that this event is active
  return jjObjects[jjAddObject(jjEventGet(xTile, yTile), xTile * 32 + 15, yTile * 32 + 15, 0, CREATOR::LEVEL)]; //or it might be + 16 for the position offsets if you want to get it exactly right... I don't remember offhand
}
Either way, you'll want to make sure its jjOBJ::deactivates is false.
__________________
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 11, 2015, 12:14 PM
DennisKainz is offline
Reply With Quote
There's a tinyish problem ...
The expression does nothing. AngelScript recognizes it as valid and all, but the inactive stays inactive.
I even made sure a specific item first and then all items do not deactivate, but nothing. It doesn't affect anything.
Then I tried to replace xTile and yTile with their actual values. Still nothing.
It didn't work as a stand alone, so I tried to inject it in onMain(), but it said "Expected ; Instead found @"
Then I tried to remove the upper path, the one who returns null, and only kept the other. Guess what? Nothing!
In the end, I tried to add the "else" line between the two paths. And still nothing!

Maybe I should get back to tileset making ...
I said MAYBE
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Dec 11, 2015, 04:33 PM
Violet CLM is offline
Reply With Quote
What numbers are you passing as arguments and what event is at that location?
__________________
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 12, 2015, 01:15 AM
DennisKainz is offline
Reply With Quote
At first, I tried keeping "xTile" and "yTile", supposing they'd scan the whole level.
Then, I used the event location: 28, 7 (JCS). I tried to use as arguments both 28, 7 and 27, 6 (starting from 0).
And the event is a boll platform with a custom behavior used for moving it left and right, changing direction when it collides with a slide event, that I use as a sort of "Stop Platform"

Last edited by DennisKainz; Dec 12, 2015 at 01:16 AM. Reason: I said "Object" instead of "Event"
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Dec 12, 2015, 11:32 AM
Violet CLM is offline
Reply With Quote
Okay I created a 256-by-64 level with a start position in the top left corner and a piece of seeker ammo in the bottom right area, at position 252,60. Then I gave it this complete script:
Code:
void onLevelLoad() {
	jjObjectPresets[OBJECT::SEEKERAMMO3].behavior = MyObject;
	jjObjectPresets[OBJECT::SEEKERAMMO3].deactivates = false;
}

void onLevelBegin() {
	ActivateEventAt(252, 60);
}

void MyObject(jjOBJ@ obj) {
	jjAlert("I am active!");
}

jjOBJ@ ActivateEventAt(int xTile, int yTile) {
  if (jjParameterGet(xTile, yTile, -1, 1) == 1)
    return null;
  jjParameterSet(xTile, yTile, -1, 1, 1);
  return jjObjects[jjAddObject(jjEventGet(xTile, yTile), xTile * 32 + 15, yTile * 32 + 15, 0, CREATOR::LEVEL)];
}
I started seeing the "I am active!' alert constantly and it did not shut up, even when I went over to where the event was placed and then went away again. So whatever you're doing wrong is not in the function I gave you.

Are you hosting the level in MP? (Though if you were, I'm not sure why you'd be bothering with this, since the object would be activated anyway.) Boll platforms don't appear in MP servers unless they're set to MP-only....
__________________
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 415

DennisKainz is notorious for his worthless posts

Dec 12, 2015, 01:04 PM
DennisKainz is offline
Reply With Quote
My bad. I did use deactivates = false, but not with jjObjectPresets. Now it works flawlessly!
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 11:46 AM.