Feb 16, 2013, 12:57 AM | |
AngelScript Requests & Help
Since there is no thread like this yet, I've decided to make one. This thread is about requests for scripts and help with JJ2 AngelScript. You can post requests for scripts you want to use in your level and ask people for help when something is not working with your code or you don't know if something is executeable.
There are a few rules/guidelines for posting:
__________________
[13:07:13] *** Foly is on a KILLING SPREE! [13:07:14] *** you killed yourself [13:07:14] *** Foly was looking good but died instead... Last edited by Foly; Feb 16, 2013 at 11:54 PM. |
Aug 9, 2013, 04:42 AM | |
Digging up this thread with a plea for help.
I'm absolutely new to this scripting thing so pardon me if I ask for something completely obvious, but is it possible to write a script so a particular sucker tube will only work if a player moves with enough speed while touching it?
__________________
"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) |
Aug 9, 2013, 10:50 AM | |
You could try making your own sucker tube out of an onFunction# and the xSpeed, ySpeed, xPos, yPos, ballTime, and noClip properties, but there would still end up being some things you couldn't set at the moment, like turning off special moves. jjEventSet is probably closer to what you want.
|
Aug 14, 2013, 04:12 PM | ||
Could someone explain me please why jjTileSet function does not work properly?
To describe problem: I want it to create 1 tile in the air in the cords X,Y in layer 4. It does not create that 1 tile, but it creates invisible pillars all around the map. I really have no clue why. If you haven't tried it, you can: Quote:
Last edited by MilloCz2; Aug 14, 2013 at 04:26 PM. |
Aug 14, 2013, 05:47 PM | |
The 4x1 tile block you're setting a tile in is not unique to that position, therefore all other instances of that same 4x1 block receive the same change. The easiest way to ensure uniqueness is to make one of the tiles an animated tile and place an event—even one that doesn't do anything—on that animated tile.
|
Aug 15, 2013, 02:58 AM | |
Hah, thanks for quick reply! I will check it out.
(1) Also, is there any way how to show int/doubles etc. in showText/in jjDebug ? EDIT: (2) What are some good ways of player's INPUT ? I have seen pressing buttons 1-9 as weapon change; is there anything better? Such as input text via jj2 chat? I'm just starting, both with Angelscript and C++ and I'm very interested in it, since JJ2 is one of my most favourite games. Last edited by MilloCz2; Aug 15, 2013 at 03:32 AM. |
Aug 15, 2013, 03:50 AM | |
(1) AngelScript has a built-in (i.e. I didn't write it) function
formatInt which does what you're looking for and can output in a variety of formats. Search the documentation for details.(2) There's no direct way of accessing input in the most recent release, but it'll turn up later. "Player-Guided Missile" on J2O is an example of indirectly testing the left and right arrow keys (or A/D or whatever the player happens to be using). |
Aug 17, 2013, 01:28 AM | |
Is there any way of detecting whether or not a playing is currently pressing the fire button? I'm trying to write a script where the player's ammo regenerates over a period of time, with a short delay after the last press of the fire button. This would stop ammo from regenerating continuously even when the player is constantly firing.
|
Aug 17, 2013, 01:40 AM | |
Nope. But you could check whether the ammo count has gone down lately?
|
Aug 17, 2013, 09:16 AM | |
This is another possible solution that has insignificantly longer execution time but doesn't use global variables and is more flexible (can be used for players who aren't local):
Code:
bool playerHasShot(jjPLAYER@ player){ jjOBJ@ obj; for(int i=0;i<jjObjectCount;i++){ @obj=jjObjects[i]; if(obj.isActive&&(obj.eventID<OBJECT::SMOKERING||obj.eventID==OBJECT::TNT)&&obj.creatorType==CREATOR::PLAYER&&jjPlayers[obj.creator] is player&&(obj.state==STATE::FLY||obj.state==STATE::ROCKETFLY)&&obj.counter==1) return true; } return false; }
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. Last edited by Sir Ementaler; Aug 17, 2013 at 03:15 PM. |
Aug 17, 2013, 02:41 PM | |
Whoa, that script could use some white space and comments. Is it checking whether a new bullet of a certain player has appeared?
__________________
|
Aug 17, 2013, 03:23 PM | |
If there exists an object that is active, is a bullet, was created by the player the function is called for, and has parameters that indicate it has just spawned, return true, otherwise don't.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Aug 29, 2013, 09:52 AM | |
Code:
jjAlert("You have " + p.coins + " coins.");
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Sep 1, 2013, 09:34 AM | |
Code:
jjAddObject(OBJECT::BLUEGEM, p.xPos, p.yPos);
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Sep 1, 2013, 10:40 AM | |
Also, you'd want
jjEventSet(p.xPos / 32,p.yPos / 32, OBJECT::BLUEGEM) to the extent that worked at all, since events occupy whole tiles.
|
Sep 2, 2013, 01:13 AM | ||
Quote:
(this works even without dividing xPos by 32) |
Sep 6, 2013, 11:20 AM | |
I know nothing about angel scripting and it's possibilities, so I will ask some questions:
- is it possible to change counting on DOM level, so the checkpoint increases your points every 10 seconds? For example if your team has 3 CPs, your score increases by 3 every 10 seconds. - is it possible to trigger somehow gems in DOM, so if your team owns checkpoint, you can spawn at that area? Otherwise you spawn at another CP you own, or your team loses. - is it possible to make gems first neutralize and then capture, just like on beginning of the game? For example, red team captures the CP, blue player neutralizes it by standing there for 5 seconds (and nobody can spawn there when it's neutralized), and after that 5 more seconds to capture the checkpoint so players could spawn there. I am trying to make something that looks similar to Shadowgun's Zone Control gamemode. That could work very well in JJ2 with some changes. Last edited by Toni_; Oct 20, 2013 at 07:28 AM. |
Sep 14, 2013, 12:39 PM | |
I don't think this is possible yet because there is no OBJECT:: DOMAREA. I've also tried to see if I could get the handle of a DOM object in case it's just another object with special properties but no luck there too.
__________________
[13:07:13] *** Foly is on a KILLING SPREE! [13:07:14] *** you killed yourself [13:07:14] *** Foly was looking good but died instead... |
Sep 14, 2013, 02:22 PM | |
I have no knowledge of angel script, but is something like this possible? I will just try to show what I mean, without any real function there.
if gemCaptured = TRUE (activate some trigger) where trigger is area (for example) 15x15 tiles around the gem, and when player spawns, he can warp there. |
Sep 14, 2013, 02:37 PM | |
JJ2+ doesn't presently allow you direct scripting access to DOM mechanics, but you could probably make your own facsimile.
|
Sep 15, 2013, 04:42 AM | |
He means it is also possible to create your own domination area's like I did in that level, although looking back at that level I think it's a bit sloppy
__________________
[13:07:13] *** Foly is on a KILLING SPREE! [13:07:14] *** you killed yourself [13:07:14] *** Foly was looking good but died instead... |
Oct 28, 2013, 10:11 PM | |
Testing their position for being inside the level (instead of at 0,0) seems to be the preferred method at present.
|
Oct 28, 2013, 10:53 PM | |
Console announcements are, without exception that I can think of, barely more than normal chat messages. They do not reflect the client receiving a notification to actually update any values locally.
|
Oct 30, 2013, 09:43 AM | |
I'm having trouble with using parameters in place of numerical values. I tried making a script that would spawn an object and make it constantly float near the player, but simply inputting p.xPos and p.yPos for the object's x and y values breaks the whole script. Is there any particular syntax I must use to make this work?
__________________
"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) |
Oct 30, 2013, 10:03 AM | |
Sorry, that description's much too vague for me to diagnose your problem. My best guess is that either a) "p" is not a defined variable at the time the function is called or b) you're not passing the parameters in the correct order. If that's not it, you may have to post some more of your code for inspection.
|
Oct 30, 2013, 10:44 AM | |
Okay. Here's how it looks right now, for testing purposes:
void onFunction1() { jjOBJ@ angryegg = jjObjects[jjAddObject(OBJECT::EGGPLANT, p.xPos + 50, p.yPos + 50)]; angryegg.bulletHandling(HANDLING::IGNOREBULLET); angryegg.xPos = p.xPos + 50; angryegg.yPos = p.yPos + 50; } that's the whole thing so far.
__________________
"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) |
Oct 30, 2013, 10:44 AM | |
p as a global property got deprecated. You need to use this:
Code:
void onFunction1(jjPLAYER@ p)
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Oct 30, 2013, 11:13 AM | |
bulletHandling is not a function.
Code:
angryegg.bulletHandling=HANDLING::IGNOREBULLET;
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Oct 30, 2013, 11:33 AM | |
ok after the fixes it works somewhat... the eggplant appears where it should, but when I try to make it stay there with onMain, it says I didn't declare angryegg and I don't know what to do
__________________
"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) |
Oct 30, 2013, 12:06 PM | |
The beauty of custom behaviors is that you no longer need onMain to do anything complicated with objects:
Code:
void AngryEgg(jjOBJ@ obj) { jjPLAYER@ p = jjLocalPlayers[obj.creatorID]; obj.xPos = p.xPos + 50; obj.yPos = p.yPos + 50; obj.draw(); } void onLevelLoad() { jjObjectPresets[OBJECT::EGGPLANT].behavior = AngryEgg; jjObjectPresets[OBJECT::EGGPLANT].bulletHandling = HANDLING::IGNOREBULLET; } void onFunction1(jjPLAYER@ p) { jjAddObject(OBJECT::EGGPLANT, p.xPos + 50, p.yPos + 50, p.playerID, CREATOR::PLAYER); jjAlert("Eggplant added!"); }
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Oct 30, 2013, 12:22 PM | |
p the global object should still work, though—deprecated is not the same thing as removed.
|
Oct 30, 2013, 03:36 PM | |
AngryEgg? I see some Angry Birds game coming!
__________________
|
Tags |
angelscript, code, jcs, request |
«
Previous Thread
|
Next Thread
»
Thread Tools | |
|
|
All times are GMT -8. The time now is 02:54 PM.
Jazz2Online © 1999-INFINITY (Site Credits). Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats. Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Original site design by Ovi Demetrian. DrJones is the puppet master. Eat your lima beans, Johnny.