Jul 17, 2014, 06:52 PM | ||
Quote:
EDIT: Violet, I seem to have found a bug. I've currently set: Code:
jjWeapons[WEAPON::BLASTER].infinite = false; jjWeapons[WEAPON::BLASTER].maximum = 99; p.ammo[WEAPON::BLASTER]==99; |
Jul 17, 2014, 07:02 PM | ||
Quote:
onDrawLayer4 with onDrawLayer3 or onDrawLayer1 . :PI'll look into the other thing. What's the context here? onLevelLoad or what? (And note that p is deprecated.)
|
Jul 17, 2014, 07:14 PM | |
Here's the whole thing:
Code:
void onLevelBegin() { jjWeapons[WEAPON::BLASTER].infinite = false; jjWeapons[WEAPON::BLASTER].maximum = 99; p.ammo[WEAPON::BLASTER]=99; } |
Jul 18, 2014, 01:36 AM | |
I don't know about your problem, but you really need to make that into
Code:
jjPlayers[0].ammo[WEAPON::BLASTER] = 99;
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Jul 18, 2014, 02:03 AM | |
Not if it's a multiplayer level, which hopefully it is or else the
infinite line is the only one that does anything. For multiplayer you'd want jjLocalPlayers[0] . (Alternatively, set maximum in onLevelLoad instead of onLevelBegin , which should take care of setting ammo to 99 all on its own.)
|
Jul 18, 2014, 02:27 AM | |
It's a single player level.
EDIT: Bizarrely enough, when I get rid of p.ammo[WEAPON::BLASTER]=99;, the problem disappears. |
Jul 18, 2014, 02:42 AM | |
p is only supposed to work for onPlayer , onFunction# , and onPlayerTimerEnd , and even in those cases it's only there for backwards compatibility and you should define a jjPLAYER@ argument instead. Using p in onLevelBegin is undefined behavior.
|
Jul 20, 2014, 12:43 AM | |
EDIT: Ok, no matter where I put jjWeapons[WEAPON::BLASTER].maximum = 35; it never works. How to fix this in singleplayer? Am I missing something?
Also, a question regarding FF. I managed to successfully turn the fastfire pickup into an ammo, but only for pre-places fastfire pickups. When an enemy drops fastfire, it acts as usual (no ammo, decreases bullets frequency). Last edited by AvalancheMaster; Jul 20, 2014 at 12:57 AM. |
Jul 20, 2014, 01:56 AM | |||
Quote:
Code:
void onLevelLoad() { jjWeapons[WEAPON::BLASTER].maximum = 35; jjWeapons[WEAPON::BLASTER].infinite = false; } Quote:
scriptedCollisions to false. (Also isTarget and triggersTNT , and deactivates to true.) This is conceivably a bug. You should be able to get around it by doing something like this:Code:
void onLevelLoad() { jjObjectPresets[OBJECT::FASTFIRE].behavior = MyFastfire; } void MyFastfire(jjOBJ@ obj) { obj.scriptedCollisions = true; obj.behavior = BEHAVIOR::PICKUP; obj.behave(); } |
Jul 20, 2014, 07:05 PM | ||
Quote:
However, I've got another problem at hand. I'm trying to tint the ball platform to blue, but when I put jjObectPresets[OBJECT::BOLLPLATFORM].behavior = IceballPlatform; in onLevelLoad, no part of the code loads up. I even tried it with the simple rat example, given in the AngelScript guide (void MyRat(jjOBJ@ rat) {rat.behave(BEHAVIOR::LABRAT);}). It didn't work as well. Here's the relevant part of the code: Code:
onLevelLoad(){ jjObectPresets[OBJECT::BOLLPLATFORM].behavior = IceballPlatform; } void IceballPlatform(jjOBJ@ plat) { plat.behave(BEHAVIOR::PLATFORM, false); jjDrawSpriteFromCurFrame(plat.xPos, plat.yPos, plat.curFrame, plat.direction, SPRITE::TINTED, 151); } |
Jul 20, 2014, 07:24 PM | |
jjObjectPresets, with a j.
Blaster: how are you running the level? If you're cycling to it from another level that doesn't have that code, then you're going to start with 99 blaster left over from that previous level, and it won't be until you go below 35 that maximum is going to mean anything.
|
Jul 20, 2014, 07:35 PM | ||
Quote:
Also, DID I REALLY fell for a typo mistake. x_ EDIT: And it still doesn't draw the chainlinks of the platform. Only the ball. Last edited by AvalancheMaster; Jul 21, 2014 at 04:02 AM. |
Jul 21, 2014, 08:42 AM | ||
That would suggest you don't have debug mode enabled. It's strongly suggested to have it on whenever you're doing anything with AngelScript. The readme introduction explains how to do that. You may also be interested in this download as, while it couldn't detect a mistake, said mistake would have never been made if the auto-completion feature were used.
Quote:
jjOBJ::behave , when its second argument is set to false , stops all drawing operations from the behavior. You could solve that by drawing the chain manually but in your case a simpler solution may be to just call behave with the second argument set to true . This will have the effect of your tinted sprite being drawn on top of the regular one, which should be visually identical to what you're trying to achieve.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Jul 21, 2014, 04:10 PM | ||
Quote:
Also, palshifting the bat does this: I do realise it comes from the direction (capt'n obvious) yet I do not know how to solve it. Code: Code:
void Icebat(jjOBJ@ bat) { bat.behave(BEHAVIOR::BAT, true); jjDrawSpriteFromCurFrame(bat.xPos, bat.yPos, bat.curFrame, bat.direction, SPRITE::PALSHIFT, -56); } |
Jul 21, 2014, 05:10 PM | |
I refer you to our discussion on the previous page of SPRITE::PALSHIFT not working with leftward facing sprites.
|
Jul 21, 2014, 05:19 PM | |
Jul 21, 2014, 06:15 PM | |
Code:
void onLevelLoad(){ jjObjectPresets[OBJECT::BOLLPLATFORM].behavior = IceballPlatform; } void IceballPlatform(jjOBJ@ plat) { int angle = 0; //get part of the angle before it moves if (plat.state == STATE::PUSH) angle = plat.var[4]; else if (plat.state == STATE::ACTION || plat.state == STATE::FREEZE) if (plat.var[3] == 1) //U swing angle = 1024 + int(jjSin(plat.var[4])*65536)/256; else angle = plat.var[4]; plat.behave(BEHAVIOR::PLATFORM, false); angle += plat.var[5] * plat.var[2]; //links int radius = 0; jjObjects[0].curAnim = plat.killAnim; jjObjects[0].frameID = 0; int frame = jjObjects[0].determineCurFrame(false); int radadd = 11; //one less than the width of the sprite, so change this if dealing with other platforms int angleadd = -plat.var[5]; SPRITE::Mode mode = (plat.freeze != 0) ? SPRITE::FROZEN : SPRITE::TINTED; for (int n=0; n< plat.var[2]; ++n) { jjDrawSpriteFromCurFrame( plat.xOrg + radius * jjSin(angle), plat.yOrg + radius * jjCos(angle), frame, 0, mode, 151 ); angle+=angleadd; radius+=radadd; } //ball jjDrawSpriteFromCurFrame(plat.xPos, plat.yPos, plat.curFrame, plat.direction, SPRITE::TINTED, 151); } |
Jul 22, 2014, 03:11 AM | ||
Quote:
|
Jul 22, 2014, 03:22 AM | ||
Quote:
|
Jul 22, 2014, 03:50 AM | |
Aug 4, 2014, 02:05 AM | |
I want to verify if a player is at x-pos 53 and y-pos 79. I created a code but it doesn't work:
Code:
void onPlayer(jjPLAYER@ p) { if ((p.xPos / 32 == 53 && p.yPos / 32 == 79) && jjGameTicks % 70 == 0) jjAlert("Test"); } |
Aug 4, 2014, 03:13 AM | |
Instead of
p.xPos / 32 , try int(p.xPos / 32) . Otherwise you're comparing a float to an integer and the chances are rather lower they'll be equal.
|
Aug 4, 2014, 03:47 AM | |
It worked, thanks!" also can you make a global timer? with timerStart to start it global, not player-based, or at least to verify the server game timer (server timer after pregame server timer), is it possible?
|
Aug 19, 2014, 05:14 AM | |
I spent half an hour searching for a way to make the bats follow you all over the map.
All I found is that setting var[0] and var[11++] to 0 makes them chase you when you're close (and for some reason makes them shout while they're NOT awake and viceversa) And setting these to anything else makes them NEVER chase you. I also can't change their movement speed for chasing you. I didn't want to bother you with more requests, but I can't do this by myself. So, how do I give bats unlimited range? And how do I change their chasing speed?
__________________
Free will was a mistake. - God Last edited by DennisKainz; Aug 19, 2014 at 05:30 AM. |
Aug 19, 2014, 06:30 AM | |
Most of behavior constants for the majority of objects are hard-coded so you can't technically change only the distance bats detect you from or chase you from without rewriting the whole behavior. However, the position bats return to when they lose interest is their (xOrg, yOrg), so you could keep setting those to player's current position in order to make the bat chase them regardless of whether the range check succeeds. The variable you mention, var[0], stores ID of currently chased player, so you should use
Code:
const jjPLAYER@ player = jjPlayers[obj.var[0]]; obj.xOrg = player.xPos; obj.yOrg = player.yPos; Code:
obj.xPos = obj.xPos + (obj.xOrg > obj.xPos ? 2.f : -2.f); obj.yPos = obj.yPos + (obj.yOrg > obj.yPos ? 2.f : -2.f); Code:
void bat(jjOBJ@ obj) { const jjPLAYER@ player = jjPlayers[obj.var[0]]; obj.xOrg = player.xPos; obj.yOrg = player.yPos; obj.behave(BEHAVIOR::BAT); if (obj.state == STATE::FLY) { obj.xPos = obj.xPos + (obj.xOrg > obj.xPos ? 2.f : -2.f); obj.yPos = obj.yPos + (obj.yOrg > obj.yPos ? 2.f : -2.f); } }
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Nov 2, 2014, 02:57 AM | |
I got a code that does not work in multiplayer, it might be because it uses local variables, what I mean is that, if I join as a server it works, if I join as a normal player it crashes.
Code:
array
__________________
~XxMoNsTeR |
Nov 2, 2014, 03:09 AM | |
"Crashes" tells me nothing. Is it an Access Violation, or an other kind of error? If it's an Access Violation, what are the two addresses listed in the message?
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Nov 2, 2014, 03:28 AM | |
Yea it is.
"At adress 0043CC2Bh by attempting to read from adress 9F763A48h" EDIT: Maybe I gotta put [p.localPlayerID]? I tested that with the blaster reloading script, if I remove all the p.localPlayerID it crashes, if I have them, it works fine. I'll test that. EDIT 2: Still not working... Also here's the new magic code: Code:
bool access = true; class savedGems { savedGems() { red = green = blue = 0; } int red; int green; int blue; }; array
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Nov 2, 2014 at 04:24 AM. Reason: Still not working... |
Nov 2, 2014, 05:06 AM | |
The error is not caused by your script. Your script is technically correct (except for the accidental undefined reloadBlaster call in your latest post). The only problem it has is that
p.health = 4; is a poor choice because, a) it's not obvious why this is done and b) the health change will cause a status update packet to be sent, which means unnecessary efficiency loss that could be avoided (finding a way to do so is left as an exercise for the reader).The crash is most likely caused by the level alone but finding the cause proves troublesome. From the access violation error window, please provide the value of ESI.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Nov 2, 2014, 05:14 AM | |
reloadBlaster is not accidental, I didn't wrote the functionon the forum.
__________________
~XxMoNsTeR |
Nov 2, 2014, 05:52 AM | |
Welp... still not working, even though I am not changing health, I am just using it.
Let's try do it without even using health at all. EDIT: There's no way I can make this without testing for health, I need a onDeath function.
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Nov 2, 2014 at 06:12 AM. |
Nov 2, 2014, 07:54 AM | |
I already said your script doesn't cause this error so your further modifications will not fix it. If I wanted you to avoid using the health variable, I would say so. What I said where I was talking about possible improvements to your script is that you should avoid writing to this variable when unnecessary because it involves additional actions, which in turn decrease efficiency, i.e. script execution speed. Most importantly, I never said avoiding its use would get rid of the error you experience, as that would be untrue. Now focus on what I wrote and notice I requested the value of the ESI register at the point of crashing that you can obtain from the error message. This is currently the only information from your side I'm interested in.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Nov 3, 2014, 04:01 AM | |
The ESI is 6h.
Also it would be possible to do my script on a function, instead of putting the death pit on the level I could add a line of "Text" events in the level at the bottom of the level.
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Nov 3, 2014 at 04:17 AM. |
Nov 3, 2014, 12:45 PM | |
It appears that somewhere in your script you're trying to call
jjPLAYER::showText on a non-local or undefined player. JJ2+ probably has a bug that makes this action potentially crash the game, thank you for the report; regardless of that though, calling it on a non-local player would have no effect and therefore also likely indicates a bug in your script. The call is likely to have a form of p.showText somewhere in the onLevelLoad hook function but that's just one of the possibilities. In case your code really contains references to the global variable p / jjP as the symptoms would suggest, you should consider completely refraining from its use, as mixing deprecated and new features may and will result in undefined behavior.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Nov 4, 2014, 04:20 AM | |
This is the only place I use show text:
Code:
void onLevelBegin() { p.showText("@@@@@@#Treasure Jail", STRING::LARGE); } There's something wrong... I tested another level without the code that originally I thought it crashed when other client joins. About 1 month ago that map worked successfully, no crashes on multiplayer, so... it... might be... something with my server?
__________________
~XxMoNsTeR |
Nov 4, 2014, 04:39 AM | |
That really should be
Code:
jjLocalPlayers[0].showText
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Nov 4, 2014, 06:28 AM | |
It actually is, that's the problem, I tested, I commented the p.showText and... cha-ching, works... lol...
It's interesting that people were able to join on my server 1 or 2 months ago, without any problem and it had Code:
p.showText then. Everyone: Note that one line of your code could damage your entire level.
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Nov 4, 2014 at 06:38 AM. |
Jan 10, 2015, 12:36 AM | ||
Quote:
Also you declared the variables "fallTimer" & "maxFallTime" twice. (I moved this reply from the JJ2+ Thread to this thread)
__________________
~XxMoNsTeR |
Jan 10, 2015, 01:52 AM | ||
Quote:
__________________
"Floppy ears and a big butt?" - Slaz |
Tags |
angelscript, code, jcs, request |
«
Previous Thread
|
Next Thread
»
Thread Tools | |
|
|
All times are GMT -8. The time now is 04:17 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.