ghost.zh
#541
Posted 07 July 2016 - 04:01 PM
- Cukeman likes this
#542
Posted 08 July 2016 - 07:05 AM
Heyho
I didn't use use ghost.zh since Version 2.3.0. Now I need the newest Version for a script, but I can't get 2.8.0 to work:
Can anyone take a look at tgis please?
Those are my scripting files, if you need it:
http://uploaded.net/file/n92xdu3g
(I know, there's chaos in my script-file. Sorry for that...)
#543
Posted 08 July 2016 - 10:12 AM
- Rastael likes this
#544
Posted 08 July 2016 - 11:09 AM
It works, thx a lot! ^^
#545
Posted 09 July 2016 - 03:44 PM
edited
Edited by Cukeman, 09 July 2016 - 04:46 PM.
#546
Posted 02 August 2016 - 01:57 AM
I was trying to update my ghost.zh setup from 2.3.1 because I'm having trouble compiling Saffith's Chaser FFC script: (Error S10: Function Ghost_GetAttribute Is Undeclared)
What I did was put the new ghost.zh and ghost_legacy.zh over the old files, and change this:
global script Combined { void run() { //Before while Link->DrawXOffset = 0; Link->DrawYOffset = 2; Link->X += 0; Link->Y += -2; Game->Cheat = 4; StartClock(); Tango_Start(); while(true) { //Before Waitdraw MessageSound(I_MSGSFX,SFX_MSG_END); UpdateEWeapons(); UpdateClock(); CleanUpGhostFFCs(); Tango_Update1(); BombBlastFake(); SBombBlastFake(); Waitdraw(); //After Waitdraw AutoGhost(); Tango_Update2(); UpdateFlowers(); //Handles the flowers->Next stuff. if(OldScreen != Game->GetCurScreen())OldScreen= Game->GetCurScreen(); //Save what screen you're on if it changes. Waitframe(); } } }
to this:
11 -> 11
global script Combined { void run() { //Before while Link->DrawXOffset = 0; Link->DrawYOffset = 2; Link->X += 0; Link->Y += -2; Game->Cheat = 4; StartGhostZH(); Tango_Start(); while(true) { //Before Waitdraw MessageSound(I_MSGSFX,SFX_MSG_END); UpdateGhostZH1(); Tango_Update1(); BombBlastFake(); SBombBlastFake(); Waitdraw(); //After Waitdraw UpdateGhostZH2(); Tango_Update2(); UpdateFlowers(); //Handles the flowers->Next stuff. if(OldScreen != Game->GetCurScreen())OldScreen= Game->GetCurScreen(); //Save what screen you're on if it changes. Waitframe(); } } }
and I got this error when I went to compile:
pass 1: parsing
pass 2: preprocessing
can't open input file
ghost.zh, line 152: error p01: failure to parse imported file ghost_zh/2.8/script
s.z.
line 152 is just a comment:
//The current screen has changed.
Edited by Cukeman, 02 August 2016 - 02:29 PM.
#547
Posted 02 August 2016 - 12:32 PM
Did you get the ghost_zh directory and everything in it? It's complaining because one of those files is missing. It needs to be in the ZQuest application, in the same place as other .zh files.
#548
Posted 02 August 2016 - 02:25 PM
Ok, first off I found my hard drive- thank God, along with that old ghost_legacy.zh, so I was able to restore everything to the way it was before I changed things.
As to when I tried to update to the new version of ghost, the only files I added were ghost.zh and ghost_legacy.zh, I see where 2.8 is now (a folder) I'll try again. Thanks
#549
Posted 13 August 2016 - 04:14 PM
I noted today that aside from the BigEWeapon functions, ghost.zh doesn't appear to have any way to create odd-sized hitboxes for eweapons. So I tried to write my own.
Here's the code.
//A function to adjust an eweapon's hitbox size. //D0- Eweapon to adjust //D1- HitWidth //D2- HitHeight //D3- HitXOffset //D4- HitYOffset void EWeaponSetHitbox(eweapon wpn, int HitWidth, int HitHeight, int HitXOffset, int HitYOffset){ wpn->HitHeight = HitHeight; wpn->HitWidth = HitWidth; wpn->HitXOffset = HitXOffset; wpn->HitYOffset = HitYOffset; }
And here's how I'm using it...
//This method works. if(Link->X<Ghost_X) fireball = FireBigEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(180),150,ghost->WeaponDamage, PHANTOON_FIREBALL,SFX_FIRE, 0,2,3); else fireball = FireBigEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(0),150,ghost->WeaponDamage, PHANTOON_FIREBALL,SFX_FIRE, 0,2,3); EWeaponSetHitbox(fireball,16,34,2,8);
//This method... doesn't work. for(i=0;i<=7;i++){ fireball[i] = FireBigEWeapon(ghost->Weapon, 64+(i*32), 48, DegtoRad(90),100,ghost->WeaponDamage, PHANTOON_FIREBALL,SFX_FIRE, 0,2,3); EWeaponSetHitbox(fireball[i],16,34,2,8); SetEWeaponLifespan(fireball[i],EWL_TIMER, 60); SetEWeaponDeathEffect(fireball[i],EWD_VANISH, 0); Ghost_Waitframes(this,ghost,false, false,30); }
I'm not sure why one functions and the other doesn't, since they should operate in the same way.
Edit: Alright, I got the second version to work by not using an array of eweapons. I've no idea why that messed it up, since I'd used a similar method with an array of npcs elsewhere in the same script, but that's ZScript for you.
Edited by ywkls, 13 August 2016 - 07:14 PM.
#550
Posted 17 August 2016 - 12:51 PM
This is not super important, but is there a changelog for ghost.zh? I'm not on the newest version and I'm wondering if a specific thing was changed. Currently its possible as a player to distinguish ghosted 4-way walkers from non-scripted enemies by knocking them back. Ghosted enemies kinda glitch around when knocked back. Was that fixed?
#551
Posted 17 August 2016 - 01:46 PM
I was trying to update my ghost.zh setup from 2.3.1 because I'm having trouble compiling Saffith's Chaser FFC script: (Error S10: Function Ghost_GetAttribute Is Undeclared)
What I did was put the new ghost.zh and ghost_legacy.zh over the old files, and change this:global script Combined { void run() { //Before while Link->DrawXOffset = 0; Link->DrawYOffset = 2; Link->X += 0; Link->Y += -2; Game->Cheat = 4; StartClock(); Tango_Start(); while(true) { //Before Waitdraw MessageSound(I_MSGSFX,SFX_MSG_END); UpdateEWeapons(); UpdateClock(); CleanUpGhostFFCs(); Tango_Update1(); BombBlastFake(); SBombBlastFake(); Waitdraw(); //After Waitdraw AutoGhost(); Tango_Update2(); UpdateFlowers(); //Handles the flowers->Next stuff. if(OldScreen != Game->GetCurScreen())OldScreen= Game->GetCurScreen(); //Save what screen you're on if it changes. Waitframe(); } } }to this:
11 -> 11
18, 19, 20 -> 18
28 -> 26global script Combined { void run() { //Before while Link->DrawXOffset = 0; Link->DrawYOffset = 2; Link->X += 0; Link->Y += -2; Game->Cheat = 4; StartGhostZH(); Tango_Start(); while(true) { //Before Waitdraw MessageSound(I_MSGSFX,SFX_MSG_END); UpdateGhostZH1(); Tango_Update1(); BombBlastFake(); SBombBlastFake(); Waitdraw(); //After Waitdraw UpdateGhostZH2(); Tango_Update2(); UpdateFlowers(); //Handles the flowers->Next stuff. if(OldScreen != Game->GetCurScreen())OldScreen= Game->GetCurScreen(); //Save what screen you're on if it changes. Waitframe(); } } }and I got this error when I went to compile:
pass 1: parsing
pass 2: preprocessing
can't open input file
ghost.zh, line 152: error p01: failure to parse imported file ghost_zh/2.8/script
s.z.
line 152 is just a comment:
//The current screen has changed.
Are you doing something entirely custom with Link->Draw*Offset, such as reading it manually to do something with DrawTile?
Link->Draw*Offset doesn't actually do anything. It was meant to, but it was never finished, hence the lack of Link-Extend in the ZScript language.
#552
Posted 17 August 2016 - 02:15 PM
I've actually just been writing one to include with the next update. Unfortunately, I didn't keep track too well before I started using SVN for 2.7.1, so information for older versions is somewhat limited.This is not super important, but is there a changelog for ghost.zh?
- Avaro likes this
#553
Posted 21 August 2016 - 09:25 PM
I have a script that needs ghost.zh, i followed your set up video and everything imported just fine. when i went to test it out the enemy was just walking in one spot, not moving at all. here's my script
ffc script MegaXBoss { void run(int enemyID) { npc ghost = Ghost_InitAutoGhost(this, enemyID); int maxHP = Ghost_HP; int counter = -1; int timer_attack = 90; int attack; bool speedup; eweapon ewpn; while (true) { counter = Ghost_ConstantWalk4(counter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger); if (timer_attack <= 0) { if (Ghost_HP > maxHP * 0.5) { attack = Choose(1, 2, 3); } else { attack = Choose(1, 2, 3, 4, 5); } if (Ghost_HP <= maxHP * 0.25) { timer_attack = Rand(45, 100); } else { timer_attack = Rand(75, 130); } if (attack == 1) { MegaXAttack1(this, ghost); } else if (attack == 2) { MegaXAttack2(this, ghost); } else if (attack == 3) { MegaXAttack3(this, ghost); } else if (attack == 4) { MegaXAttack4(this, ghost); } else if (attack == 5) { MegaXAttack5(this, ghost); } } else { timer_attack--; } if (Ghost_HP <= maxHP * 0.25 && !speedup) { ghost->Step *= 1.5; speedup = true; } MegaX_Waitframe(this, ghost); } } } void MegaXAttack1(ffc this, npc ghost) { int loc[3]; int npc_id[3]; MegaX_Waitframes(this, ghost, 30); Game->PlaySound(SFX_SUMMON); for (int i = 0; i < 3; i++) { loc[i] = FindSpawnPoint(true, false, false, false); npc_id[i] = Choose(NPC_OCTOROCK1S, NPC_KEESE1, NPC_MOBLIN1); lweapon spawnpuff = CreateLWeaponAt(LW_SPARKLE, ComboX(loc[i]), ComboY(loc[i])); //spawnpuff->CollDetection = false; spawnpuff->UseSprite(22); spawnpuff->NumFrames = 3; spawnpuff->ASpeed = 3; //spawnpuff->DeadState = spawnpuff->NumFrames * spawnpuff->ASpeed; } MegaX_Waitframes(this, ghost, 12); for (int i = 0; i < 3; i++) { CreateNPCAt(npc_id[i], ComboX(loc[i]), ComboY(loc[i])); } MegaX_Waitframes(this, ghost, 30); } void MegaXAttack2(ffc this, npc ghost) { eweapon firebomb; float angle; MegaX_Waitframes(this, ghost, 30); for (int i = 0; i < 3; i++) { angle = Randf(0, PI2); firebomb = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, angle, 200, ghost->WeaponDamage, 17, SFX_FIREBALL, EWF_UNBLOCKABLE); SetEWeaponDeathEffect(firebomb, EWD_EXPLODE, ghost->WeaponDamage); firebomb->Misc[0] = 22222; MegaX_Waitframes(this, ghost, 20); } MegaX_Waitframes(this, ghost, 30); } void MegaXAttack3(ffc this, npc ghost) { eweapon bomb; float angle; MegaX_Waitframes(this, ghost, 30); MegaX_JumpToCenter(this, ghost); MegaX_Waitframes(this, ghost, 10); for (int i = 0; i < 8; i++) { angle = RadianAngle(Ghost_X, Ghost_Y, Link->X, Link->Y); bomb = FireEWeapon(EW_BOMB, Ghost_X, Ghost_Y, angle, 300, ghost->WeaponDamage * 2, 7, 0, EWF_UNBLOCKABLE | EWF_ROTATE); bomb->Misc[0] = 33333; MegaX_Waitframes(this, ghost, 20); } MegaX_Waitframes(this, ghost, 30); } void MegaXAttack4(ffc this, npc ghost) { eweapon fire; int draw_offset_x = ghost->DrawXOffset; int hit_offset_x = ghost->HitXOffset; int loc; float xscale; float yscale; float angle; MegaX_Waitframes(this, ghost, 30); for (int i = 0; i < 5; i++) { ghost->DrawXOffset = -1000; ghost->HitXOffset = -1000; Game->PlaySound(SFX_WAND); for (int j = 0; j < 10; j++) { xscale = 16 * (1 - ((j + 1) / 10)); yscale = 16 * (1 + ((j + 1) / 10)); Screen->DrawTile(3, Ghost_X + 8 - (0.5 * xscale), Ghost_Y + 8 - (0.5 * yscale), ghost->Tile, 1, 1, Ghost_CSet, xscale, yscale, 0, 0, 0, 0, true, OP_OPAQUE); MegaX_Waitframe(this, ghost); } loc = FindSpawnPoint(true, false, false, false); Ghost_X = ComboX(loc); Ghost_Y = ComboY(loc); for (int j = 0; j < 10; j++) { xscale = 16 * ((j + 1) / 10); yscale = 16 * (2 - ((j + 1) / 10)); Screen->DrawTile(3, Ghost_X + 8 - (0.5 * xscale), Ghost_Y + 8 - (0.5 * yscale), ghost->Tile, 1, 1, Ghost_CSet, xscale, yscale, 0, 0, 0, 0, true, OP_OPAQUE); MegaX_Waitframe(this, ghost); } ghost->DrawXOffset = draw_offset_x; ghost->HitXOffset = hit_offset_x; angle = RadianAngle(Ghost_X, Ghost_Y, Link->X, Link->Y); fire = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, angle, 200, ghost->WeaponDamage * 2, 35, SFX_FIRE, EWF_UNBLOCKABLE); SetEWeaponDeathEffect(fire, EWD_8_FIRES, 35); fire->Misc[0] = 44444; MegaX_Waitframes(this, ghost, 10); } MegaX_Waitframes(this, ghost, 30); } void MegaXAttack5(ffc this, npc ghost) { eweapon fireball; float angle; MegaX_Waitframes(this, ghost, 30); MegaX_JumpToCenter(this, ghost); MegaX_Waitframes(this, ghost, 30); for (int i = 0; i < 300; i++) { if (i % 5 == 0) { angle = RadianAngle(Ghost_X, Ghost_Y, Link->X, Link->Y); fireball = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, angle, 200, ghost->WeaponDamage, 17, SFX_FIREBALL, EWF_UNBLOCKABLE); } MegaX_Waitframe(this, ghost); } MegaX_Waitframes(this, ghost, 30); } void MegaX_JumpToCenter(ffc this, npc ghost) { float jump = 4; Game->PlaySound(SFX_JUMP); Ghost_Jump = jump; float x = Ghost_X; float y = Ghost_Y; int dest_x = 120; int dest_y = 80; float t; float t0 = jump / (0.5 * GRAVITY); float t1 = (jump + TERMINAL_VELOCITY) / GRAVITY; float t2 = ((-0.5 * GRAVITY * Pow(t1, 2)) + (jump * t1)) / TERMINAL_VELOCITY; if (t0 < t1) { t = t0; } else { t = t1 + t2; } float v = Distance(Ghost_X, Ghost_Y, dest_x, dest_y) / t; float angle = Angle(Ghost_X, Ghost_Y, dest_x, dest_y); Ghost_ForceDir(AngleDir4(WrapDegrees(angle))); for (int i = 0; i < t; i++) { x += VectorX(v, angle); y += VectorY(v, angle); Ghost_X = Round(x); Ghost_Y = Round(y); MegaX_Waitframe(this, ghost); } } void MegaX_Waitframe(ffc this, npc ghost) { eweapon ewpn; float e_vx; float e_vy; float e_vx_new; float e_vy_new; float step; for (int i = 1; i <= Screen->NumEWeapons(); i++) { ewpn = Screen->LoadEWeapon(i); if (ewpn->ID == EW_SCRIPT1 && ewpn->Misc[0] == 22222) { step = ewpn->Step * 0.01; e_vx = VectorX(step, RadtoDeg(ewpn->Angle)); e_vy = VectorY(step, RadtoDeg(ewpn->Angle)); e_vx_new = e_vx; e_vy_new = e_vy; if (e_vx < 0 && (Screen->isSolid(ewpn->X, ewpn->Y + 8) || ewpn->X <= 0)) { e_vx_new *= -1; } if (e_vx > 0 && (Screen->isSolid(ewpn->X + 16, ewpn->Y + 8) || ewpn->X + 16 >= 255)) { e_vx_new *= -1; } if (e_vy < 0 && (Screen->isSolid(ewpn->X + 8, ewpn->Y) || ewpn->Y <= 0)) { e_vy_new *= -1; } if (e_vy > 0 && (Screen->isSolid(ewpn->X + 8, ewpn->Y + 16) || ewpn->Y + 16 >= 175)) { e_vy_new *= -1; } if (e_vx != e_vx_new || e_vy != e_vy_new) { ewpn->Angle = ArcTan(e_vx_new, e_vy_new); ewpn->Misc[1]++; } if (ewpn->Misc[1] > 4 || LinkCollisionMod(ewpn)) { KillEWeapon(ewpn); ewpn->Misc[1] = 100; } if (ewpn->Misc[1] < 100 && ewpn->X > -4 && ewpn->X < 260 && ewpn->Y > -4 && ewpn->Y < 180) { ewpn->DeadState = WDS_ALIVE; } } if (ewpn->ID == EW_BOMB && ewpn->Misc[0] == 33333 && false) { if (Screen->isSolid(ewpn->X + 8, ewpn->Y + 8)) { KillEWeapon(ewpn); } } if (ewpn->ID == EW_SCRIPT1 && ewpn->Misc[0] == 44444) { if (Screen->isSolid(ewpn->X + 8, ewpn->Y + 8)) { KillEWeapon(ewpn); } } } Ghost_Waitframe(this, ghost, 1, true); } void MegaX_Waitframes(ffc this, npc ghost, int num) { for (int i = 0; i < num; i++) { MegaX_Waitframe(this, ghost); } } bool LinkCollisionMod(eweapon b) { int ax = Link->X + Link->HitXOffset; int bx = b->X + b->HitXOffset; int ay = Link->Y + Link->HitYOffset; int by = b->Y + b->HitYOffset; return RectCollision(ax+8, ay+8, ax+Link->HitWidth-8, ay+Link->HitHeight-8, bx, by, bx+b->HitWidth, by+b->HitHeight) && (Link->Z + Link->HitZHeight >= b->Z) && (Link->Z <= b->Z + b->HitZHeight); }
Can someone help me.
#554
Posted 21 August 2016 - 10:07 PM
#555
Posted 21 August 2016 - 10:21 PM
yes the ghost global script is in the active slot and the enemy type is other and enemy misc Attributes 11 are 928
and Attributes 12 are 1
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users